]> git.karo-electronics.de Git - linux-beck.git/commitdiff
s2io: Fixes in updating skb->truesize and code cleanup.
authorSivakumar Subramani <Sivakumar.Subramani@neterion.com>
Wed, 31 Jan 2007 18:32:57 +0000 (13:32 -0500)
committerJeff Garzik <jeff@garzik.org>
Mon, 5 Feb 2007 21:58:51 +0000 (16:58 -0500)
1. Fix for updating skb->truesize properly.
2. Disable NAPI only if more than one ring configured in case of MSI/MSI-X
   interrupts. Previously we were disabling NAPI irrespective of number of
   rings when MSI/MSI-X interrupts were used.
3. Code cleanup.

Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/s2io.c

index 350723bd5eb813ceb59de73342faaa73b7588ceb..9b9b28e85a7d272dbd690c0744a158bbb05976f0 100644 (file)
@@ -459,7 +459,7 @@ static int init_shared_mem(struct s2io_nic *nic)
        void *tmp_v_addr, *tmp_v_addr_next;
        dma_addr_t tmp_p_addr, tmp_p_addr_next;
        RxD_block_t *pre_rxd_blk = NULL;
-       int i, j, blk_cnt, rx_sz, tx_sz;
+       int i, j, blk_cnt;
        int lst_size, lst_per_page;
        struct net_device *dev = nic->dev;
        unsigned long tmp;
@@ -484,7 +484,6 @@ static int init_shared_mem(struct s2io_nic *nic)
        }
 
        lst_size = (sizeof(TxD_t) * config->max_txds);
-       tx_sz = lst_size * size;
        lst_per_page = PAGE_SIZE / lst_size;
 
        for (i = 0; i < config->tx_fifo_num; i++) {
@@ -583,7 +582,6 @@ static int init_shared_mem(struct s2io_nic *nic)
                size = (size * (sizeof(RxD1_t)));
        else
                size = (size * (sizeof(RxD3_t)));
-       rx_sz = size;
 
        for (i = 0; i < config->rx_ring_num; i++) {
                mac_control->rings[i].rx_curr_get_info.block_index = 0;
@@ -624,6 +622,8 @@ static int init_shared_mem(struct s2io_nic *nic)
                        rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)*
                                                  rxd_count[nic->rxd_mode],
                                                  GFP_KERNEL);
+                       if (!rx_blocks->rxds)
+                               return -ENOMEM;
                        for (l=0; l<rxd_count[nic->rxd_mode];l++) {
                                rx_blocks->rxds[l].virt_addr =
                                        rx_blocks->block_virt_addr +
@@ -2259,6 +2259,7 @@ static int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb)
                return -ENOMEM ;
        }
        frag_list = skb_shinfo(skb)->frag_list;
+       skb->truesize += frag_list->truesize;
        frag_list->next = NULL;
        tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1);
        frag_list->data = tmp;
@@ -3185,6 +3186,8 @@ static void alarm_intr_handler(struct s2io_nic *nic)
        register u64 val64 = 0, err_reg = 0;
        u64 cnt;
        int i;
+       if (atomic_read(&nic->card_state) == CARD_DOWN)
+               return;
        nic->mac_control.stats_info->sw_stat.ring_full_cnt = 0;
        /* Handling the XPAK counters update */
        if(nic->mac_control.stats_info->xpak_stat.xpak_timer_count < 72000) {
@@ -6576,7 +6579,6 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp)
                        skb_put(skb, buf1_len);
                        skb->len += buf2_len;
                        skb->data_len += buf2_len;
-                       skb->truesize += buf2_len;
                        skb_put(skb_shinfo(skb)->frag_list, buf2_len);
                        sp->stats.rx_bytes += buf1_len;
 
@@ -6797,6 +6799,8 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
                                        "Defaulting to INTA\n");
                *dev_intr_type = INTA;
        }
+       if ( (rx_ring_num > 1) && (*dev_intr_type != INTA) )
+               napi = 0;
        if (rx_ring_mode > 3) {
                DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n");
                DBG_PRINT(ERR_DBG, "s2io: Defaulting to 3-buffer mode\n");
@@ -7312,7 +7316,7 @@ int __init s2io_starter(void)
  * Description: This function is the cleanup routine for the driver. It unregist * ers the driver.
  */
 
-static void s2io_closer(void)
+static __exit void s2io_closer(void)
 {
        pci_unregister_driver(&s2io_driver);
        DBG_PRINT(INIT_DBG, "cleanup done\n");
@@ -7633,6 +7637,7 @@ static void lro_append_pkt(nic_t *sp, lro_t *lro, struct sk_buff *skb,
                lro->last_frag->next = skb;
        else
                skb_shinfo(first)->frag_list = skb;
+       first->truesize += skb->truesize;
        lro->last_frag = skb;
        sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++;
        return;