s2io: Fixes in updating skb->truesize and code cleanup.
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>
This commit is contained in:
parent
19a605220c
commit
372cc5972d
@ -459,7 +459,7 @@ static int init_shared_mem(struct s2io_nic *nic)
|
|||||||
void *tmp_v_addr, *tmp_v_addr_next;
|
void *tmp_v_addr, *tmp_v_addr_next;
|
||||||
dma_addr_t tmp_p_addr, tmp_p_addr_next;
|
dma_addr_t tmp_p_addr, tmp_p_addr_next;
|
||||||
RxD_block_t *pre_rxd_blk = NULL;
|
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;
|
int lst_size, lst_per_page;
|
||||||
struct net_device *dev = nic->dev;
|
struct net_device *dev = nic->dev;
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
@ -484,7 +484,6 @@ static int init_shared_mem(struct s2io_nic *nic)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lst_size = (sizeof(TxD_t) * config->max_txds);
|
lst_size = (sizeof(TxD_t) * config->max_txds);
|
||||||
tx_sz = lst_size * size;
|
|
||||||
lst_per_page = PAGE_SIZE / lst_size;
|
lst_per_page = PAGE_SIZE / lst_size;
|
||||||
|
|
||||||
for (i = 0; i < config->tx_fifo_num; i++) {
|
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)));
|
size = (size * (sizeof(RxD1_t)));
|
||||||
else
|
else
|
||||||
size = (size * (sizeof(RxD3_t)));
|
size = (size * (sizeof(RxD3_t)));
|
||||||
rx_sz = size;
|
|
||||||
|
|
||||||
for (i = 0; i < config->rx_ring_num; i++) {
|
for (i = 0; i < config->rx_ring_num; i++) {
|
||||||
mac_control->rings[i].rx_curr_get_info.block_index = 0;
|
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)*
|
rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)*
|
||||||
rxd_count[nic->rxd_mode],
|
rxd_count[nic->rxd_mode],
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
if (!rx_blocks->rxds)
|
||||||
|
return -ENOMEM;
|
||||||
for (l=0; l<rxd_count[nic->rxd_mode];l++) {
|
for (l=0; l<rxd_count[nic->rxd_mode];l++) {
|
||||||
rx_blocks->rxds[l].virt_addr =
|
rx_blocks->rxds[l].virt_addr =
|
||||||
rx_blocks->block_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 ;
|
return -ENOMEM ;
|
||||||
}
|
}
|
||||||
frag_list = skb_shinfo(skb)->frag_list;
|
frag_list = skb_shinfo(skb)->frag_list;
|
||||||
|
skb->truesize += frag_list->truesize;
|
||||||
frag_list->next = NULL;
|
frag_list->next = NULL;
|
||||||
tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1);
|
tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1);
|
||||||
frag_list->data = tmp;
|
frag_list->data = tmp;
|
||||||
@ -3185,6 +3186,8 @@ static void alarm_intr_handler(struct s2io_nic *nic)
|
|||||||
register u64 val64 = 0, err_reg = 0;
|
register u64 val64 = 0, err_reg = 0;
|
||||||
u64 cnt;
|
u64 cnt;
|
||||||
int i;
|
int i;
|
||||||
|
if (atomic_read(&nic->card_state) == CARD_DOWN)
|
||||||
|
return;
|
||||||
nic->mac_control.stats_info->sw_stat.ring_full_cnt = 0;
|
nic->mac_control.stats_info->sw_stat.ring_full_cnt = 0;
|
||||||
/* Handling the XPAK counters update */
|
/* Handling the XPAK counters update */
|
||||||
if(nic->mac_control.stats_info->xpak_stat.xpak_timer_count < 72000) {
|
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_put(skb, buf1_len);
|
||||||
skb->len += buf2_len;
|
skb->len += buf2_len;
|
||||||
skb->data_len += buf2_len;
|
skb->data_len += buf2_len;
|
||||||
skb->truesize += buf2_len;
|
|
||||||
skb_put(skb_shinfo(skb)->frag_list, buf2_len);
|
skb_put(skb_shinfo(skb)->frag_list, buf2_len);
|
||||||
sp->stats.rx_bytes += buf1_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");
|
"Defaulting to INTA\n");
|
||||||
*dev_intr_type = INTA;
|
*dev_intr_type = INTA;
|
||||||
}
|
}
|
||||||
|
if ( (rx_ring_num > 1) && (*dev_intr_type != INTA) )
|
||||||
|
napi = 0;
|
||||||
if (rx_ring_mode > 3) {
|
if (rx_ring_mode > 3) {
|
||||||
DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n");
|
DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n");
|
||||||
DBG_PRINT(ERR_DBG, "s2io: Defaulting to 3-buffer mode\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.
|
* 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);
|
pci_unregister_driver(&s2io_driver);
|
||||||
DBG_PRINT(INIT_DBG, "cleanup done\n");
|
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;
|
lro->last_frag->next = skb;
|
||||||
else
|
else
|
||||||
skb_shinfo(first)->frag_list = skb;
|
skb_shinfo(first)->frag_list = skb;
|
||||||
|
first->truesize += skb->truesize;
|
||||||
lro->last_frag = skb;
|
lro->last_frag = skb;
|
||||||
sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++;
|
sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++;
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user