]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/tlan.c
tlan: get rid of padding buffer
[linux-2.6-omap-h63xx.git] / drivers / net / tlan.c
index 3af5b92b48c8f1c18ba24b75df46e44ed04959e5..d1633fbf46ce80e398a7d31a32634f0d33030c7d 100644 (file)
@@ -218,8 +218,6 @@ static      int             bbuf;
 module_param(bbuf, int, 0);
 MODULE_PARM_DESC(bbuf, "ThunderLAN use big buffer (0-1)");
 
-static u8              *TLanPadBuffer;
-static  dma_addr_t     TLanPadBufferDMA;
 static char            TLanSignature[] = "TLAN";
 static  const char tlan_banner[] = "ThunderLAN driver v1.15\n";
 static  int tlan_have_pci;
@@ -469,16 +467,6 @@ static int __init tlan_probe(void)
 
        printk(KERN_INFO "%s", tlan_banner);
 
-       TLanPadBuffer = (u8 *) pci_alloc_consistent(NULL, TLAN_MIN_FRAME_SIZE, &TLanPadBufferDMA);
-
-       if (TLanPadBuffer == NULL) {
-               printk(KERN_ERR "TLAN: Could not allocate memory for pad buffer.\n");
-               rc = -ENOMEM;
-               goto err_out;
-       }
-
-       memset(TLanPadBuffer, 0, TLAN_MIN_FRAME_SIZE);
-
        TLAN_DBG(TLAN_DEBUG_PROBE, "Starting PCI Probe....\n");
 
        /* Use new style PCI probing. Now the kernel will
@@ -506,8 +494,6 @@ static int __init tlan_probe(void)
 err_out_pci_unreg:
        pci_unregister_driver(&tlan_driver);
 err_out_pci_free:
-       pci_free_consistent(NULL, TLAN_MIN_FRAME_SIZE, TLanPadBuffer, TLanPadBufferDMA);
-err_out:
        return rc;
 }
 
@@ -724,8 +710,6 @@ static void __exit tlan_exit(void)
        if (tlan_have_eisa)
                TLan_Eisa_Cleanup();
 
-       pci_free_consistent(NULL, TLAN_MIN_FRAME_SIZE, TLanPadBuffer, TLanPadBufferDMA);
-
 }
 
 
@@ -1096,7 +1080,6 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev )
        TLanList        *tail_list;
        dma_addr_t      tail_list_phys;
        u8              *tail_buffer;
-       int             pad;
        unsigned long   flags;
 
        if ( ! priv->phyOnline ) {
@@ -1105,6 +1088,9 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev )
                return 0;
        }
 
+       if (skb_padto(skb, TLAN_MIN_FRAME_SIZE))
+               return 0;
+
        tail_list = priv->txList + priv->txTail;
        tail_list_phys = priv->txListDMA + sizeof(TLanList) * priv->txTail;
 
@@ -1125,19 +1111,10 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev )
                TLan_StoreSKB(tail_list, skb);
        }
 
-       pad = TLAN_MIN_FRAME_SIZE - skb->len;
-
-       if ( pad > 0 ) {
-               tail_list->frameSize = (u16) skb->len + pad;
-               tail_list->buffer[0].count = (u32) skb->len;
-               tail_list->buffer[1].count = TLAN_LAST_BUFFER | (u32) pad;
-               tail_list->buffer[1].address = TLanPadBufferDMA;
-       } else {
-               tail_list->frameSize = (u16) skb->len;
-               tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) skb->len;
-               tail_list->buffer[1].count = 0;
-               tail_list->buffer[1].address = 0;
-       }
+       tail_list->frameSize = (u16) skb->len;
+       tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) skb->len;
+       tail_list->buffer[1].count = 0;
+       tail_list->buffer[1].address = 0;
 
        spin_lock_irqsave(&priv->lock, flags);
        tail_list->cStat = TLAN_CSTAT_READY;
@@ -1400,7 +1377,7 @@ static void TLan_SetMulticastList( struct net_device *dev )
         *
         **************************************************************/
 
-u32 TLan_HandleInvalid( struct net_device *dev, u16 host_int )
+static u32 TLan_HandleInvalid( struct net_device *dev, u16 host_int )
 {
        /* printk( "TLAN:  Invalid interrupt on %s.\n", dev->name ); */
        return 0;
@@ -1432,7 +1409,7 @@ u32 TLan_HandleInvalid( struct net_device *dev, u16 host_int )
         *
         **************************************************************/
 
-u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int )
+static u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        int             eoc = 0;
@@ -1518,7 +1495,7 @@ u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int )
         *
         **************************************************************/
 
-u32 TLan_HandleStatOverflow( struct net_device *dev, u16 host_int )
+static u32 TLan_HandleStatOverflow( struct net_device *dev, u16 host_int )
 {
        TLan_ReadAndClearStats( dev, TLAN_RECORD );
 
@@ -1554,7 +1531,7 @@ u32 TLan_HandleStatOverflow( struct net_device *dev, u16 host_int )
         *
         **************************************************************/
 
-u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int )
+static u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u32             ack = 0;
@@ -1689,7 +1666,7 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int )
         *
         **************************************************************/
 
-u32 TLan_HandleDummy( struct net_device *dev, u16 host_int )
+static u32 TLan_HandleDummy( struct net_device *dev, u16 host_int )
 {
        printk( "TLAN:  Test interrupt on %s.\n", dev->name );
        return 1;
@@ -1719,7 +1696,7 @@ u32 TLan_HandleDummy( struct net_device *dev, u16 host_int )
         *
         **************************************************************/
 
-u32 TLan_HandleTxEOC( struct net_device *dev, u16 host_int )
+static u32 TLan_HandleTxEOC( struct net_device *dev, u16 host_int )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        TLanList                *head_list;
@@ -1767,7 +1744,7 @@ u32 TLan_HandleTxEOC( struct net_device *dev, u16 host_int )
         *
         **************************************************************/
 
-u32 TLan_HandleStatusCheck( struct net_device *dev, u16 host_int )
+static u32 TLan_HandleStatusCheck( struct net_device *dev, u16 host_int )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u32             ack;
@@ -1842,7 +1819,7 @@ u32 TLan_HandleStatusCheck( struct net_device *dev, u16 host_int )
         *
         **************************************************************/
 
-u32 TLan_HandleRxEOC( struct net_device *dev, u16 host_int )
+static u32 TLan_HandleRxEOC( struct net_device *dev, u16 host_int )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        dma_addr_t      head_list_phys;
@@ -1902,7 +1879,7 @@ u32 TLan_HandleRxEOC( struct net_device *dev, u16 host_int )
         *
         **************************************************************/
 
-void TLan_Timer( unsigned long data )
+static void TLan_Timer( unsigned long data )
 {
        struct net_device       *dev = (struct net_device *) data;
        TLanPrivateInfo *priv = netdev_priv(dev);
@@ -1983,7 +1960,7 @@ void TLan_Timer( unsigned long data )
         *
         **************************************************************/
 
-void TLan_ResetLists( struct net_device *dev )
+static void TLan_ResetLists( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        int             i;
@@ -2043,7 +2020,7 @@ void TLan_ResetLists( struct net_device *dev )
 } /* TLan_ResetLists */
 
 
-void TLan_FreeLists( struct net_device *dev )
+static void TLan_FreeLists( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        int             i;
@@ -2092,7 +2069,7 @@ void TLan_FreeLists( struct net_device *dev )
         *
         **************************************************************/
 
-void TLan_PrintDio( u16 io_base )
+static void TLan_PrintDio( u16 io_base )
 {
        u32 data0, data1;
        int     i;
@@ -2127,7 +2104,7 @@ void TLan_PrintDio( u16 io_base )
         *
         **************************************************************/
 
-void TLan_PrintList( TLanList *list, char *type, int num)
+static void TLan_PrintList( TLanList *list, char *type, int num)
 {
        int i;
 
@@ -2163,7 +2140,7 @@ void TLan_PrintList( TLanList *list, char *type, int num)
         *
         **************************************************************/
 
-void TLan_ReadAndClearStats( struct net_device *dev, int record )
+static void TLan_ReadAndClearStats( struct net_device *dev, int record )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u32             tx_good, tx_under;
@@ -2238,7 +2215,7 @@ void TLan_ReadAndClearStats( struct net_device *dev, int record )
         *
         **************************************************************/
 
-void
+static void
 TLan_ResetAdapter( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
@@ -2324,7 +2301,7 @@ TLan_ResetAdapter( struct net_device *dev )
 
 
 
-void
+static void
 TLan_FinishReset( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
@@ -2448,7 +2425,7 @@ TLan_FinishReset( struct net_device *dev )
         *
         **************************************************************/
 
-void TLan_SetMac( struct net_device *dev, int areg, char *mac )
+static void TLan_SetMac( struct net_device *dev, int areg, char *mac )
 {
        int i;
 
@@ -2490,7 +2467,7 @@ void TLan_SetMac( struct net_device *dev, int areg, char *mac )
         *
         ********************************************************************/
 
-void TLan_PhyPrint( struct net_device *dev )
+static void TLan_PhyPrint( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u16 i, data0, data1, data2, data3, phy;
@@ -2539,7 +2516,7 @@ void TLan_PhyPrint( struct net_device *dev )
         *
         ********************************************************************/
 
-void TLan_PhyDetect( struct net_device *dev )
+static void TLan_PhyDetect( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u16             control;
@@ -2586,7 +2563,7 @@ void TLan_PhyDetect( struct net_device *dev )
 
 
 
-void TLan_PhyPowerDown( struct net_device *dev )
+static void TLan_PhyPowerDown( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u16             value;
@@ -2611,7 +2588,7 @@ void TLan_PhyPowerDown( struct net_device *dev )
 
 
 
-void TLan_PhyPowerUp( struct net_device *dev )
+static void TLan_PhyPowerUp( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u16             value;
@@ -2632,7 +2609,7 @@ void TLan_PhyPowerUp( struct net_device *dev )
 
 
 
-void TLan_PhyReset( struct net_device *dev )
+static void TLan_PhyReset( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u16             phy;
@@ -2660,7 +2637,7 @@ void TLan_PhyReset( struct net_device *dev )
 
 
 
-void TLan_PhyStartLink( struct net_device *dev )
+static void TLan_PhyStartLink( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u16             ability;
@@ -2747,7 +2724,7 @@ void TLan_PhyStartLink( struct net_device *dev )
 
 
 
-void TLan_PhyFinishAutoNeg( struct net_device *dev )
+static void TLan_PhyFinishAutoNeg( struct net_device *dev )
 {
        TLanPrivateInfo *priv = netdev_priv(dev);
        u16             an_adv;
@@ -2903,7 +2880,7 @@ void TLan_PhyMonitor( struct net_device *dev )
         *
         **************************************************************/
 
-int TLan_MiiReadReg( struct net_device *dev, u16 phy, u16 reg, u16 *val )
+static int TLan_MiiReadReg( struct net_device *dev, u16 phy, u16 reg, u16 *val )
 {
        u8      nack;
        u16     sio, tmp;
@@ -2993,7 +2970,7 @@ int TLan_MiiReadReg( struct net_device *dev, u16 phy, u16 reg, u16 *val )
         *
         **************************************************************/
 
-void TLan_MiiSendData( u16 base_port, u32 data, unsigned num_bits )
+static void TLan_MiiSendData( u16 base_port, u32 data, unsigned num_bits )
 {
        u16 sio;
        u32 i;
@@ -3035,7 +3012,7 @@ void TLan_MiiSendData( u16 base_port, u32 data, unsigned num_bits )
         *
         **************************************************************/
 
-void TLan_MiiSync( u16 base_port )
+static void TLan_MiiSync( u16 base_port )
 {
        int i;
        u16 sio;
@@ -3074,7 +3051,7 @@ void TLan_MiiSync( u16 base_port )
         *
         **************************************************************/
 
-void TLan_MiiWriteReg( struct net_device *dev, u16 phy, u16 reg, u16 val )
+static void TLan_MiiWriteReg( struct net_device *dev, u16 phy, u16 reg, u16 val )
 {
        u16     sio;
        int     minten;
@@ -3144,7 +3121,7 @@ void TLan_MiiWriteReg( struct net_device *dev, u16 phy, u16 reg, u16 val )
         *
         **************************************************************/
 
-void TLan_EeSendStart( u16 io_base )
+static void TLan_EeSendStart( u16 io_base )
 {
        u16     sio;
 
@@ -3184,7 +3161,7 @@ void TLan_EeSendStart( u16 io_base )
         *
         **************************************************************/
 
-int TLan_EeSendByte( u16 io_base, u8 data, int stop )
+static int TLan_EeSendByte( u16 io_base, u8 data, int stop )
 {
        int     err;
        u8      place;
@@ -3245,7 +3222,7 @@ int TLan_EeSendByte( u16 io_base, u8 data, int stop )
         *
         **************************************************************/
 
-void TLan_EeReceiveByte( u16 io_base, u8 *data, int stop )
+static void TLan_EeReceiveByte( u16 io_base, u8 *data, int stop )
 {
        u8  place;
        u16 sio;
@@ -3303,7 +3280,7 @@ void TLan_EeReceiveByte( u16 io_base, u8 *data, int stop )
         *
         **************************************************************/
 
-int TLan_EeReadByte( struct net_device *dev, u8 ee_addr, u8 *data )
+static int TLan_EeReadByte( struct net_device *dev, u8 ee_addr, u8 *data )
 {
        int err;
        TLanPrivateInfo *priv = netdev_priv(dev);