[PATCH 2.6.20 4/5] s2io: Removed enabling of some of the unused interrupts.

2007-01-28 Thread Ananda Raju
Removed unused code in en_dis_able_nic_intrs(), TX_DMA_INTR, RX_DMA_INTR,
TX_XGXS_INTR, MC_INTR

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN patch3/drivers/net/s2io.c patch4/drivers/net/s2io.c
--- patch3/drivers/net/s2io.c   2007-01-28 11:48:34.0 +0530
+++ patch4/drivers/net/s2io.c   2007-01-28 11:50:34.0 +0530
@@ -1658,7 +1658,7 @@ static void en_dis_able_nic_intrs(struct
/*  PIC Interrupts */
if ((mask & (TX_PIC_INTR | RX_PIC_INTR))) {
/*  Enable PIC Intrs in the general intr mask register */
-   val64 = TXPIC_INT_M | PIC_RX_INT_M;
+   val64 = TXPIC_INT_M;
if (flag == ENABLE_INTRS) {
temp64 = readq(&bar0->general_int_mask);
temp64 &= ~((u64) val64);
@@ -1696,70 +1696,6 @@ static void en_dis_able_nic_intrs(struct
}
}
 
-   /*  DMA Interrupts */
-   /*  Enabling/Disabling Tx DMA interrupts */
-   if (mask & TX_DMA_INTR) {
-   /* Enable TxDMA Intrs in the general intr mask register */
-   val64 = TXDMA_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* Keep all interrupts other than PFC interrupt
-* and PCC interrupt disabled in DMA level.
-*/
-   val64 = DISABLE_ALL_INTRS & ~(TXDMA_PFC_INT_M |
- TXDMA_PCC_INT_M);
-   writeq(val64, &bar0->txdma_int_mask);
-   /*
-* Enable only the MISC error 1 interrupt in PFC block
-*/
-   val64 = DISABLE_ALL_INTRS & (~PFC_MISC_ERR_1);
-   writeq(val64, &bar0->pfc_err_mask);
-   /*
-* Enable only the FB_ECC error interrupt in PCC block
-*/
-   val64 = DISABLE_ALL_INTRS & (~PCC_FB_ECC_ERR);
-   writeq(val64, &bar0->pcc_err_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable TxDMA Intrs in the general intr mask
-* register
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->txdma_int_mask);
-   writeq(DISABLE_ALL_INTRS, &bar0->pfc_err_mask);
-   temp64 = readq(&bar0->general_int_mask);
-   val64 |= temp64;
-   writeq(val64, &bar0->general_int_mask);
-   }
-   }
-
-   /*  Enabling/Disabling Rx DMA interrupts */
-   if (mask & RX_DMA_INTR) {
-   /*  Enable RxDMA Intrs in the general intr mask register */
-   val64 = RXDMA_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* All RxDMA block interrupts are disabled for now
-* TODO
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->rxdma_int_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable RxDMA Intrs in the general intr mask
-* register
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->rxdma_int_mask);
-   temp64 = readq(&bar0->general_int_mask);
-   val64 |= temp64;
-   writeq(val64, &bar0->general_int_mask);
-   }
-   }
-
/*  MAC Interrupts */
/*  Enabling/Disabling MAC interrupts */
if (mask & (TX_MAC_INTR | RX_MAC_INTR)) {
@@ -1786,53 +1722,6 @@ static void en_dis_able_nic_intrs(struct
}
}
 
-   /*  XGXS Interrupts */
-   if (mask & (TX_XGXS_INTR | RX_XGXS_INTR)) {
-   val64 = TXXGXS_INT_M | RXXGXS_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* All XGXS block error interrupts are disabled for now
-* TODO
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->xgxs_int_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable MC Intrs in the general intr mask register
-  

[PATCH 2.6.20 3/5] s2io: Fixes in updating skb->truesize and code cleanup.

2007-01-28 Thread Ananda Raju
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 <[EMAIL PROTECTED]>
---
diff -urpN patch2/drivers/net/s2io.c patch3/drivers/net/s2io.c
--- patch2/drivers/net/s2io.c   2007-01-28 11:35:28.0 +0530
+++ patch3/drivers/net/s2io.c   2007-01-28 11:48:34.0 +0530
@@ -459,7 +459,7 @@ static int init_shared_mem(struct s2io_n
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_n
}
 
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_n
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_n
rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)*
  rxd_count[nic->rxd_mode],
  GFP_KERNEL);
+   if (!rx_blocks->rxds)
+   return -ENOMEM;
for (l=0; lrxd_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
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 s2
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) {
@@ -6580,7 +6583,6 @@ static int rx_osm_handler(ring_info_t *r
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;
 
@@ -6802,6 +6804,8 @@ static int s2io_verify_parm(struct pci_d
"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");
@@ -7321,7 +7325,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");
@@ -7642,6 +7646,7 @@ static void lro_append_pkt(nic_t *sp, lr
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;

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.20 2/5] S2IO: Fixes for reset and link handling.

2007-01-28 Thread Ananda Raju
1. Fix for reset and link handling.
2. Allow for promiscuos mode and multicast state be maintained through
   ifconfig up and down.
3. Support to print adapter serial number.

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN patch1/drivers/net/s2io.c patch2/drivers/net/s2io.c
--- patch1/drivers/net/s2io.c   2007-01-28 11:33:12.0 +0530
+++ patch2/drivers/net/s2io.c   2007-01-28 11:35:28.0 +0530
@@ -1415,7 +1415,7 @@ static int init_nic(struct s2io_nic *nic
 
val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) |
TTI_DATA2_MEM_TX_UFC_B(0x20) |
-   TTI_DATA2_MEM_TX_UFC_C(0x70) | TTI_DATA2_MEM_TX_UFC_D(0x80);
+   TTI_DATA2_MEM_TX_UFC_C(0x40) | TTI_DATA2_MEM_TX_UFC_D(0x80);
writeq(val64, &bar0->tti_data2_mem);
 
val64 = TTI_CMD_MEM_WE | TTI_CMD_MEM_STROBE_NEW_CMD;
@@ -1611,7 +1611,8 @@ static int init_nic(struct s2io_nic *nic
 * that does not start on an ADB to reduce disconnects.
 */
if (nic->device_type == XFRAME_II_DEVICE) {
-   val64 = EXT_REQ_EN | MISC_LINK_STABILITY_PRD(3);
+   val64 = FAULT_BEHAVIOUR | EXT_REQ_EN |
+   MISC_LINK_STABILITY_PRD(3);
writeq(val64, &bar0->misc_control);
val64 = readq(&bar0->pic_control2);
val64 &= ~(BIT(13)|BIT(14)|BIT(15));
@@ -1878,41 +1879,36 @@ static void en_dis_able_nic_intrs(struct
}
 }
 
-static int check_prc_pcc_state(u64 val64, int flag, int rev_id, int herc)
+/**
+ *  verify_pcc_quiescent- Checks for PCC quiescent state
+ *  Return: 1 If PCC is quiescence
+ *  0 If PCC is not quiescence
+ */
+static int verify_pcc_quiescent(nic_t *sp, int flag)
 {
-   int ret = 0;
+   int ret = 0, herc;
+   XENA_dev_config_t __iomem *bar0 = sp->bar0;
+   u64 val64 = readq(&bar0->adapter_status);
+   
+   herc = (sp->device_type == XFRAME_II_DEVICE);
 
if (flag == FALSE) {
-   if ((!herc && (rev_id >= 4)) || herc) {
-   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) &&
-   ((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
-ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
+   if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) {
+   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE)) 
ret = 1;
-   }
-   }else {
-   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) &&
-   ((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
-ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
+   } else {
+   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE))
ret = 1;
-   }
}
} else {
-   if ((!herc && (rev_id >= 4)) || herc) {
+   if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) {
if (((val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) ==
-ADAPTER_STATUS_RMAC_PCC_IDLE) &&
-   (!(val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ||
-((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
- ADAPTER_STATUS_RC_PRC_QUIESCENT))) {
+ADAPTER_STATUS_RMAC_PCC_IDLE))
ret = 1;
-   }
} else {
if (((val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) ==
-ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) &&
-   (!(val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ||
-((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
- ADAPTER_STATUS_RC_PRC_QUIESCENT))) {
+ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE))
ret = 1;
-   }
}
}
 
@@ -1920,9 +1916,6 @@ static int check_prc_pcc_state(u64 val64
 }
 /**
  *  verify_xena_quiescence - Checks whether the H/W is ready
- *  @val64 :  Value read from adapter status register.
- *  @flag : indicates if the adapter enable bit was ever written once
- *  before.
  *  Description: Returns whether the H/W is ready to go or not. Depending
  *  on whether adapter enable bit was written or not the comparison
  *  differs and the calling function passes the input argument flag to
@@ -1931,24 +1924,63 @@ static int check_prc_pcc_state(u64 val64
  *  0 If Xena is not quiescence
  */
 
-static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag)
+static int verify_xena_quiescence(nic_t *sp)
 {
-   int ret = 0, herc;
-   u64 tmp64 = ~((u64) val64);
-   int rev_id = get_xena_rev_id(sp->pdev);
+   int  mode;
+   XENA_dev_config_t __iomem *bar0 = sp->bar0;
+   u64 val64 = readq(&bar0->adapter_status);
+   mode 

[PATCH 2.6.20 1/5] s2io: Making LRO and UFO as module loadable parameter.

2007-01-28 Thread Ananda Raju
This patch adds two load parameters napi and ufo. Previously NAPI was
compilation option with these changes wan enable disable NAPI using load
parameter. Also we are introducing ufo load parameter to enable/disable
ufo feature

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN orig/drivers/net/s2io.c patch1/drivers/net/s2io.c
--- orig/drivers/net/s2io.c 2007-01-28 07:18:20.0 +0530
+++ patch1/drivers/net/s2io.c   2007-01-28 11:33:12.0 +0530
@@ -401,9 +401,10 @@ S2IO_PARM_INT(lro, 0);
  * aggregation happens until we hit max IP pkt size(64K)
  */
 S2IO_PARM_INT(lro_max_pkts, 0x);
-#ifndef CONFIG_S2IO_NAPI
 S2IO_PARM_INT(indicate_max_pkts, 0);
-#endif
+
+S2IO_PARM_INT(napi, 1);
+S2IO_PARM_INT(ufo, 0);
 
 static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
 {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
@@ -2274,9 +2275,7 @@ static int fill_rx_buffers(struct s2io_n
struct config_param *config;
u64 tmp;
buffAdd_t *ba;
-#ifndef CONFIG_S2IO_NAPI
unsigned long flags;
-#endif
RxD_t *first_rxdp = NULL;
 
mac_control = &nic->mac_control;
@@ -2320,12 +2319,15 @@ static int fill_rx_buffers(struct s2io_n
DBG_PRINT(INTR_DBG, "%s: Next block at: %p\n",
  dev->name, rxdp);
}
-#ifndef CONFIG_S2IO_NAPI
-   spin_lock_irqsave(&nic->put_lock, flags);
-   mac_control->rings[ring_no].put_pos =
-   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
-   spin_unlock_irqrestore(&nic->put_lock, flags);
-#endif
+   if(!napi) {
+   spin_lock_irqsave(&nic->put_lock, flags);
+   mac_control->rings[ring_no].put_pos =
+   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
+   spin_unlock_irqrestore(&nic->put_lock, flags);
+   } else {
+   mac_control->rings[ring_no].put_pos =
+   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
+   }   
if ((rxdp->Control_1 & RXD_OWN_XENA) &&
((nic->rxd_mode >= RXD_MODE_3A) &&
(rxdp->Control_2 & BIT(0 {
@@ -2568,7 +2570,6 @@ static void free_rx_buffers(struct s2io_
  * 0 on success and 1 if there are No Rx packets to be processed.
  */
 
-#if defined(CONFIG_S2IO_NAPI)
 static int s2io_poll(struct net_device *dev, int *budget)
 {
nic_t *nic = dev->priv;
@@ -2633,7 +2634,6 @@ no_rx:
atomic_dec(&nic->isr_cnt);
return 1;
 }
-#endif
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
 /**
@@ -2707,9 +2707,7 @@ static void rx_intr_handler(ring_info_t 
rx_curr_get_info_t get_info, put_info;
RxD_t *rxdp;
struct sk_buff *skb;
-#ifndef CONFIG_S2IO_NAPI
int pkt_cnt = 0;
-#endif
int i;
 
spin_lock(&nic->rx_lock);
@@ -2725,16 +2723,18 @@ static void rx_intr_handler(ring_info_t 
put_info = ring_data->rx_curr_put_info;
put_block = put_info.block_index;
rxdp = ring_data->rx_blocks[get_block].rxds[get_info.offset].virt_addr;
-#ifndef CONFIG_S2IO_NAPI
-   spin_lock(&nic->put_lock);
-   put_offset = ring_data->put_pos;
-   spin_unlock(&nic->put_lock);
-#else
-   put_offset = (put_block * (rxd_count[nic->rxd_mode] + 1)) +
-   put_info.offset;
-#endif
+   if (!napi) {
+   spin_lock(&nic->put_lock);
+   put_offset = ring_data->put_pos;
+   spin_unlock(&nic->put_lock);
+   } else
+   put_offset = ring_data->put_pos;
+
while (RXD_IS_UP2DT(rxdp)) {
-   /* If your are next to put index then it's FIFO full condition 
*/
+   /*
+* If your are next to put index then it's
+* FIFO full condition
+*/
if ((get_block == put_block) &&
(get_info.offset + 1) == put_info.offset) {
DBG_PRINT(INTR_DBG, "%s: Ring Full\n",dev->name);
@@ -2792,15 +2792,12 @@ static void rx_intr_handler(ring_info_t 
rxdp = ring_data->rx_blocks[get_block].block_virt_addr;
}
 
-#ifdef CONFIG_S2IO_NAPI
nic->pkts_to_process -= 1;
-   if (!nic->pkts_to_process)
+   if ((napi) && (!nic->pkts_to_process))
break;
-#else
pkt_cnt++;
if ((indicate_max_pkts) && (pkt_cnt > indicate_max_pkts))
break;
-#endif
}
if (nic->lro) {
/* Clear all LRO sessions before exiting */
@@ -4195,26 +4192,26 @@ static irqreturn_t s2io_isr(int irq, voi
org_mask = readq(&bar0->general_int_mask);
writeq(val64, &bar0->general_int_mask);
 
-#ifdef CONFIG_S2IO_NAPI
-   if (reason & GEN_INTR_RXTRAFFIC) {
-   if (netif

[PATCH 2.6.20 4/5] s2io: Removed enabling of some of the unused interrupts.

2007-01-23 Thread Ananda Raju
Removed unused code in en_dis_able_nic_intrs(), TX_DMA_INTR, RX_DMA_INTR,
TX_XGXS_INTR, MC_INTR

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN patch3/drivers/net/s2io.c patch4/drivers/net/s2io.c
--- patch3/drivers/net/s2io.c   2007-01-24 01:11:17.0 +0530
+++ patch4/drivers/net/s2io.c   2007-01-24 01:12:01.0 +0530
@@ -1659,7 +1659,7 @@ static void en_dis_able_nic_intrs(struct
/*  PIC Interrupts */
if ((mask & (TX_PIC_INTR | RX_PIC_INTR))) {
/*  Enable PIC Intrs in the general intr mask register */
-   val64 = TXPIC_INT_M | PIC_RX_INT_M;
+   val64 = TXPIC_INT_M;
if (flag == ENABLE_INTRS) {
temp64 = readq(&bar0->general_int_mask);
temp64 &= ~((u64) val64);
@@ -1697,70 +1697,6 @@ static void en_dis_able_nic_intrs(struct
}
}
 
-   /*  DMA Interrupts */
-   /*  Enabling/Disabling Tx DMA interrupts */
-   if (mask & TX_DMA_INTR) {
-   /* Enable TxDMA Intrs in the general intr mask register */
-   val64 = TXDMA_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* Keep all interrupts other than PFC interrupt
-* and PCC interrupt disabled in DMA level.
-*/
-   val64 = DISABLE_ALL_INTRS & ~(TXDMA_PFC_INT_M |
- TXDMA_PCC_INT_M);
-   writeq(val64, &bar0->txdma_int_mask);
-   /*
-* Enable only the MISC error 1 interrupt in PFC block
-*/
-   val64 = DISABLE_ALL_INTRS & (~PFC_MISC_ERR_1);
-   writeq(val64, &bar0->pfc_err_mask);
-   /*
-* Enable only the FB_ECC error interrupt in PCC block
-*/
-   val64 = DISABLE_ALL_INTRS & (~PCC_FB_ECC_ERR);
-   writeq(val64, &bar0->pcc_err_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable TxDMA Intrs in the general intr mask
-* register
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->txdma_int_mask);
-   writeq(DISABLE_ALL_INTRS, &bar0->pfc_err_mask);
-   temp64 = readq(&bar0->general_int_mask);
-   val64 |= temp64;
-   writeq(val64, &bar0->general_int_mask);
-   }
-   }
-
-   /*  Enabling/Disabling Rx DMA interrupts */
-   if (mask & RX_DMA_INTR) {
-   /*  Enable RxDMA Intrs in the general intr mask register */
-   val64 = RXDMA_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* All RxDMA block interrupts are disabled for now
-* TODO
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->rxdma_int_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable RxDMA Intrs in the general intr mask
-* register
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->rxdma_int_mask);
-   temp64 = readq(&bar0->general_int_mask);
-   val64 |= temp64;
-   writeq(val64, &bar0->general_int_mask);
-   }
-   }
-
/*  MAC Interrupts */
/*  Enabling/Disabling MAC interrupts */
if (mask & (TX_MAC_INTR | RX_MAC_INTR)) {
@@ -1787,53 +1723,6 @@ static void en_dis_able_nic_intrs(struct
}
}
 
-   /*  XGXS Interrupts */
-   if (mask & (TX_XGXS_INTR | RX_XGXS_INTR)) {
-   val64 = TXXGXS_INT_M | RXXGXS_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* All XGXS block error interrupts are disabled for now
-* TODO
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->xgxs_int_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable MC Intrs in the general intr mask register
-  

[PATCH 2.6.20 3/5] s2io: Fixes in updating skb->truesize and code cleanup.

2007-01-23 Thread Ananda Raju
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 <[EMAIL PROTECTED]>
---
diff -urpN patch2/drivers/net/s2io.c patch3/drivers/net/s2io.c
--- patch2/drivers/net/s2io.c   2007-01-23 23:56:49.0 +0530
+++ patch3/drivers/net/s2io.c   2007-01-24 01:11:17.0 +0530
@@ -459,7 +459,7 @@ static int init_shared_mem(struct s2io_n
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_n
}
 
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++) {
@@ -584,7 +583,6 @@ static int init_shared_mem(struct s2io_n
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;
@@ -625,6 +623,8 @@ static int init_shared_mem(struct s2io_n
rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)*
  rxd_count[nic->rxd_mode],
  GFP_KERNEL);
+   if (!rx_blocks->rxds)
+   return -ENOMEM;
for (l=0; lrxd_mode];l++) {
rx_blocks->rxds[l].virt_addr =
rx_blocks->block_virt_addr +
@@ -2260,6 +2260,7 @@ static int fill_rxd_3buf(nic_t *nic, RxD
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;
@@ -3184,6 +3185,8 @@ static void alarm_intr_handler(struct s2
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) {
@@ -6579,7 +6582,6 @@ static int rx_osm_handler(ring_info_t *r
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;
 
@@ -6801,6 +6803,8 @@ static int s2io_verify_parm(struct pci_d
"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");
@@ -7320,7 +7324,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");
@@ -7641,6 +7645,7 @@ static void lro_append_pkt(nic_t *sp, lr
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;

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.20 2/5] S2IO: Fixes for reset and link handling.

2007-01-23 Thread Ananda Raju
1. Fix for reset and link handling.
2. Allow for promiscuos mode and multicast state be maintained through
   ifconfig up and down.
3. Support to print adapter serial number.

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN patch1/drivers/net/s2io.c patch2/drivers/net/s2io.c
--- patch1/drivers/net/s2io.c   2007-01-23 14:51:16.0 +0530
+++ patch2/drivers/net/s2io.c   2007-01-23 23:56:49.0 +0530
@@ -1416,7 +1416,7 @@ static int init_nic(struct s2io_nic *nic
 
val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) |
TTI_DATA2_MEM_TX_UFC_B(0x20) |
-   TTI_DATA2_MEM_TX_UFC_C(0x70) | TTI_DATA2_MEM_TX_UFC_D(0x80);
+   TTI_DATA2_MEM_TX_UFC_C(0x40) | TTI_DATA2_MEM_TX_UFC_D(0x80);
writeq(val64, &bar0->tti_data2_mem);
 
val64 = TTI_CMD_MEM_WE | TTI_CMD_MEM_STROBE_NEW_CMD;
@@ -1612,7 +1612,8 @@ static int init_nic(struct s2io_nic *nic
 * that does not start on an ADB to reduce disconnects.
 */
if (nic->device_type == XFRAME_II_DEVICE) {
-   val64 = EXT_REQ_EN | MISC_LINK_STABILITY_PRD(3);
+   val64 = FAULT_BEHAVIOUR | EXT_REQ_EN |
+   MISC_LINK_STABILITY_PRD(3);
writeq(val64, &bar0->misc_control);
val64 = readq(&bar0->pic_control2);
val64 &= ~(BIT(13)|BIT(14)|BIT(15));
@@ -1879,41 +1880,36 @@ static void en_dis_able_nic_intrs(struct
}
 }
 
-static int check_prc_pcc_state(u64 val64, int flag, int rev_id, int herc)
+/**
+ *  verify_pcc_quiescent- Checks for PCC quiescent state
+ *  Return: 1 If PCC is quiescence
+ *  0 If PCC is not quiescence
+ */
+static int verify_pcc_quiescent(nic_t *sp, int flag)
 {
-   int ret = 0;
+   int ret = 0, herc;
+   XENA_dev_config_t __iomem *bar0 = sp->bar0;
+   u64 val64 = readq(&bar0->adapter_status);
+   
+   herc = (sp->device_type == XFRAME_II_DEVICE);
 
if (flag == FALSE) {
-   if ((!herc && (rev_id >= 4)) || herc) {
-   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) &&
-   ((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
-ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
+   if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) {
+   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE)) 
ret = 1;
-   }
-   }else {
-   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) &&
-   ((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
-ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
+   } else {
+   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE))
ret = 1;
-   }
}
} else {
-   if ((!herc && (rev_id >= 4)) || herc) {
+   if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) {
if (((val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) ==
-ADAPTER_STATUS_RMAC_PCC_IDLE) &&
-   (!(val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ||
-((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
- ADAPTER_STATUS_RC_PRC_QUIESCENT))) {
+ADAPTER_STATUS_RMAC_PCC_IDLE))
ret = 1;
-   }
} else {
if (((val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) ==
-ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) &&
-   (!(val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ||
-((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
- ADAPTER_STATUS_RC_PRC_QUIESCENT))) {
+ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE))
ret = 1;
-   }
}
}
 
@@ -1921,9 +1917,6 @@ static int check_prc_pcc_state(u64 val64
 }
 /**
  *  verify_xena_quiescence - Checks whether the H/W is ready
- *  @val64 :  Value read from adapter status register.
- *  @flag : indicates if the adapter enable bit was ever written once
- *  before.
  *  Description: Returns whether the H/W is ready to go or not. Depending
  *  on whether adapter enable bit was written or not the comparison
  *  differs and the calling function passes the input argument flag to
@@ -1932,24 +1925,63 @@ static int check_prc_pcc_state(u64 val64
  *  0 If Xena is not quiescence
  */
 
-static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag)
+static int verify_xena_quiescence(nic_t *sp)
 {
-   int ret = 0, herc;
-   u64 tmp64 = ~((u64) val64);
-   int rev_id = get_xena_rev_id(sp->pdev);
+   int  mode;
+   XENA_dev_config_t __iomem *bar0 = sp->bar0;
+   u64 val64 = readq(&bar0->adapter_status);
+   mode 

[PATCH 2.6.20 4/5] s2io: Removed enabling of some of the unused interrupts.

2007-01-18 Thread Ananda Raju
Removed unused code in en_dis_able_nic_intrs(), TX_DMA_INTR, RX_DMA_INTR,
TX_XGXS_INTR, MC_INTR

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN patch3/drivers/net/s2io.c patch4/drivers/net/s2io.c
--- patch3/drivers/net/s2io.c   2007-01-08 23:38:48.0 +0530
+++ patch4/drivers/net/s2io.c   2007-01-09 01:12:42.0 +0530
@@ -1659,7 +1659,7 @@ static void en_dis_able_nic_intrs(struct
/*  PIC Interrupts */
if ((mask & (TX_PIC_INTR | RX_PIC_INTR))) {
/*  Enable PIC Intrs in the general intr mask register */
-   val64 = TXPIC_INT_M | PIC_RX_INT_M;
+   val64 = TXPIC_INT_M;
if (flag == ENABLE_INTRS) {
temp64 = readq(&bar0->general_int_mask);
temp64 &= ~((u64) val64);
@@ -1697,70 +1697,6 @@ static void en_dis_able_nic_intrs(struct
}
}
 
-   /*  DMA Interrupts */
-   /*  Enabling/Disabling Tx DMA interrupts */
-   if (mask & TX_DMA_INTR) {
-   /* Enable TxDMA Intrs in the general intr mask register */
-   val64 = TXDMA_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* Keep all interrupts other than PFC interrupt
-* and PCC interrupt disabled in DMA level.
-*/
-   val64 = DISABLE_ALL_INTRS & ~(TXDMA_PFC_INT_M |
- TXDMA_PCC_INT_M);
-   writeq(val64, &bar0->txdma_int_mask);
-   /*
-* Enable only the MISC error 1 interrupt in PFC block
-*/
-   val64 = DISABLE_ALL_INTRS & (~PFC_MISC_ERR_1);
-   writeq(val64, &bar0->pfc_err_mask);
-   /*
-* Enable only the FB_ECC error interrupt in PCC block
-*/
-   val64 = DISABLE_ALL_INTRS & (~PCC_FB_ECC_ERR);
-   writeq(val64, &bar0->pcc_err_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable TxDMA Intrs in the general intr mask
-* register
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->txdma_int_mask);
-   writeq(DISABLE_ALL_INTRS, &bar0->pfc_err_mask);
-   temp64 = readq(&bar0->general_int_mask);
-   val64 |= temp64;
-   writeq(val64, &bar0->general_int_mask);
-   }
-   }
-
-   /*  Enabling/Disabling Rx DMA interrupts */
-   if (mask & RX_DMA_INTR) {
-   /*  Enable RxDMA Intrs in the general intr mask register */
-   val64 = RXDMA_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* All RxDMA block interrupts are disabled for now
-* TODO
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->rxdma_int_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable RxDMA Intrs in the general intr mask
-* register
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->rxdma_int_mask);
-   temp64 = readq(&bar0->general_int_mask);
-   val64 |= temp64;
-   writeq(val64, &bar0->general_int_mask);
-   }
-   }
-
/*  MAC Interrupts */
/*  Enabling/Disabling MAC interrupts */
if (mask & (TX_MAC_INTR | RX_MAC_INTR)) {
@@ -1787,53 +1723,6 @@ static void en_dis_able_nic_intrs(struct
}
}
 
-   /*  XGXS Interrupts */
-   if (mask & (TX_XGXS_INTR | RX_XGXS_INTR)) {
-   val64 = TXXGXS_INT_M | RXXGXS_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* All XGXS block error interrupts are disabled for now
-* TODO
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->xgxs_int_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable MC Intrs in the general intr mask register
-  

[PATCH 2.6.20 3/5] s2io: Fixes in updating skb->truesize and code cleanup.

2007-01-18 Thread Ananda Raju
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 <[EMAIL PROTECTED]>
---
diff -urpN patch2/drivers/net/s2io.c patch3/drivers/net/s2io.c
--- patch2/drivers/net/s2io.c   2007-01-08 17:51:20.0 +0530
+++ patch3/drivers/net/s2io.c   2007-01-08 23:38:48.0 +0530
@@ -459,7 +459,7 @@ static int init_shared_mem(struct s2io_n
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_n
}
 
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++) {
@@ -584,7 +583,6 @@ static int init_shared_mem(struct s2io_n
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;
@@ -625,6 +623,8 @@ static int init_shared_mem(struct s2io_n
rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)*
  rxd_count[nic->rxd_mode],
  GFP_KERNEL);
+   if (!rx_blocks->rxds)
+   return -ENOMEM;
for (l=0; lrxd_mode];l++) {
rx_blocks->rxds[l].virt_addr =
rx_blocks->block_virt_addr +
@@ -2260,6 +2260,7 @@ static int fill_rxd_3buf(nic_t *nic, RxD
return -ENOMEM ;
}
frag_list = skb_shinfo(skb)->frag_list;
+   skb->truesize += frag_list->truesize; //updating skb->truesize
frag_list->next = NULL;
tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1);
frag_list->data = tmp;
@@ -3186,6 +3187,8 @@ static void alarm_intr_handler(struct s2
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) {
@@ -6581,7 +6584,6 @@ static int rx_osm_handler(ring_info_t *r
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;
 
@@ -6803,6 +6805,8 @@ static int s2io_verify_parm(struct pci_d
"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");
@@ -6999,7 +7003,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
goto mem_alloc_failed;
}
 
-   sp->bar0 = ioremap(pci_resource_start(pdev, 0),
+   sp->bar0 = (caddr_t) ioremap(pci_resource_start(pdev, 0),
 pci_resource_len(pdev, 0));
if (!sp->bar0) {
DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem1\n",
@@ -7008,7 +7012,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
goto bar0_remap_failed;
}
 
-   sp->bar1 = ioremap(pci_resource_start(pdev, 2),
+   sp->bar1 = (caddr_t) ioremap(pci_resource_start(pdev, 2),
 pci_resource_len(pdev, 2));
if (!sp->bar1) {
DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem2\n",
@@ -7324,7 +7328,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");
@@ -7645,6 +7649,7 @@ static void lro_append_pkt(nic_t *sp, lr
lro->last_frag->next = skb;
else
skb_shinfo(first)->frag_list = skb;
+   first->truesize += skb->truesize;//updating skb->truesize
lro->l

[PATCH 2.6.20 2/5] S2IO: Fixes for reset and link handling.

2007-01-18 Thread Ananda Raju
1. Fix for reset and link handling.
2. Allow for promiscuos mode and multicast state be maintained through
   ifconfig up and down.
3. Support to print adapter serial number.

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN patch1/drivers/net/s2io.c patch2/drivers/net/s2io.c
--- patch1/drivers/net/s2io.c   2007-01-08 11:56:23.0 +0530
+++ patch2/drivers/net/s2io.c   2007-01-08 17:51:20.0 +0530
@@ -1416,7 +1416,7 @@ static int init_nic(struct s2io_nic *nic
 
val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) |
TTI_DATA2_MEM_TX_UFC_B(0x20) |
-   TTI_DATA2_MEM_TX_UFC_C(0x70) | TTI_DATA2_MEM_TX_UFC_D(0x80);
+   TTI_DATA2_MEM_TX_UFC_C(0x40) | TTI_DATA2_MEM_TX_UFC_D(0x80);
writeq(val64, &bar0->tti_data2_mem);
 
val64 = TTI_CMD_MEM_WE | TTI_CMD_MEM_STROBE_NEW_CMD;
@@ -1612,7 +1612,8 @@ static int init_nic(struct s2io_nic *nic
 * that does not start on an ADB to reduce disconnects.
 */
if (nic->device_type == XFRAME_II_DEVICE) {
-   val64 = EXT_REQ_EN | MISC_LINK_STABILITY_PRD(3);
+   val64 = FAULT_BEHAVIOUR | EXT_REQ_EN |
+   MISC_LINK_STABILITY_PRD(3);
writeq(val64, &bar0->misc_control);
val64 = readq(&bar0->pic_control2);
val64 &= ~(BIT(13)|BIT(14)|BIT(15));
@@ -1879,41 +1880,36 @@ static void en_dis_able_nic_intrs(struct
}
 }
 
-static int check_prc_pcc_state(u64 val64, int flag, int rev_id, int herc)
+/**
+ *  verify_pcc_quiescent- Checks for PCC quiescent state
+ *  Return: 1 If PCC is quiescence
+ *  0 If PCC is not quiescence
+ */
+static int verify_pcc_quiescent(nic_t *sp, int flag)
 {
-   int ret = 0;
+   int ret = 0, herc;
+   XENA_dev_config_t __iomem *bar0 = sp->bar0;
+   u64 val64 = readq(&bar0->adapter_status);
+   
+   herc = (sp->device_type == XFRAME_II_DEVICE);
 
if (flag == FALSE) {
-   if ((!herc && (rev_id >= 4)) || herc) {
-   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) &&
-   ((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
-ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
+   if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) {
+   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE)) 
ret = 1;
-   }
-   }else {
-   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) &&
-   ((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
-ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
+   } else {
+   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE))
ret = 1;
-   }
}
} else {
-   if ((!herc && (rev_id >= 4)) || herc) {
+   if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) {
if (((val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) ==
-ADAPTER_STATUS_RMAC_PCC_IDLE) &&
-   (!(val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ||
-((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
- ADAPTER_STATUS_RC_PRC_QUIESCENT))) {
+ADAPTER_STATUS_RMAC_PCC_IDLE))
ret = 1;
-   }
} else {
if (((val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) ==
-ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) &&
-   (!(val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ||
-((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
- ADAPTER_STATUS_RC_PRC_QUIESCENT))) {
+ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE))
ret = 1;
-   }
}
}
 
@@ -1921,9 +1917,6 @@ static int check_prc_pcc_state(u64 val64
 }
 /**
  *  verify_xena_quiescence - Checks whether the H/W is ready
- *  @val64 :  Value read from adapter status register.
- *  @flag : indicates if the adapter enable bit was ever written once
- *  before.
  *  Description: Returns whether the H/W is ready to go or not. Depending
  *  on whether adapter enable bit was written or not the comparison
  *  differs and the calling function passes the input argument flag to
@@ -1932,24 +1925,63 @@ static int check_prc_pcc_state(u64 val64
  *  0 If Xena is not quiescence
  */
 
-static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag)
+static int verify_xena_quiescence(nic_t *sp)
 {
-   int ret = 0, herc;
-   u64 tmp64 = ~((u64) val64);
-   int rev_id = get_xena_rev_id(sp->pdev);
+   int  mode;
+   XENA_dev_config_t __iomem *bar0 = sp->bar0;
+   u64 val64 = readq(&bar0->adapter_status);
+   mode 

[PATCH 2.6.20 1/5] s2io: Making LRO and UFO as module loadable parameter.

2007-01-18 Thread Ananda Raju
This patch adds two load parameters napi and ufo. Previously NAPI was
compilation option with these changes wan enable disable NAPI using load
parameter. Also we are introducing ufo load parameter to enable/disable
ufo feature

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN orig/drivers/net/s2io.c patch1/drivers/net/s2io.c
--- orig/drivers/net/s2io.c 2006-12-21 10:06:58.0 +0530
+++ patch1/drivers/net/s2io.c   2007-01-08 11:56:23.0 +0530
@@ -401,9 +401,10 @@ S2IO_PARM_INT(lro, 0);
  * aggregation happens until we hit max IP pkt size(64K)
  */
 S2IO_PARM_INT(lro_max_pkts, 0x);
-#ifndef CONFIG_S2IO_NAPI
 S2IO_PARM_INT(indicate_max_pkts, 0);
-#endif
+
+S2IO_PARM_INT(napi, 1);
+S2IO_PARM_INT(ufo, 0);
 
 static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
 {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
@@ -2275,9 +2276,7 @@ static int fill_rx_buffers(struct s2io_n
struct config_param *config;
u64 tmp;
buffAdd_t *ba;
-#ifndef CONFIG_S2IO_NAPI
unsigned long flags;
-#endif
RxD_t *first_rxdp = NULL;
 
mac_control = &nic->mac_control;
@@ -2321,12 +2320,15 @@ static int fill_rx_buffers(struct s2io_n
DBG_PRINT(INTR_DBG, "%s: Next block at: %p\n",
  dev->name, rxdp);
}
-#ifndef CONFIG_S2IO_NAPI
-   spin_lock_irqsave(&nic->put_lock, flags);
-   mac_control->rings[ring_no].put_pos =
-   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
-   spin_unlock_irqrestore(&nic->put_lock, flags);
-#endif
+   if(!napi) {
+   spin_lock_irqsave(&nic->put_lock, flags);
+   mac_control->rings[ring_no].put_pos =
+   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
+   spin_unlock_irqrestore(&nic->put_lock, flags);
+   } else {
+   mac_control->rings[ring_no].put_pos =
+   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
+   }   
if ((rxdp->Control_1 & RXD_OWN_XENA) &&
((nic->rxd_mode >= RXD_MODE_3A) &&
(rxdp->Control_2 & BIT(0 {
@@ -2569,7 +2571,7 @@ static void free_rx_buffers(struct s2io_
  * 0 on success and 1 if there are No Rx packets to be processed.
  */
 
-#if defined(CONFIG_S2IO_NAPI)
+#if defined(HAVE_NETDEV_POLL)
 static int s2io_poll(struct net_device *dev, int *budget)
 {
nic_t *nic = dev->priv;
@@ -2708,9 +2710,7 @@ static void rx_intr_handler(ring_info_t 
rx_curr_get_info_t get_info, put_info;
RxD_t *rxdp;
struct sk_buff *skb;
-#ifndef CONFIG_S2IO_NAPI
int pkt_cnt = 0;
-#endif
int i;
 
spin_lock(&nic->rx_lock);
@@ -2726,16 +2726,16 @@ static void rx_intr_handler(ring_info_t 
put_info = ring_data->rx_curr_put_info;
put_block = put_info.block_index;
rxdp = ring_data->rx_blocks[get_block].rxds[get_info.offset].virt_addr;
-#ifndef CONFIG_S2IO_NAPI
-   spin_lock(&nic->put_lock);
-   put_offset = ring_data->put_pos;
-   spin_unlock(&nic->put_lock);
-#else
-   put_offset = (put_block * (rxd_count[nic->rxd_mode] + 1)) +
-   put_info.offset;
-#endif
+   if (!napi) {
+   spin_lock(&nic->put_lock);
+   put_offset = ring_data->put_pos;
+   spin_unlock(&nic->put_lock);
+   } else
+   put_offset = ring_data->put_pos;
+
while (RXD_IS_UP2DT(rxdp)) {
-   /* If your are next to put index then it's FIFO full condition 
*/
+   /* If your are next to put index then it's
+  FIFO full condition */
if ((get_block == put_block) &&
(get_info.offset + 1) == put_info.offset) {
DBG_PRINT(INTR_DBG, "%s: Ring Full\n",dev->name);
@@ -2793,15 +2793,12 @@ static void rx_intr_handler(ring_info_t 
rxdp = ring_data->rx_blocks[get_block].block_virt_addr;
}
 
-#ifdef CONFIG_S2IO_NAPI
nic->pkts_to_process -= 1;
-   if (!nic->pkts_to_process)
+   if ((napi) && (!nic->pkts_to_process))
break;
-#else
pkt_cnt++;
if ((indicate_max_pkts) && (pkt_cnt > indicate_max_pkts))
break;
-#endif
}
if (nic->lro) {
/* Clear all LRO sessions before exiting */
@@ -4196,26 +4193,26 @@ static irqreturn_t s2io_isr(int irq, voi
org_mask = readq(&bar0->general_int_mask);
writeq(val64, &bar0->general_int_mask);
 
-#ifdef CONFIG_S2IO_NAPI
-   if (reason & GEN_INTR_RXTRAFFIC) {
-   if (netif_rx_schedule_prep(dev)) {
-   writeq(val64, &bar0->rx_traffic_mask);
-   __netif_rx_schedule(dev);
+

[PATCH 2.6.20 1/5] s2io: updates for s2io driver.

2007-01-10 Thread Ananda Raju
Hello, 

List of changes in this patch:

This patch adds two load parameters napi and ufo. Previously NAPI was
compilation option with these changes wan enable disable NAPI using load
parameter. Also we are introducing ufo load parameter to enable/disable
ufo feature

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN orig/drivers/net/s2io.c patch1/drivers/net/s2io.c
--- orig/drivers/net/s2io.c 2006-12-21 10:06:58.0 +0530
+++ patch1/drivers/net/s2io.c   2007-01-08 11:56:23.0 +0530
@@ -401,9 +401,10 @@ S2IO_PARM_INT(lro, 0);
  * aggregation happens until we hit max IP pkt size(64K)
  */
 S2IO_PARM_INT(lro_max_pkts, 0x);
-#ifndef CONFIG_S2IO_NAPI
 S2IO_PARM_INT(indicate_max_pkts, 0);
-#endif
+
+S2IO_PARM_INT(napi, 1);
+S2IO_PARM_INT(ufo, 0);
 
 static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
 {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
@@ -2275,9 +2276,7 @@ static int fill_rx_buffers(struct s2io_n
struct config_param *config;
u64 tmp;
buffAdd_t *ba;
-#ifndef CONFIG_S2IO_NAPI
unsigned long flags;
-#endif
RxD_t *first_rxdp = NULL;
 
mac_control = &nic->mac_control;
@@ -2321,12 +2320,15 @@ static int fill_rx_buffers(struct s2io_n
DBG_PRINT(INTR_DBG, "%s: Next block at: %p\n",
  dev->name, rxdp);
}
-#ifndef CONFIG_S2IO_NAPI
-   spin_lock_irqsave(&nic->put_lock, flags);
-   mac_control->rings[ring_no].put_pos =
-   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
-   spin_unlock_irqrestore(&nic->put_lock, flags);
-#endif
+   if(!napi) {
+   spin_lock_irqsave(&nic->put_lock, flags);
+   mac_control->rings[ring_no].put_pos =
+   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
+   spin_unlock_irqrestore(&nic->put_lock, flags);
+   } else {
+   mac_control->rings[ring_no].put_pos =
+   (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
+   }   
if ((rxdp->Control_1 & RXD_OWN_XENA) &&
((nic->rxd_mode >= RXD_MODE_3A) &&
(rxdp->Control_2 & BIT(0 {
@@ -2569,7 +2571,7 @@ static void free_rx_buffers(struct s2io_
  * 0 on success and 1 if there are No Rx packets to be processed.
  */
 
-#if defined(CONFIG_S2IO_NAPI)
+#if defined(HAVE_NETDEV_POLL)
 static int s2io_poll(struct net_device *dev, int *budget)
 {
nic_t *nic = dev->priv;
@@ -2708,9 +2710,7 @@ static void rx_intr_handler(ring_info_t 
rx_curr_get_info_t get_info, put_info;
RxD_t *rxdp;
struct sk_buff *skb;
-#ifndef CONFIG_S2IO_NAPI
int pkt_cnt = 0;
-#endif
int i;
 
spin_lock(&nic->rx_lock);
@@ -2726,16 +2726,16 @@ static void rx_intr_handler(ring_info_t 
put_info = ring_data->rx_curr_put_info;
put_block = put_info.block_index;
rxdp = ring_data->rx_blocks[get_block].rxds[get_info.offset].virt_addr;
-#ifndef CONFIG_S2IO_NAPI
-   spin_lock(&nic->put_lock);
-   put_offset = ring_data->put_pos;
-   spin_unlock(&nic->put_lock);
-#else
-   put_offset = (put_block * (rxd_count[nic->rxd_mode] + 1)) +
-   put_info.offset;
-#endif
+   if (!napi) {
+   spin_lock(&nic->put_lock);
+   put_offset = ring_data->put_pos;
+   spin_unlock(&nic->put_lock);
+   } else
+   put_offset = ring_data->put_pos;
+
while (RXD_IS_UP2DT(rxdp)) {
-   /* If your are next to put index then it's FIFO full condition 
*/
+   /* If your are next to put index then it's
+  FIFO full condition */
if ((get_block == put_block) &&
(get_info.offset + 1) == put_info.offset) {
DBG_PRINT(INTR_DBG, "%s: Ring Full\n",dev->name);
@@ -2793,15 +2793,12 @@ static void rx_intr_handler(ring_info_t 
rxdp = ring_data->rx_blocks[get_block].block_virt_addr;
}
 
-#ifdef CONFIG_S2IO_NAPI
nic->pkts_to_process -= 1;
-   if (!nic->pkts_to_process)
+   if ((napi) && (!nic->pkts_to_process))
break;
-#else
pkt_cnt++;
if ((indicate_max_pkts) && (pkt_cnt > indicate_max_pkts))
break;
-#endif
}
if (nic->lro) {
/* Clear all LRO sessions before exiting */
@@ -4196,26 +4193,26 @@ static irqreturn_t s2io_isr(int irq, voi
org_mask = readq(&bar0->general_int_mask);
writeq(val64, &bar0->general_int_mask);
 
-#ifdef CONFIG_S2IO_NAPI
-   if (reason & GEN_INTR_RXTRAFFIC) {
-   if (netif_rx_schedule_prep(dev)) {
-   writeq(val64, &bar0->rx_traffic_mask);
- 

[PATCH 2.6.20 4/5] s2io: updates fro s2io driver.

2007-01-10 Thread Ananda Raju
Hello, 

List of changes in this patch:

1. Removed unused code in en_dis_able_nic_intrs(), TX_DMA_INTR, RX_DMA_INTR,
   TX_XGXS_INTR, MC_INTR

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN patch3/drivers/net/s2io.c patch4/drivers/net/s2io.c
--- patch3/drivers/net/s2io.c   2007-01-08 23:38:48.0 +0530
+++ patch4/drivers/net/s2io.c   2007-01-09 01:12:42.0 +0530
@@ -1659,7 +1659,7 @@ static void en_dis_able_nic_intrs(struct
/*  PIC Interrupts */
if ((mask & (TX_PIC_INTR | RX_PIC_INTR))) {
/*  Enable PIC Intrs in the general intr mask register */
-   val64 = TXPIC_INT_M | PIC_RX_INT_M;
+   val64 = TXPIC_INT_M;
if (flag == ENABLE_INTRS) {
temp64 = readq(&bar0->general_int_mask);
temp64 &= ~((u64) val64);
@@ -1697,70 +1697,6 @@ static void en_dis_able_nic_intrs(struct
}
}
 
-   /*  DMA Interrupts */
-   /*  Enabling/Disabling Tx DMA interrupts */
-   if (mask & TX_DMA_INTR) {
-   /* Enable TxDMA Intrs in the general intr mask register */
-   val64 = TXDMA_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* Keep all interrupts other than PFC interrupt
-* and PCC interrupt disabled in DMA level.
-*/
-   val64 = DISABLE_ALL_INTRS & ~(TXDMA_PFC_INT_M |
- TXDMA_PCC_INT_M);
-   writeq(val64, &bar0->txdma_int_mask);
-   /*
-* Enable only the MISC error 1 interrupt in PFC block
-*/
-   val64 = DISABLE_ALL_INTRS & (~PFC_MISC_ERR_1);
-   writeq(val64, &bar0->pfc_err_mask);
-   /*
-* Enable only the FB_ECC error interrupt in PCC block
-*/
-   val64 = DISABLE_ALL_INTRS & (~PCC_FB_ECC_ERR);
-   writeq(val64, &bar0->pcc_err_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable TxDMA Intrs in the general intr mask
-* register
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->txdma_int_mask);
-   writeq(DISABLE_ALL_INTRS, &bar0->pfc_err_mask);
-   temp64 = readq(&bar0->general_int_mask);
-   val64 |= temp64;
-   writeq(val64, &bar0->general_int_mask);
-   }
-   }
-
-   /*  Enabling/Disabling Rx DMA interrupts */
-   if (mask & RX_DMA_INTR) {
-   /*  Enable RxDMA Intrs in the general intr mask register */
-   val64 = RXDMA_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* All RxDMA block interrupts are disabled for now
-* TODO
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->rxdma_int_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable RxDMA Intrs in the general intr mask
-* register
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->rxdma_int_mask);
-   temp64 = readq(&bar0->general_int_mask);
-   val64 |= temp64;
-   writeq(val64, &bar0->general_int_mask);
-   }
-   }
-
/*  MAC Interrupts */
/*  Enabling/Disabling MAC interrupts */
if (mask & (TX_MAC_INTR | RX_MAC_INTR)) {
@@ -1787,53 +1723,6 @@ static void en_dis_able_nic_intrs(struct
}
}
 
-   /*  XGXS Interrupts */
-   if (mask & (TX_XGXS_INTR | RX_XGXS_INTR)) {
-   val64 = TXXGXS_INT_M | RXXGXS_INT_M;
-   if (flag == ENABLE_INTRS) {
-   temp64 = readq(&bar0->general_int_mask);
-   temp64 &= ~((u64) val64);
-   writeq(temp64, &bar0->general_int_mask);
-   /*
-* All XGXS block error interrupts are disabled for now
-* TODO
-*/
-   writeq(DISABLE_ALL_INTRS, &bar0->xgxs_int_mask);
-   } else if (flag == DISABLE_INTRS) {
-   /*
-* Disable MC Intr

[PATCH 2.6.20 3/5] s2io: updates for s2io driver.

2007-01-10 Thread Ananda Raju
Hello, 

List of changes in this patch:

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 <[EMAIL PROTECTED]>
---
diff -urpN patch2/drivers/net/s2io.c patch3/drivers/net/s2io.c
--- patch2/drivers/net/s2io.c   2007-01-08 17:51:20.0 +0530
+++ patch3/drivers/net/s2io.c   2007-01-08 23:38:48.0 +0530
@@ -459,7 +459,7 @@ static int init_shared_mem(struct s2io_n
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_n
}
 
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++) {
@@ -584,7 +583,6 @@ static int init_shared_mem(struct s2io_n
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;
@@ -625,6 +623,8 @@ static int init_shared_mem(struct s2io_n
rx_blocks->rxds = kmalloc(sizeof(rxd_info_t)*
  rxd_count[nic->rxd_mode],
  GFP_KERNEL);
+   if (!rx_blocks->rxds)
+   return -ENOMEM;
for (l=0; lrxd_mode];l++) {
rx_blocks->rxds[l].virt_addr =
rx_blocks->block_virt_addr +
@@ -2260,6 +2260,7 @@ static int fill_rxd_3buf(nic_t *nic, RxD
return -ENOMEM ;
}
frag_list = skb_shinfo(skb)->frag_list;
+   skb->truesize += frag_list->truesize; //updating skb->truesize
frag_list->next = NULL;
tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1);
frag_list->data = tmp;
@@ -3186,6 +3187,8 @@ static void alarm_intr_handler(struct s2
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) {
@@ -6581,7 +6584,6 @@ static int rx_osm_handler(ring_info_t *r
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;
 
@@ -6803,6 +6805,8 @@ static int s2io_verify_parm(struct pci_d
"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");
@@ -6999,7 +7003,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
goto mem_alloc_failed;
}
 
-   sp->bar0 = ioremap(pci_resource_start(pdev, 0),
+   sp->bar0 = (caddr_t) ioremap(pci_resource_start(pdev, 0),
 pci_resource_len(pdev, 0));
if (!sp->bar0) {
DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem1\n",
@@ -7008,7 +7012,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
goto bar0_remap_failed;
}
 
-   sp->bar1 = ioremap(pci_resource_start(pdev, 2),
+   sp->bar1 = (caddr_t) ioremap(pci_resource_start(pdev, 2),
 pci_resource_len(pdev, 2));
if (!sp->bar1) {
DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem2\n",
@@ -7324,7 +7328,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");
@@ -7645,6 +7649,7 @@ static void lro_append_pkt(nic_t *sp, lr
lro->last_frag->next = skb;
else
skb_shinfo(first)->frag_list = skb;
+   first->truesize += skb->truesiz

[PATCH 2.6.20 2/5] s2io: updates for s2io driver.

2007-01-10 Thread Ananda Raju
Hello, 

List of changes in this patch:

1. Fix for reset and link handling.
2. Allow for promiscuos mode and multicast state be maintained through
   ifconfig up and down.
3. Support to print adapter serial number.

Signed-off-by: Sivakumar Subramani <[EMAIL PROTECTED]>
---
diff -urpN patch1/drivers/net/s2io.c patch2/drivers/net/s2io.c
--- patch1/drivers/net/s2io.c   2007-01-08 11:56:23.0 +0530
+++ patch2/drivers/net/s2io.c   2007-01-08 17:51:20.0 +0530
@@ -1416,7 +1416,7 @@ static int init_nic(struct s2io_nic *nic
 
val64 = TTI_DATA2_MEM_TX_UFC_A(0x10) |
TTI_DATA2_MEM_TX_UFC_B(0x20) |
-   TTI_DATA2_MEM_TX_UFC_C(0x70) | TTI_DATA2_MEM_TX_UFC_D(0x80);
+   TTI_DATA2_MEM_TX_UFC_C(0x40) | TTI_DATA2_MEM_TX_UFC_D(0x80);
writeq(val64, &bar0->tti_data2_mem);
 
val64 = TTI_CMD_MEM_WE | TTI_CMD_MEM_STROBE_NEW_CMD;
@@ -1612,7 +1612,8 @@ static int init_nic(struct s2io_nic *nic
 * that does not start on an ADB to reduce disconnects.
 */
if (nic->device_type == XFRAME_II_DEVICE) {
-   val64 = EXT_REQ_EN | MISC_LINK_STABILITY_PRD(3);
+   val64 = FAULT_BEHAVIOUR | EXT_REQ_EN |
+   MISC_LINK_STABILITY_PRD(3);
writeq(val64, &bar0->misc_control);
val64 = readq(&bar0->pic_control2);
val64 &= ~(BIT(13)|BIT(14)|BIT(15));
@@ -1879,41 +1880,36 @@ static void en_dis_able_nic_intrs(struct
}
 }
 
-static int check_prc_pcc_state(u64 val64, int flag, int rev_id, int herc)
+/**
+ *  verify_pcc_quiescent- Checks for PCC quiescent state
+ *  Return: 1 If PCC is quiescence
+ *  0 If PCC is not quiescence
+ */
+static int verify_pcc_quiescent(nic_t *sp, int flag)
 {
-   int ret = 0;
+   int ret = 0, herc;
+   XENA_dev_config_t __iomem *bar0 = sp->bar0;
+   u64 val64 = readq(&bar0->adapter_status);
+   
+   herc = (sp->device_type == XFRAME_II_DEVICE);
 
if (flag == FALSE) {
-   if ((!herc && (rev_id >= 4)) || herc) {
-   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) &&
-   ((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
-ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
+   if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) {
+   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE)) 
ret = 1;
-   }
-   }else {
-   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) &&
-   ((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
-ADAPTER_STATUS_RC_PRC_QUIESCENT)) {
+   } else {
+   if (!(val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE))
ret = 1;
-   }
}
} else {
-   if ((!herc && (rev_id >= 4)) || herc) {
+   if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) {
if (((val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) ==
-ADAPTER_STATUS_RMAC_PCC_IDLE) &&
-   (!(val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ||
-((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
- ADAPTER_STATUS_RC_PRC_QUIESCENT))) {
+ADAPTER_STATUS_RMAC_PCC_IDLE))
ret = 1;
-   }
} else {
if (((val64 & ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) ==
-ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE) &&
-   (!(val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ||
-((val64 & ADAPTER_STATUS_RC_PRC_QUIESCENT) ==
- ADAPTER_STATUS_RC_PRC_QUIESCENT))) {
+ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE))
ret = 1;
-   }
}
}
 
@@ -1921,9 +1917,6 @@ static int check_prc_pcc_state(u64 val64
 }
 /**
  *  verify_xena_quiescence - Checks whether the H/W is ready
- *  @val64 :  Value read from adapter status register.
- *  @flag : indicates if the adapter enable bit was ever written once
- *  before.
  *  Description: Returns whether the H/W is ready to go or not. Depending
  *  on whether adapter enable bit was written or not the comparison
  *  differs and the calling function passes the input argument flag to
@@ -1932,24 +1925,63 @@ static int check_prc_pcc_state(u64 val64
  *  0 If Xena is not quiescence
  */
 
-static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag)
+static int verify_xena_quiescence(nic_t *sp)
 {
-   int ret = 0, herc;
-   u64 tmp64 = ~((u64) val64);
-   int rev_id = get_xena_rev_id(sp->pdev);
+   int  mode;
+   XENA_dev_config_t __iomem *bar0 = sp->bar0;
+   u64 val64 = re

RE: [PATCH] s2io: add PCI error recovery support

2006-10-27 Thread Ananda Raju
Looking at all scenarios I feel the first patch is OK. Can you add the
watchdog timer fix to first initial patch and resubmit. 

-Original Message-
From: Linas Vepstas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 26, 2006 3:52 PM
To: Ananda Raju
Cc: Wen Xiong; linux-kernel@vger.kernel.org;
[EMAIL PROTECTED]; netdev@vger.kernel.org; Jeff Garzik;
Andrew Morton
Subject: Re: [PATCH] s2io: add PCI error recovery support

Hi.

On Thu, Oct 26, 2006 at 05:56:34AM -0400, Ananda Raju wrote:
> Hi, 
> Can you try attached patch. The attached patch is simple. We set card
> state as down in error_detecct() so that all entry points return error
> and don't proceed further.
> 
> In slot_reset() we do s2io_card_down() will reset adapter. 
> In io_resume() we bringup the driver. 

Simplicity is always better. However, some questions/comments:

> @@ -4175,6 +4186,10 @@ static irqreturn_t s2io_isr(int irq, voi
>   mac_info_t *mac_control;
>   struct config_param *config;
>  
> + if (atomic_read(&sp->card_state) == CARD_DOWN) {
> + return IRQ_NONE;
> + }

I used 

if ((sp->pdev->error_state != pci_channel_io_normal)

here for a reason: the pdev->error_state is set even in an interrupt
context, that is, it gets set even if interrups are disabled, and
so it represents the actual state immediately. By contrast, the
error callbacks do not get called until possibly much later, 
and so sp->card_state = CARD_DOWN might not get set for a while.

If, for any reason, e.g. some obscure corner case, the s2io 
generates zillions of interupts, this could result in a soft-lockup.
I actually saw this in the symbios device driver, which will
regenerate an interrupt until its acknowledged -- and so it 
sat there, spinning. :-(

I was returning IRQ_HANDLED instead of IRQ_NONE, so as to avoid
falling into handle_bad_irq() or report_bad_irq(). I haven't 
seen this happen on s2io, but thought it would still be wise.

If this can't happen, then there's no problem here.

> +/**
> + * s2io_io_slot_reset - called after the pci bus has been reset.
> + * @pdev: Pointer to PCI device
> + *
> + * Restart the card from scratch, as if from a cold-boot.
> + */
> +static pci_ers_result_t s2io_io_slot_reset(struct pci_dev *pdev)
> +{

At this point, the card has just experienced a hardware reset,
(the #RST wire was held low for 250 millisecs, followed by
a settle time of 2 seconds, followed by whatever BIOS thinks
it needed to do, followed by a restore of the pci config space
to what it was after a cold boot. So the card is in a "fresh"
state; in theory its identitcal to a cold boot. So ... 
are you sure you want to "down" at this point? 

> + s2io_card_down(sp);
> + sp->device_close_flag = TRUE;   /* Device is shut down.
*/


One problem I'm having is that the watchdog timer sometimes
pops and tries to reset the card before s2io_card_down()
has a chance to run. I fixed this ... 

==
So -- just for grins, I thought to myself, "Maybe I can make 
s2io be the first adapter ever to fully recover without 
a hard reset of the card."

The idea is simple: 

1) enable MMIO,
2) call s2io_card_down()
3) enable DMA
4) cal s2io_card_up()

I have a patch that does this, but then hit a few more snags.
I haven't yet nailed down all the trouble spots, maybe tommorrow.

--linas


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] s2io: add PCI error recovery support

2006-10-26 Thread Ananda Raju
Hi, 
Can you try attached patch. The attached patch is simple. We set card
state as down in error_detecct() so that all entry points return error
and don't proceed further.

In slot_reset() we do s2io_card_down() will reset adapter. 
In io_resume() we bringup the driver. 

Ananda 

-Original Message-
From: Linas Vepstas [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 25, 2006 1:55 PM
To: Ananda Raju
Cc: Wen Xiong; linux-kernel@vger.kernel.org;
[EMAIL PROTECTED]; netdev@vger.kernel.org; Jeff Garzik;
Andrew Morton
Subject: Re: [PATCH] s2io: add PCI error recovery support

On Wed, Oct 25, 2006 at 10:11:24AM -0500, Linas Vepstas wrote:
> 
> > Also we have to add following if statement in beginning of
s2io_isr().

Done, below,

> > If it is ok to do BAR0 read/write in error_detected() then patch is
OK. 

I re-wrote that section to avoid doing I/O. It seems to work well,
and generates a few less messages in the process.  New, improved patch
below, please ack and send upstream if you like it.

--linas

This patch adds PCI error recovery support to the 
s2io 10-Gigabit ethernet device driver.

Tested, seems to work well.

Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>
Cc: Raghavendra Koushik <[EMAIL PROTECTED]>
Cc: Ananda Raju <[EMAIL PROTECTED]>
Cc: Wen Xiong <[EMAIL PROTECTED]>


 drivers/net/s2io.c |  103
+
 drivers/net/s2io.h |5 ++
 2 files changed, 108 insertions(+)

Index: linux-2.6.19-rc1-git11/drivers/net/s2io.c
===
--- linux-2.6.19-rc1-git11.orig/drivers/net/s2io.c  2006-10-25
14:09:47.0 -0500
+++ linux-2.6.19-rc1-git11/drivers/net/s2io.c   2006-10-25
15:18:25.0 -0500
@@ -434,11 +434,18 @@ static struct pci_device_id s2io_tbl[] _
 
 MODULE_DEVICE_TABLE(pci, s2io_tbl);
 
+static struct pci_error_handlers s2io_err_handler = {
+   .error_detected = s2io_io_error_detected,
+   .slot_reset = s2io_io_slot_reset,
+   .resume = s2io_io_resume,
+};
+
 static struct pci_driver s2io_driver = {
   .name = "S2IO",
   .id_table = s2io_tbl,
   .probe = s2io_init_nic,
   .remove = __devexit_p(s2io_rem_nic),
+  .err_handler = &s2io_err_handler,
 };
 
 /* A simplifier macro used both by init and free shared_mem Fns(). */
@@ -4171,6 +4178,11 @@ static irqreturn_t s2io_isr(int irq, voi
mac_info_t *mac_control;
struct config_param *config;
 
+   if ((sp->pdev->error_state != pci_channel_io_normal) &&
+(sp->pdev->error_state != 0)) {
+   return IRQ_HANDLED;
+   }
+
atomic_inc(&sp->isr_cnt);
mac_control = &sp->mac_control;
config = &sp->config;
@@ -7564,3 +7576,94 @@ static void lro_append_pkt(nic_t *sp, lr
sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++;
return;
 }
+
+/**
+ * s2io_io_error_detected - called when PCI error is detected
+ * @pdev: Pointer to PCI device
+ * @state: The current pci conneection state
+ *
+ * This function is called after a PCI bus error affecting
+ * this device has been detected.
+ */
+static pci_ers_result_t s2io_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state)
+{
+   struct net_device *netdev = pci_get_drvdata(pdev);
+   nic_t *sp = netdev->priv;
+
+   netif_device_detach(netdev);
+
+   if (netif_running(netdev)) {
+   unsigned long flags;
+
+   /* The folowing is an abreviated subset of the
+* steps taken by s2io_card_down(), avoiding
+* steps that touch the card itself.
+*/
+   del_timer_sync(&sp->alarm_timer);
+   atomic_set(&sp->card_state, CARD_DOWN);
+
+   /* Kill tasklet. */
+   tasklet_kill(&sp->task);
+
+   /* Free all Tx buffers */
+   spin_lock_irqsave(&sp->tx_lock, flags);
+   free_tx_buffers(sp);
+   spin_unlock_irqrestore(&sp->tx_lock, flags);
+
+   /* Free all Rx buffers */
+   spin_lock_irqsave(&sp->rx_lock, flags);
+   free_rx_buffers(sp);
+   spin_unlock_irqrestore(&sp->rx_lock, flags);
+   
+   clear_bit(0, &(sp->link_state));
+   sp->device_close_flag = TRUE;   /* Device is shut down.
*/
+   }
+   pci_disable_device(pdev);
+
+   return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * s2io_io_slot_reset - called after the pci bus has been reset.
+ * @pdev: Pointer to PCI device
+ *
+ * Restart the card from scratch, as if from a cold-boot.
+ */
+static pci_ers_result_t s2io_io_slot_reset(struct pci_dev *pdev)
+{
+   struct net_device *netdev = pci_get_drvdata(pdev);
+   nic_t *sp = netdev->priv;
+
+   if (pci_enable_device(pdev)) {
+   

RE: [PATCH] s2io: add PCI error recovery support

2006-10-24 Thread Ananda Raju
Hi, 

s2io_card_down() will do few BAR0 read/write. As per
pci-error-recovery.txt Documentation we are not supposed to do any new
IO in error_detected(). 

Can you try using 

atomic_set(&sp->card_state, CARD_DOWN); 

instead of s2io_card_down().

Also we have to add following if statement in beginning of s2io_isr().

if (atomic_read(&nic->card_state) == CARD_DOWN)
return IRQ_NOTHANDLED.

If it is ok to do BAR0 read/write in error_detected() then patch is OK. 

Ananda 
-Original Message-
From: Linas Vepstas [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 24, 2006 2:55 PM
To: Raghavendra Koushik; Ananda Raju; Wen Xiong
Cc: linux-kernel@vger.kernel.org; [EMAIL PROTECTED];
netdev@vger.kernel.org; Jeff Garzik; Andrew Morton
Subject: [PATCH] s2io: add PCI error recovery support


Koushik, Raju,
Please review, comment, and if you find this acceptable, 
please forward upstream.

--linas

This patch adds PCI error recovery support to the 
s2io 10-Gigabit ethernet device driver.

Tested, seems to work well.

Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>
Cc: Raghavendra Koushik <[EMAIL PROTECTED]>
Cc: Ananda Raju <[EMAIL PROTECTED]>
Cc: Wen Xiong <[EMAIL PROTECTED]>


 drivers/net/s2io.c |   77
+
 drivers/net/s2io.h |5 +++
 2 files changed, 82 insertions(+)

Index: linux-2.6.19-rc1-git11/drivers/net/s2io.c
===
--- linux-2.6.19-rc1-git11.orig/drivers/net/s2io.c  2006-10-20
12:24:17.0 -0500
+++ linux-2.6.19-rc1-git11/drivers/net/s2io.c   2006-10-24
16:19:49.0 -0500
@@ -434,11 +434,18 @@ static struct pci_device_id s2io_tbl[] _
 
 MODULE_DEVICE_TABLE(pci, s2io_tbl);
 
+static struct pci_error_handlers s2io_err_handler = {
+   .error_detected = s2io_io_error_detected,
+   .slot_reset = s2io_io_slot_reset,
+   .resume = s2io_io_resume,
+};
+
 static struct pci_driver s2io_driver = {
   .name = "S2IO",
   .id_table = s2io_tbl,
   .probe = s2io_init_nic,
   .remove = __devexit_p(s2io_rem_nic),
+  .err_handler = &s2io_err_handler,
 };
 
 /* A simplifier macro used both by init and free shared_mem Fns(). */
@@ -7564,3 +7571,73 @@ static void lro_append_pkt(nic_t *sp, lr
sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++;
return;
 }
+
+/**
+ * s2io_io_error_detected - called when PCI error is detected
+ * @pdev: Pointer to PCI device
+ * @state: The current pci conneection state
+ *
+ * This function is called after a PCI bus error affecting
+ * this device has been detected.
+ */
+static pci_ers_result_t s2io_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state)
+{
+   struct net_device *netdev = pci_get_drvdata(pdev);
+   nic_t *sp = netdev->priv;
+
+   netif_device_detach(netdev);
+
+   if (netif_running(netdev)) {
+   /* Reset card */
+   s2io_card_down(sp);
+   sp->device_close_flag = TRUE;   /* Device is shut down.
*/
+   }
+   pci_disable_device(pdev);
+
+   return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * s2io_io_slot_reset - called after the pci bus has been reset.
+ * @pdev: Pointer to PCI device
+ *
+ * Restart the card from scratch, as if from a cold-boot.
+ */
+static pci_ers_result_t s2io_io_slot_reset(struct pci_dev *pdev)
+{
+   struct net_device *netdev = pci_get_drvdata(pdev);
+   nic_t *sp = netdev->priv;
+
+   if (pci_enable_device(pdev)) {
+   printk(KERN_ERR "s2io: Cannot re-enable PCI device after
reset.\n");
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+
+   pci_set_master(pdev);
+   s2io_reset(sp);
+
+   return PCI_ERS_RESULT_RECOVERED;
+}
+
+/**
+ * s2io_io_resume - called when traffic can start flowing again.
+ * @pdev: Pointer to PCI device
+ *
+ * This callback is called when the error recovery driver tells us that
+ * its OK to resume normal operation.
+ */
+static void s2io_io_resume(struct pci_dev *pdev)
+{
+   struct net_device *netdev = pci_get_drvdata(pdev);
+   nic_t *sp = netdev->priv;
+
+   if (netif_running(netdev)) {
+   if (s2io_card_up(sp)) {
+   printk(KERN_ERR "s2io: can't bring device back
up after reset\n");
+   return;
+   }
+   }
+
+   netif_device_attach(netdev);
+   netif_wake_queue(netdev);
+}
Index: linux-2.6.19-rc1-git11/drivers/net/s2io.h
===
--- linux-2.6.19-rc1-git11.orig/drivers/net/s2io.h  2006-10-20
12:24:17.0 -0500
+++ linux-2.6.19-rc1-git11/drivers/net/s2io.h   2006-10-20
12:41:39.0 -0500
@@ -1013,6 +1013,11 @@ static void queue_rx_frame(struct sk_buf
 static void update_L3L4_header(nic_t *sp, lro_t *lro);
 static void lro_append_pkt(nic_t *sp, lro_t *lro, stru

RE: LRO fix needed

2006-09-11 Thread Ananda Raju
Hi 

I was on leave for 3 weeks so couldn't answer to Questions.

Current s2io driver won't use any hardware assistance for LRO. Present
hardware Xframe-I and Xframe-II provides header separation functionality
which can be used for LRO but not in use.  Our next generation hardware
will have more assistance for LRO. 

We aggregate
1. Till skb length reaches close to 64k and send the packet up once
skb->len goes to 64k
2. Once there are not more packets to process in the ring buffers. At
end of ISR we indicate all the LRO packets up the network stack. 

Does the modification to gso_size in LRO packet applied to Linux source
tree? 


On Fri, Sep 01, 2006 at 09:43:47AM +1000, herbert wrote:
> 
> It might be better to set it to the biggest frag you see rather
> than the first.

I've coded it up.

BTW Ananda, what hardware assistance do your chips currently provide
for LRO? What are the timeouts used before it gives up on aggregating
a session?

[NETDRV] s2io: Set gso_size for LRO to TCP stack

Now that the TCP stack uses gso_size to estimate the receive MSS,
it helps to actually set it :)

Unlike the sending side, there is no single MSS that naturally
pops up for LRO.  However, for our purposes the maximal TCP payload
size is the most appropriate for estimating MSS.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>

Cheers,-Original Message-
From: Herbert Xu [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 31, 2006 4:44 PM
To: David Miller
Cc: Ananda Raju; netdev@vger.kernel.org
Subject: Re: LRO fix needed

On Thu, Aug 31, 2006 at 04:42:27PM -0700, David Miller wrote:
> 
> So could you please make the S2io driver LRO path
> set skb_shared_info(skb)->gso_size appropriately?
> Probably the easiest is to use the length of the
> first frag of a multiple frag LRO sequence.

It might be better to set it to the biggest frag you see rather
than the first.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 2/2] s2io driver bug fixes

2006-07-24 Thread Ananda Raju
Hi,
This patch contains some of the bug fixes and enhancements done to
s2io driver. Following are the brief description of changes

1. code cleanup to handle gso modification better
2. Move repeated code in rx path, to a common function 
   s2io_chk_rx_buffers()
3. Bug fix in MSI interrupt 
4. clear statistics when card is down
5. Avoid linked list traversing in lro aggregation.
6. Use pci_dma_sync_single_for_cpu for buffer0 in case of 2/3
   buffer mode.
7. ethtool tso get/set functions to set clear NETIF_F_TSO6
8. Stop LRO aggregation when we receive ECN notification

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr bug_fixes_1/drivers/net/s2io.c bug_fixes_2/drivers/net/s2io.c
--- bug_fixes_1/drivers/net/s2io.c  2006-07-14 09:26:09.0 -0700
+++ bug_fixes_2/drivers/net/s2io.c  2006-07-21 05:22:19.0 -0700
@@ -76,7 +76,7 @@
 #include "s2io.h"
 #include "s2io-regs.h"
 
-#define DRV_VERSION "2.0.14.2"
+#define DRV_VERSION "2.0.15.2"
 
 /* S2io Driver name & version. */
 static char s2io_driver_name[] = "Neterion";
@@ -2383,9 +2383,14 @@ static int fill_rx_buffers(struct s2io_n
skb->data = (void *) (unsigned long)tmp;
skb->tail = (void *) (unsigned long)tmp;
 
-   ((RxD3_t*)rxdp)->Buffer0_ptr =
-   pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN,
+   if (!(((RxD3_t*)rxdp)->Buffer0_ptr))
+   ((RxD3_t*)rxdp)->Buffer0_ptr =
+  pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN,
   PCI_DMA_FROMDEVICE);
+   else
+   pci_dma_sync_single_for_device(nic->pdev,
+   (dma_addr_t) ((RxD3_t*)rxdp)->Buffer0_ptr,
+   BUF0_LEN, PCI_DMA_FROMDEVICE);
rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
if (nic->rxd_mode == RXD_MODE_3B) {
/* Two buffer mode */
@@ -2398,10 +2403,13 @@ static int fill_rx_buffers(struct s2io_n
(nic->pdev, skb->data, dev->mtu + 4,
PCI_DMA_FROMDEVICE);
 
-   /* Buffer-1 will be dummy buffer not used */
-   ((RxD3_t*)rxdp)->Buffer1_ptr =
-   pci_map_single(nic->pdev, ba->ba_1, BUF1_LEN,
-   PCI_DMA_FROMDEVICE);
+   /* Buffer-1 will be dummy buffer. Not used */
+   if (!(((RxD3_t*)rxdp)->Buffer1_ptr)) {
+   ((RxD3_t*)rxdp)->Buffer1_ptr =
+   pci_map_single(nic->pdev, 
+   ba->ba_1, BUF1_LEN,
+   PCI_DMA_FROMDEVICE);
+   }
rxdp->Control_2 |= SET_BUFFER1_SIZE_3(1);
rxdp->Control_2 |= SET_BUFFER2_SIZE_3
(dev->mtu + 4);
@@ -2728,7 +2736,7 @@ static void rx_intr_handler(ring_info_t 
/* If your are next to put index then it's FIFO full condition 
*/
if ((get_block == put_block) &&
(get_info.offset + 1) == put_info.offset) {
-   DBG_PRINT(ERR_DBG, "%s: Ring Full\n",dev->name);
+   DBG_PRINT(INTR_DBG, "%s: Ring Full\n",dev->name);
break;
}
skb = (struct sk_buff *) ((unsigned long)rxdp->Host_Control);
@@ -2748,18 +2756,15 @@ static void rx_intr_handler(ring_info_t 
 HEADER_SNAP_SIZE,
 PCI_DMA_FROMDEVICE);
} else if (nic->rxd_mode == RXD_MODE_3B) {
-   pci_unmap_single(nic->pdev, (dma_addr_t)
+   pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t)
 ((RxD3_t*)rxdp)->Buffer0_ptr,
 BUF0_LEN, PCI_DMA_FROMDEVICE);
pci_unmap_single(nic->pdev, (dma_addr_t)
-((RxD3_t*)rxdp)->Buffer1_ptr,
-BUF1_LEN, PCI_DMA_FROMDEVICE);
-   pci_unmap_single(nic->pdev, (dma_addr_t)
 ((RxD3_t*)rxdp)->Buffer2_ptr,
 dev->mtu + 4,
   

[patch 1/2] s2io driver bug fixes

2006-07-24 Thread Ananda Raju
Hi, 
This patch contains some of the bug fixes and enhancements done to 
s2io driver. Following are the brief description of changes

1. Introduced macro "S2IO_PARM_INT" for declaring integer load parameter
2. UDP_RR test failure, memset txdl after Tx completion 
3. PXE boot may leave adapter in unknown state so do reset in probe.
4. Add Tx completion code in netpoll
5. In s2io_vpd_read() move array vpd_data[] to pointer, saves stack 
memory 
6. Fix bug in ethtool online test

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr netdev/drivers/net/s2io.c bug_fixes_1/drivers/net/s2io.c
--- netdev/drivers/net/s2io.c   2006-07-14 07:58:06.0 -0700
+++ bug_fixes_1/drivers/net/s2io.c  2006-07-14 09:26:09.0 -0700
@@ -370,38 +370,50 @@ static const u64 fix_mac[] = {
END_SIGN
 };
 
+MODULE_AUTHOR("Raghavendra Koushik <[EMAIL PROTECTED]>");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRV_VERSION);
+
+
 /* Module Loadable parameters. */
-static unsigned int tx_fifo_num = 1;
-static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
-{DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
-static unsigned int rx_ring_num = 1;
-static unsigned int rx_ring_sz[MAX_RX_RINGS] =
-{[0 ...(MAX_RX_RINGS - 1)] = SMALL_BLK_CNT};
-static unsigned int rts_frm_len[MAX_RX_RINGS] =
-{[0 ...(MAX_RX_RINGS - 1)] = 0 };
-static unsigned int rx_ring_mode = 1;
-static unsigned int use_continuous_tx_intrs = 1;
-static unsigned int rmac_pause_time = 0x100;
-static unsigned int mc_pause_threshold_q0q3 = 187;
-static unsigned int mc_pause_threshold_q4q7 = 187;
-static unsigned int shared_splits;
-static unsigned int tmac_util_period = 5;
-static unsigned int rmac_util_period = 5;
-static unsigned int bimodal = 0;
-static unsigned int l3l4hdr_size = 128;
-#ifndef CONFIG_S2IO_NAPI
-static unsigned int indicate_max_pkts;
-#endif
+S2IO_PARM_INT(tx_fifo_num, 1);
+S2IO_PARM_INT(rx_ring_num, 1);
+
+
+S2IO_PARM_INT(rx_ring_mode, 1);
+S2IO_PARM_INT(use_continuous_tx_intrs, 1);
+S2IO_PARM_INT(rmac_pause_time, 0x100);
+S2IO_PARM_INT(mc_pause_threshold_q0q3, 187);
+S2IO_PARM_INT(mc_pause_threshold_q4q7, 187);
+S2IO_PARM_INT(shared_splits, 0);
+S2IO_PARM_INT(tmac_util_period, 5);
+S2IO_PARM_INT(rmac_util_period, 5);
+S2IO_PARM_INT(bimodal, 0);
+S2IO_PARM_INT(l3l4hdr_size, 128);
 /* Frequency of Rx desc syncs expressed as power of 2 */
-static unsigned int rxsync_frequency = 3;
+S2IO_PARM_INT(rxsync_frequency, 3);
 /* Interrupt type. Values can be 0(INTA), 1(MSI), 2(MSI_X) */
-static unsigned int intr_type = 0;
+S2IO_PARM_INT(intr_type, 0);
 /* Large receive offload feature */
-static unsigned int lro = 0;
+S2IO_PARM_INT(lro, 0);
 /* Max pkts to be aggregated by LRO at one time. If not specified,
  * aggregation happens until we hit max IP pkt size(64K)
  */
-static unsigned int lro_max_pkts = 0x;
+S2IO_PARM_INT(lro_max_pkts, 0x);
+#ifndef CONFIG_S2IO_NAPI
+S2IO_PARM_INT(indicate_max_pkts, 0);
+#endif
+
+static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
+{DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
+static unsigned int rx_ring_sz[MAX_RX_RINGS] =
+{[0 ...(MAX_RX_RINGS - 1)] = SMALL_BLK_CNT};
+static unsigned int rts_frm_len[MAX_RX_RINGS] =
+{[0 ...(MAX_RX_RINGS - 1)] = 0 };
+
+module_param_array(tx_fifo_len, uint, NULL, 0);
+module_param_array(rx_ring_sz, uint, NULL, 0);
+module_param_array(rts_frm_len, uint, NULL, 0);
 
 /*
  * S2IO device table.
@@ -464,10 +476,9 @@ static int init_shared_mem(struct s2io_n
size += config->tx_cfg[i].fifo_len;
}
if (size > MAX_AVAILABLE_TXDS) {
-   DBG_PRINT(ERR_DBG, "%s: Requested TxDs too high, ",
- __FUNCTION__);
+   DBG_PRINT(ERR_DBG, "s2io: Requested TxDs too high, ");
DBG_PRINT(ERR_DBG, "Requested: %d, max supported: 8192\n", 
size);
-   return FAILURE;
+   return -EINVAL;
}
 
lst_size = (sizeof(TxD_t) * config->max_txds);
@@ -547,6 +558,7 @@ static int init_shared_mem(struct s2io_n
nic->ufo_in_band_v = kmalloc((sizeof(u64) * size), GFP_KERNEL);
if (!nic->ufo_in_band_v)
return -ENOMEM;
+   memset(nic->ufo_in_band_v, 0, size);
 
/* Allocation and initialization of RXDs in Rings */
size = 0;
@@ -1213,7 +1225,7 @@ static int init_nic(struct s2io_nic *nic
break;
}
 
-   /* Enable Tx FIFO partition 0. */
+   /* Enable all configured Tx FIFO partitions */
val64 = readq(&bar0->tx_fifo_partition_0);
val64 |= (TX_FIFO_PARTITION_EN);
writeq(val64, &bar0->tx_fifo_partition_0);
@@ -1650,7 +1662,7 @@ static void en_dis_able_nic_intrs(struct
writeq(temp64, &bar0->general_int_mask);

RE: [1/4] [IPV6]: Remove redundant length check on input

2006-06-30 Thread Ananda Raju
Sure, we will do that. 

-Original Message-
From: Michael Chan [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 5:08 PM
To: Ananda Raju
Cc: David Miller; [EMAIL PROTECTED]; netdev@vger.kernel.org
Subject: RE: [1/4] [IPV6]: Remove redundant length check on input

On Fri, 2006-06-30 at 19:55 -0400, Ananda Raju wrote:
> True, I am referring to "ethtool -K ethX tso off"
> ethtool_op_set_tso() won't clear NETIF_F_TSO6 for ethtool -K ethX tso
> off
> 
Instead of using ethtool_op_set_tso() in your ethtool_ops structure, you
can use a private function to set or clear any new bits such as
NETIF_F_TSO6 or NETIF_F_TSO_ECN.


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [1/4] [IPV6]: Remove redundant length check on input

2006-06-30 Thread Ananda Raju
True, I am referring to "ethtool -K ethX tso off"
ethtool_op_set_tso() won't clear NETIF_F_TSO6 for ethtool -K ethX tso
off

Ananda 
-Original Message-
From: Michael Chan [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 4:53 PM
To: Ananda Raju
Cc: David Miller; [EMAIL PROTECTED]; netdev@vger.kernel.org
Subject: RE: [1/4] [IPV6]: Remove redundant length check on input

On Fri, 2006-06-30 at 19:44 -0400, Ananda Raju wrote:
> Hi, 
> 
> I tested the patch, and TSO over ipv6 is working fine. But TSO disable
> not working for IPv6. 
> 
You need to clear NETIF_F_TSO6 in dev->features to disable ipv6 TSO.


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [1/4] [IPV6]: Remove redundant length check on input

2006-06-30 Thread Ananda Raju
Hi, 

I tested the patch, and TSO over ipv6 is working fine. But TSO disable
not working for IPv6. 

I tried the from tree /pub/scm/linux/kernel/git/davem/net-2.6

Ananda 

-Original Message-
From: David Miller [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 2:20 PM
To: [EMAIL PROTECTED]
Cc: Ananda Raju; netdev@vger.kernel.org
Subject: Re: [1/4] [IPV6]: Remove redundant length check on input

From: Herbert Xu <[EMAIL PROTECTED]>
Date: Fri, 30 Jun 2006 15:42:09 +1000

> I've added GSO for TCPv6 and updated Ananda's patch.  Please note that
> the following patches have only been compile-tested.

I applied this and pushed it to Linus, let's cross our fingers :)

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.17] support for TSO over IPv6

2006-06-29 Thread Ananda Raju
Hi, 
This patch enables TSO over IPv6. Currently Linux network stacks
restricts TSO over IPv6 by clearing of the NETIF_F_TSO bit from
"dev->features". This patch will remove this restriction.

This patch will introduce a new flag NETIF_F_TSO6 which will be used 
to check whether device supports TSO over IPv6. If device support TSO
over IPv6 then we don't clear of NETIF_F_TSO and which will make the 
TCP layer to create TSO packets. Any device supporting TSO over IPv6 
will set NETIF_F_TSO6 flag in "dev->features" along with NETIF_F_TSO.

In case when user disables TSO using ethtool, NETIF_F_TSO will get
cleared from "dev->features". So even if we have NETIF_F_TSO6 we don't
get TSO packets created by TCP layer. 

SKB_GSO_TCPV4 renamed to SKB_GSO_TCP to make it generic GSO packet.
SKB_GSO_UDPV4 renamed to SKB_GSO_UDP as UFO is not a IPv4 feature.
UFO is supported over IPv6 also

The following table shows there is significant improvement in
throughput with normal frames and CPU usage for both normal and jumbo.

--
|  | 1500|  9600 |
|  --|---|
|  | thru CPU|  thru CPU |
--
| TSO OFF  | 2.00   5.5% id  |  5.66   20.0% id   |
--
| TSO ON   | 2.63   78.0 id  |  5.67   39.0% id  |
------

Please review the patch.
Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr netdev.org/drivers/net/s2io.c netdev.ipv6_tso/drivers/net/s2io.c
--- netdev.org/drivers/net/s2io.c   2006-06-27 07:30:36.0 -0700
+++ netdev.ipv6_tso/drivers/net/s2io.c  2006-06-27 07:38:48.0 -0700
@@ -3960,7 +3960,7 @@ static int s2io_xmit(struct sk_buff *skb
txdp->Control_2 = 0;
 #ifdef NETIF_F_TSO
mss = skb_shinfo(skb)->gso_size;
-   if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV4) {
+   if (skb_shinfo(skb)->gso_type == SKB_GSO_TCP) {
txdp->Control_1 |= TXD_TCP_LSO_EN;
txdp->Control_1 |= TXD_TCP_LSO_MSS(mss);
}
@@ -3980,7 +3980,7 @@ static int s2io_xmit(struct sk_buff *skb
}
 
frg_len = skb->len - skb->data_len;
-   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) {
+   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP) {
int ufo_size;
 
ufo_size = skb_shinfo(skb)->gso_size;
@@ -4009,7 +4009,7 @@ static int s2io_xmit(struct sk_buff *skb
txdp->Host_Control = (unsigned long) skb;
txdp->Control_1 |= TXD_BUFFER0_SIZE(frg_len);
 
-   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
+   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP)
txdp->Control_1 |= TXD_UFO_EN;
 
frg_cnt = skb_shinfo(skb)->nr_frags;
@@ -4024,12 +4024,12 @@ static int s2io_xmit(struct sk_buff *skb
(sp->pdev, frag->page, frag->page_offset,
 frag->size, PCI_DMA_TODEVICE);
txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size);
-   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
+   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP)
txdp->Control_1 |= TXD_UFO_EN;
}
txdp->Control_1 |= TXD_GATHER_CODE_LAST;
 
-   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
+   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP)
frg_cnt++; /* as Txd0 was used for inband header */
 
tx_fifo = mac_control->tx_FIFO_start[queue];
@@ -4043,7 +4043,7 @@ static int s2io_xmit(struct sk_buff *skb
if (mss)
val64 |= TX_FIFO_SPECIAL_FUNC;
 #endif
-   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4)
+   if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP)
val64 |= TX_FIFO_SPECIAL_FUNC;
writeq(val64, &tx_fifo->List_Control);
 
@@ -7021,6 +7021,9 @@ s2io_init_nic(struct pci_dev *pdev, cons
 #ifdef NETIF_F_TSO
dev->features |= NETIF_F_TSO;
 #endif
+#ifdef NETIF_F_TSO6
+   dev->features |= NETIF_F_TSO6;
+#endif
if (sp->device_type & XFRAME_II_DEVICE) {
dev->features |= NETIF_F_UFO;
dev->features |= NETIF_F_HW_CSUM;
diff -upNr netdev.org/include/linux/netdevice.h 
netdev.ipv6_tso/include/linux/netdevice.h
--- netdev.org/include/linux/netdevice.h2006-06-27 07:30:36.0 
-0700
+++ netdev.ipv6_tso/include/linux/netdevice.h   2006-06-27 07:38:48.0 
-0700
@@ -313,8 +313,9 @@ struct net_device
 
/* Segmentation offload features */
 #de

[PATCH 2.6.17-rc5] support for TSO over IPv6.

2006-06-05 Thread Ananda Raju
Hi,
Neterion Xframe adapter supports TSO over IPv6 but the linux kernel 
don't support TSO over Ipv6. This patch will allow TCP
Segmentation Offload (TSO) packets to be created over IPv6. 

The following table shows there is significant improvement in
throughput with normal frames and CPU usage for both normal and jumbo.

--
|  | 1500|  9600 |
|  --|---|
|  | thru CPU|  thru CPU |
--
| TSO OFF  | 1.80   2.0% id  |  5.53   1.0% id   |
--
| TSO ON   | 2.61   74.0 id  |  5.52   32.0% id  |
--

Please review the patch.

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr netdev.org/drivers/net/s2io.c netdev.ipv6_tso/drivers/net/s2io.c
--- netdev.org/drivers/net/s2io.c   2006-06-02 07:29:22.0 -0700
+++ netdev.ipv6_tso/drivers/net/s2io.c  2006-06-02 09:37:50.0 -0700
@@ -6211,6 +6211,7 @@ Defaulting to INTA\n");
 #endif
 
dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
+   dev->features |= NETIF_F_IP6_CSUM;
if (sp->high_dma_flag == TRUE)
dev->features |= NETIF_F_HIGHDMA;
 #ifdef NETIF_F_TSO
diff -upNr netdev.org/include/linux/netdevice.h 
netdev.ipv6_tso/include/linux/netdevice.h
--- netdev.org/include/linux/netdevice.h2006-06-02 07:28:21.0 
-0700
+++ netdev.ipv6_tso/include/linux/netdevice.h   2006-06-02 08:30:54.0 
-0700
@@ -310,6 +310,7 @@ struct net_device
 #define NETIF_F_TSO2048/* Can offload TCP/IP segmentation */
 #define NETIF_F_LLTX   4096/* LockLess TX */
 #define NETIF_F_UFO 8192/* Can offload UDP Large Send*/
+#define NETIF_F_IP6_CSUM   16384   /* Can checksum TCP/UDP over IPv6 */
 
struct net_device   *next_sched;
 
diff -upNr netdev.org/net/ipv6/af_inet6.c netdev.ipv6_tso/net/ipv6/af_inet6.c
--- netdev.org/net/ipv6/af_inet6.c  2006-06-02 06:51:57.0 -0700
+++ netdev.ipv6_tso/net/ipv6/af_inet6.c 2006-06-02 09:56:05.0 -0700
@@ -660,8 +660,11 @@ int inet6_sk_rebuild_header(struct sock 
}
 
ip6_dst_store(sk, dst, NULL);
-   sk->sk_route_caps = dst->dev->features &
-   ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
+   if (dst->dev->features & NETIF_F_IP6_CSUM)
+   sk->sk_route_caps = dst->dev->features;
+   else
+   sk->sk_route_caps = dst->dev->features &
+   ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
}
 
return 0;
diff -upNr netdev.org/net/ipv6/inet6_connection_sock.c 
netdev.ipv6_tso/net/ipv6/inet6_connection_sock.c
--- netdev.org/net/ipv6/inet6_connection_sock.c 2006-06-02 06:52:06.0 
-0700
+++ netdev.ipv6_tso/net/ipv6/inet6_connection_sock.c2006-06-02 
09:54:50.0 -0700
@@ -187,8 +187,11 @@ int inet6_csk_xmit(struct sk_buff *skb, 
}
 
ip6_dst_store(sk, dst, NULL);
-   sk->sk_route_caps = dst->dev->features &
-   ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
+   if (dst->dev->features & NETIF_F_IP6_CSUM)
+   sk->sk_route_caps = dst->dev->features;
+   else
+   sk->sk_route_caps = dst->dev->features &
+   ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
}
 
skb->dst = dst_clone(dst);
diff -upNr netdev.org/net/ipv6/ip6_output.c 
netdev.ipv6_tso/net/ipv6/ip6_output.c
--- netdev.org/net/ipv6/ip6_output.c2006-06-02 06:55:31.0 -0700
+++ netdev.ipv6_tso/net/ipv6/ip6_output.c   2006-06-02 08:50:29.0 
-0700
@@ -147,7 +147,8 @@ static int ip6_output2(struct sk_buff *s
 
 int ip6_output(struct sk_buff *skb)
 {
-   if ((skb->len > dst_mtu(skb->dst) && !skb_shinfo(skb)->ufo_size) ||
+   if ((skb->len > dst_mtu(skb->dst) &&
+!(skb_shinfo(skb)->tso_size || skb_shinfo(skb)->ufo_size)) ||
dst_allfrag(skb->dst))
return ip6_fragment(skb, ip6_output2);
else
@@ -229,7 +230,7 @@ int ip6_xmit(struct sock *sk, struct sk_
skb->priority = sk->sk_priority;
 
mtu = dst_mtu(dst);
-   if ((skb->len <= mtu) || ipfragok) {
+   if ((skb->len <= mtu) || ipfragok || skb_shinfo(skb)->tso_size) {
IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
return NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev,
   

RE: [patch 2/5] s2io driver updates

2006-04-24 Thread Ananda Raju
Hi

We will consider moving vpd_data out of stack. We will wait for few more
time for other review comment, and submit one more patch on top of 5th patch
addressing all review comments. 

If there are no further comments please apply the patches 1 to 5 and notify
us. We will submit one more patch which addressing all review comments. 

Thanks 
Ananda 
-Original Message-
From: Francois Romieu [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 22, 2006 2:28 AM
To: Ananda Raju
Cc: [EMAIL PROTECTED]; netdev@vger.kernel.org; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [patch 2/5] s2io driver updates

Ananda Raju <[EMAIL PROTECTED]> :
[...]
> Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
> ---
> diff -upNr perf_fixes/drivers/net/s2io.c
dmesg_param_fixes/drivers/net/s2io.c
> --- perf_fixes/drivers/net/s2io.c 2006-04-13 08:02:56.0 -0700
> +++ dmesg_param_fixes/drivers/net/s2io.c  2006-04-13
09:08:22.0 -0700
[...]
> @@ -4626,6 +4633,45 @@ static int write_eeprom(nic_t * sp, int 
>   return ret;
>  }
>  
> +static void s2io_vpd_read(nic_t *nic)
> +{
> + u8 vpd_data[256],data;

You may consider removing vpd_data from the stack and kmallocing it.

-- 
Ueimor

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [patch 2/5] s2io driver updates

2006-04-24 Thread Ananda Raju
Hi, 

Currently the only way we can differentiate between copper CX4 transponder
adapters from optical transponder adapters is by reading the product name
string in vpd. 

Actually we added the VPD read function for identifying CX4 adapter. While
submitting the patch the CX4 changes went in patch 3 and reading of vpd went
in patch 2. 

Also we have one more product Xframe-E which is a PCIe adapter. This also
has same device ID of Xframe-II PCI-X adapter. As we have multiple product
with same Device_ID and only way to differentiate between them is through
VPD string we are reading VPD string in driver. 

Thanks 
Ananda. 

-Original Message-
From: Stephen Hemminger [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 24, 2006 10:22 AM
To: Francois Romieu
Cc: Ananda Raju; [EMAIL PROTECTED]; netdev@vger.kernel.org;
[EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [patch 2/5] s2io driver updates

On Sat, 22 Apr 2006 11:28:02 +0200
Francois Romieu <[EMAIL PROTECTED]> wrote:

> Ananda Raju <[EMAIL PROTECTED]> :
> [...]
> > Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
> > ---
> > diff -upNr perf_fixes/drivers/net/s2io.c
dmesg_param_fixes/drivers/net/s2io.c
> > --- perf_fixes/drivers/net/s2io.c   2006-04-13 08:02:56.0 -0700
> > +++ dmesg_param_fixes/drivers/net/s2io.c2006-04-13
09:08:22.0 -0700
> [...]
> > @@ -4626,6 +4633,45 @@ static int write_eeprom(nic_t * sp, int 
> > return ret;
> >  }
> >  
> > +static void s2io_vpd_read(nic_t *nic)
> > +{
> > +   u8 vpd_data[256],data;
> 
> You may consider removing vpd_data from the stack and kmallocing it.
> 

Since there lsvpd tool doesn't in user space, why add more kernel code
to do it?  Adding more code to just print prettier console log's is bogus.

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 5/5] s2io driver updates

2006-04-21 Thread Ananda Raju
Hi, 
The following patch contains fix related to init and shutdown of adapter
as per user guide.  The list of changes include

1. shutdown gracefully.
2. Need to mask/unmask interrupts in ISR required fro Xframe-E
3. Tx FIFO should be enabled after WRR calender programming

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr stat_enhancement/drivers/net/s2io.c bug_fixes2/drivers/net/s2io.c
--- stat_enhancement/drivers/net/s2io.c 2006-04-13 09:04:10.0 -0700
+++ bug_fixes2/drivers/net/s2io.c   2006-04-20 03:27:03.0 -0700
@@ -77,7 +77,7 @@
 #include "s2io.h"
 #include "s2io-regs.h"
 
-#define DRV_VERSION "2.0.11.2"
+#define DRV_VERSION "2.0.14.2"
 
 /* S2io Driver name & version. */
 static char s2io_driver_name[] = "Neterion";
@@ -1036,11 +1036,6 @@ static int init_nic(struct s2io_nic *nic
}
}
 
-   /* Enable Tx FIFO partition 0. */
-   val64 = readq(&bar0->tx_fifo_partition_0);
-   val64 |= BIT(0);/* To enable the FIFO partition. */
-   writeq(val64, &bar0->tx_fifo_partition_0);
-
/*
 * Disable 4 PCCs for Xena1, 2 and 3 as per H/W bug
 * SXE-008 TRANSMIT DMA ARBITRATION ISSUE.
@@ -1219,6 +1214,11 @@ static int init_nic(struct s2io_nic *nic
break;
}
 
+   /* Enable Tx FIFO partition 0. */
+   val64 = readq(&bar0->tx_fifo_partition_0);
+   val64 |= (TX_FIFO_PARTITION_EN);
+   writeq(val64, &bar0->tx_fifo_partition_0);
+
/* Filling the Rx round robin registers as per the
 * number of Rings and steering based on QoS.
  */
@@ -2188,7 +2188,7 @@ static void stop_nic(struct s2io_nic *ni
 {
XENA_dev_config_t __iomem *bar0 = nic->bar0;
register u64 val64 = 0;
-   u16 interruptible, i;
+   u16 interruptible;
mac_info_t *mac_control;
struct config_param *config;
 
@@ -2201,12 +2201,10 @@ static void stop_nic(struct s2io_nic *ni
interruptible |= TX_MAC_INTR | RX_MAC_INTR;
en_dis_able_nic_intrs(nic, interruptible, DISABLE_INTRS);
 
-   /*  Disable PRCs */
-   for (i = 0; i < config->rx_ring_num; i++) {
-   val64 = readq(&bar0->prc_ctrl_n[i]);
-   val64 &= ~((u64) PRC_CTRL_RC_ENABLED);
-   writeq(val64, &bar0->prc_ctrl_n[i]);
-   }
+   /* Clearing Adapter_En bit of ADAPTER_CONTROL Register */
+   val64 = readq(&bar0->adapter_control);
+   val64 &= ~(ADAPTER_CNTL_EN);
+   writeq(val64, &bar0->adapter_control);
 }
 
 static int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb)
@@ -2285,7 +2283,7 @@ static int fill_rx_buffers(struct s2io_n
alloc_cnt = mac_control->rings[ring_no].pkt_cnt -
atomic_read(&nic->rx_bufs_left[ring_no]);
 
-block_no1 = mac_control->rings[ring_no].rx_curr_get_info.block_index;
+   block_no1 = mac_control->rings[ring_no].rx_curr_get_info.block_index;
off1 = mac_control->rings[ring_no].rx_curr_get_info.offset;
while (alloc_tab < alloc_cnt) {
block_no = mac_control->rings[ring_no].rx_curr_put_info.
@@ -4232,7 +4230,7 @@ static irqreturn_t s2io_isr(int irq, voi
nic_t *sp = dev->priv;
XENA_dev_config_t __iomem *bar0 = sp->bar0;
int i;
-   u64 reason = 0, val64;
+   u64 reason = 0, val64, org_mask;
mac_info_t *mac_control;
struct config_param *config;
 
@@ -4257,6 +4255,10 @@ static irqreturn_t s2io_isr(int irq, voi
}
 
val64 = 0xULL;
+   /* Store current mask before masking all interrupts */
+   org_mask = readq(&bar0->general_int_mask);
+   writeq(val64, &bar0->general_int_mask);
+
 #ifdef CONFIG_S2IO_NAPI
if (reason & GEN_INTR_RXTRAFFIC) {
if (netif_rx_schedule_prep(dev)) {
@@ -4312,6 +4314,7 @@ static irqreturn_t s2io_isr(int irq, voi
DBG_PRINT(ERR_DBG, " in ISR!!\n");
clear_bit(0, (&sp->tasklet_status));
atomic_dec(&sp->isr_cnt);
+   writeq(org_mask, 
&bar0->general_int_mask);
return IRQ_HANDLED;
}
clear_bit(0, (&sp->tasklet_status));
@@ -4327,7 +4330,7 @@ static irqreturn_t s2io_isr(int irq, voi
}
}
 #endif
-
+   writeq(org_mask, &bar0->general_int_mask);
atomic_dec(&sp->isr_cnt);
return IRQ_HANDLED;
 }
@@ -6011,6 +6014,165 @@ static void s2io_set_link(unsigned long 
clear_bit(0, &(nic->link_state));
 }
 
+static int set_rxd_buffer_pointe

[patch 4/5] s2io driver updates

2006-04-21 Thread Ananda Raju
Hi, 
This patch contains additional statistics counters added to s2io driver
these statistics are very much usefull in debugging the driver. 

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr bug_fixes1/drivers/net/s2io-regs.h 
stat_enhancement/drivers/net/s2io-regs.h
--- bug_fixes1/drivers/net/s2io-regs.h  2006-04-13 06:51:23.0 -0700
+++ stat_enhancement/drivers/net/s2io-regs.h2006-04-13 08:16:52.0 
-0700
@@ -167,6 +167,7 @@ typedef struct _XENA_dev_config {
u8 unused4[0x08];
 
u64 gpio_int_reg;
+#define GPIO_INT_REG_DP_ERR_INTBIT(0)
 #define GPIO_INT_REG_LINK_DOWN BIT(1)
 #define GPIO_INT_REG_LINK_UP   BIT(2)
u64 gpio_int_mask;
@@ -267,6 +268,21 @@ typedef struct _XENA_dev_config {
 
/* General Configuration */
u64 mdio_control;
+#define MDIO_MMD_INDX_ADDR(val)vBIT(val, 0, 16)
+#define MDIO_MMD_DEV_ADDR(val) vBIT(val, 19, 5)
+#define MDIO_MMD_PMA_DEV_ADDR  0x1
+#define MDIO_MMD_PMD_DEV_ADDR  0x1
+#define MDIO_MMD_WIS_DEV_ADDR  0x2
+#define MDIO_MMD_PCS_DEV_ADDR  0x3
+#define MDIO_MMD_PHYXS_DEV_ADDR0x4
+#define MDIO_MMS_PRT_ADDR(val) vBIT(val, 27, 5)
+#define MDIO_CTRL_START_TRANS(val) vBIT(val, 56, 4)
+#define MDIO_OP(val)   vBIT(val, 60, 2)
+#define MDIO_OP_ADDR_TRANS 0x0
+#define MDIO_OP_WRITE_TRANS0x1
+#define MDIO_OP_READ_POST_INC_TRANS0x2
+#define MDIO_OP_READ_TRANS 0x3
+#define MDIO_MDIO_DATA(val)vBIT(val, 32, 16)
 
u64 dtx_control;
 
@@ -546,7 +562,12 @@ typedef struct _XENA_dev_config {
 #define RX_PA_CFG_IGNORE_LLC_CTRL  BIT(3)
 #define RX_PA_CFG_IGNORE_L2_ERRBIT(6)
 
-   u8 unused12[0x700 - 0x1D8];
+   u64 unused_11_1;
+
+   u64 ring_bump_counter1;
+   u64 ring_bump_counter2;
+
+   u8 unused12[0x700 - 0x1F0];
 
u64 rxdma_debug_ctrl;
 
diff -upNr bug_fixes1/drivers/net/s2io.c stat_enhancement/drivers/net/s2io.c
--- bug_fixes1/drivers/net/s2io.c   2006-04-13 09:03:47.0 -0700
+++ stat_enhancement/drivers/net/s2io.c 2006-04-13 09:04:10.0 -0700
@@ -139,7 +139,11 @@ static char ethtool_stats_keys[][ETH_GST
{"tmac_mcst_frms"},
{"tmac_bcst_frms"},
{"tmac_pause_ctrl_frms"},
+   {"tmac_ttl_octets"},
+   {"tmac_ucst_frms"},
+   {"tmac_nucst_frms"},
{"tmac_any_err_frms"},
+   {"tmac_ttl_less_fb_octets"},
{"tmac_vld_ip_octets"},
{"tmac_vld_ip"},
{"tmac_drop_ip"},
@@ -154,13 +158,27 @@ static char ethtool_stats_keys[][ETH_GST
{"rmac_vld_mcst_frms"},
{"rmac_vld_bcst_frms"},
{"rmac_in_rng_len_err_frms"},
+   {"rmac_out_rng_len_err_frms"},
{"rmac_long_frms"},
{"rmac_pause_ctrl_frms"},
+   {"rmac_unsup_ctrl_frms"},
+   {"rmac_ttl_octets"},
+   {"rmac_accepted_ucst_frms"},
+   {"rmac_accepted_nucst_frms"},
{"rmac_discarded_frms"},
+   {"rmac_drop_events"},
+   {"rmac_ttl_less_fb_octets"},
+   {"rmac_ttl_frms"},
{"rmac_usized_frms"},
{"rmac_osized_frms"},
{"rmac_frag_frms"},
{"rmac_jabber_frms"},
+   {"rmac_ttl_64_frms"},
+   {"rmac_ttl_65_127_frms"},
+   {"rmac_ttl_128_255_frms"},
+   {"rmac_ttl_256_511_frms"},
+   {"rmac_ttl_512_1023_frms"},
+   {"rmac_ttl_1024_1518_frms"},
{"rmac_ip"},
{"rmac_ip_octets"},
{"rmac_hdr_err_ip"},
@@ -169,12 +187,82 @@ static char ethtool_stats_keys[][ETH_GST
{"rmac_tcp"},
{"rmac_udp"},
{"rmac_err_drp_udp"},
+   {"rmac_xgmii_err_sym"},
+   {"rmac_frms_q0"},
+   {"rmac_frms_q1"},
+   {"rmac_frms_q2"},
+   {"rmac_frms_q3"},
+   {"rmac_frms_q4"},
+   {"rmac_frms_q5"},
+   {"rmac_frms_q6"},
+   {"rmac_frms_q7"},
+   {"rmac_full_q0"},
+   {"rmac_full_q1"},
+   {"rmac_full_q2"},
+   {"rmac_full_q3"},
+   {"rmac_full_q4"},
+   {"rmac_full_q5"},
+   {"rmac_full_q6"},
+   {"rmac_full_q7"},
{"rmac_pause_cnt"},
+   {"rmac_xgmii_data_err_cnt"},
+   {"rmac_xgmii_ctrl_err_cnt"},
{"rmac_accepted_ip"},
{"rmac_err_tcp"},
+   {"

[patch 3/5] s2io driver updates

2006-04-21 Thread Ananda Raju
Hi, 
This patch contains some of the bug fixes done for S2io driver.
Following are the brief description of changes

1. Continuing with initialization if we get minimum required MSI-X 
vectors
2. fix for ethtool online link test fails
3. make wait_for_cmd_complete generic for all command status registers
4. Print "Device is on PCI-E bus" for Xframe-E card
5. CX4 requires additional delay after sw_reset, and requires higher 
value for igp
6. Fixed panic due to non-TCP and/or LLC/SNAP traffic in case of lro
7. remove legacy code for old transponder
8. SPECIAL_REG_WRITE made to use 32-bit writes irrespective of system 
type
9. handle link interrupt as per user guide for Xframe II
10. Wait till all interrupts hndled

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr dmesg_param_fixes/drivers/net/s2io.c bug_fixes1/drivers/net/s2io.c
--- dmesg_param_fixes/drivers/net/s2io.c2006-04-13 09:08:22.0 
-0700
+++ bug_fixes1/drivers/net/s2io.c   2006-04-13 09:03:47.0 -0700
@@ -223,9 +223,7 @@ static void s2io_vlan_rx_kill_vid(struct
  * the XAUI.
  */
 
-#define SWITCH_SIGN0xA5A5A5A5A5A5A5A5ULL
 #defineEND_SIGN0x0
-
 static const u64 herc_act_dtx_cfg[] = {
/* Set address */
0x85153675ULL, 0x8515367500E0ULL,
@@ -247,37 +245,19 @@ static const u64 herc_act_dtx_cfg[] = {
END_SIGN
 };
 
-static const u64 xena_mdio_cfg[] = {
-   /* Reset PMA PLL */
-   0xC0010100ULL, 0xC00101E0ULL,
-   0xC001018000E4ULL,
-   /* Remove Reset from PMA PLL */
-   0xC0010100ULL, 0xC00101E0ULL,
-   0xC00101E4ULL,
-   END_SIGN
-};
-
 static const u64 xena_dtx_cfg[] = {
+   /* Set address */
0x8515ULL, 0x851500E0ULL,
-   0x8515D93500E4ULL, 0x80010515ULL,
-   0x8001051500E0ULL, 0x80010515001E00E4ULL,
-   0x80020515ULL, 0x8002051500E0ULL,
-   0x80020515F21000E4ULL,
-   /* Set PADLOOPBACKN */
-   0x80020515ULL, 0x8002051500E0ULL,
-   0x80020515B2E4ULL, 0x80030515ULL,
-   0x8003051500E0ULL, 0x80030515B2E4ULL,
-   0x80040515ULL, 0x8004051500E0ULL,
-   0x80040515B2E4ULL, 0x80050515ULL,
-   0x8005051500E0ULL, 0x80050515B2E4ULL,
-   SWITCH_SIGN,
-   /* Remove PADLOOPBACKN */
+   /* Write data */
+   0x8515D9350004ULL, 0x8515D93500E4ULL,
+   /* Set address */
+   0x80010515ULL, 0x8001051500E0ULL,
+   /* Write data */
+   0x80010515001E0004ULL, 0x80010515001E00E4ULL,
+   /* Set address */
0x80020515ULL, 0x8002051500E0ULL,
-   0x80020515F2E4ULL, 0x80030515ULL,
-   0x8003051500E0ULL, 0x80030515F2E4ULL,
-   0x80040515ULL, 0x8004051500E0ULL,
-   0x80040515F2E4ULL, 0x80050515ULL,
-   0x8005051500E0ULL, 0x80050515F2E4ULL,
+   /* Write data */
+   0x80020515F214ULL, 0x80020515F21000E4ULL,
END_SIGN
 };
 
@@ -552,11 +532,6 @@ static int init_shared_mem(struct s2io_n
rx_blocks->block_dma_addr +
(rxd_size[nic->rxd_mode] * l);
}
-
-   mac_control->rings[i].rx_blocks[j].block_virt_addr =
-   tmp_v_addr;
-   mac_control->rings[i].rx_blocks[j].block_dma_addr =
-   tmp_p_addr;
}
/* Interlinking all Rx Blocks */
for (j = 0; j < blk_cnt; j++) {
@@ -775,7 +750,21 @@ static int s2io_verify_pci_mode(nic_t *n
return mode;
 }
 
+#define NEC_VENID   0x1033
+#define NEC_DEVID   0x0125
+static int s2io_on_nec_bridge(struct pci_dev *s2io_pdev)
+{
+   struct pci_dev *tdev = NULL;
+   while ((tdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, tdev)) != NULL) {
+   if ((tdev->vendor == NEC_VENID) && (tdev->device == NEC_DEVID)){
+   if (tdev->bus == s2io_pdev->bus->parent)
+   return 1;
+   }
+   }
+   return 0;
+}
 
+int bus_speed[8] = {33, 133, 133, 200, 266, 133, 200, 266};
 /**
  * s2io_print_pci_mode -
  */
@@ -792,6 +781,14 @@ static int s2io_print_pci_mode(nic_t *ni
if ( val64 & PCI_MODE_UNKNOWN_MODE)
return -1;  /* Unknown PCI mode */
 
+   config->bus_speed = bus_speed[mode];
+
+   if (s2io_on_nec_bridge(nic->pdev)) {
+   DBG_PRINT(ERR_DBG, "%s: Device is on PCI-E bus\n",
+   nic->dev->name);
+   return mode;
+   }
+
if (val64 & PCI_MODE_32_B

[patch 2/5] s2io driver updates

2006-04-21 Thread Ananda Raju
hi, 
This patch contains the modification and bug fixes with respect to 
input parameters and outupt dmesages. following is brief description 
of the changes.

1. Set default values for rx_ring_sz[0..7] and tx_fifo_len[0..7]
2. verify few basic load parameters
3. read product description from VPD
4. clean up of dmesg  when driver is loaded

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr perf_fixes/drivers/net/s2io.c dmesg_param_fixes/drivers/net/s2io.c
--- perf_fixes/drivers/net/s2io.c   2006-04-13 08:02:56.0 -0700
+++ dmesg_param_fixes/drivers/net/s2io.c2006-04-13 09:08:22.0 
-0700
@@ -26,15 +26,22 @@
  *
  * The module loadable parameters that are supported by the driver and a brief
  * explaination of all the variables.
+ *
  * rx_ring_num : This can be used to program the number of receive rings used
  * in the driver.
- * rx_ring_sz: This defines the number of descriptors each ring can have. This
- * is also an array of size 8.
+ * rx_ring_sz: This defines the number of receive blocks each ring can have.
+ * This is also an array of size 8.
  * rx_ring_mode: This defines the operation mode of all 8 rings. The valid
  * values are 1, 2 and 3.
  * tx_fifo_num: This defines the number of Tx FIFOs thats used int the driver.
  * tx_fifo_len: This too is an array of 8. Each element defines the number of
  * Tx descriptors that can be associated with each corresponding FIFO.
+ * intr_type: This defines the type of interrupt. The values can be 0(INTA),
+ * 1(MSI), 2(MSI_X). Default value is '0(INTA)'
+ * lro: Specifies whether to enable Large Receive Offload (LRO) or not.
+ * Possible values '1' for enable '0' for disable. Default is '0'
+ * lro_max_pkts: This parameter defines maximum number of packets can be
+ * aggregated as a single large packet
  /
 
 #include 
@@ -299,10 +306,10 @@ static const u64 fix_mac[] = {
 /* Module Loadable parameters. */
 static unsigned int tx_fifo_num = 1;
 static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
-{[0 ...(MAX_TX_FIFOS - 1)] = 0 };
+{DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
 static unsigned int rx_ring_num = 1;
 static unsigned int rx_ring_sz[MAX_RX_RINGS] =
-{[0 ...(MAX_RX_RINGS - 1)] = 0 };
+{[0 ...(MAX_RX_RINGS - 1)] = SMALL_BLK_CNT};
 static unsigned int rts_frm_len[MAX_RX_RINGS] =
 {[0 ...(MAX_RX_RINGS - 1)] = 0 };
 static unsigned int rx_ring_mode = 1;
@@ -4626,6 +4633,45 @@ static int write_eeprom(nic_t * sp, int 
return ret;
 }
 
+static void s2io_vpd_read(nic_t *nic)
+{
+   u8 vpd_data[256],data;
+   int i=0, cnt, fail = 0;
+   int vpd_addr = 0x80;
+
+   if (nic->device_type == XFRAME_II_DEVICE) {
+   strcpy(nic->product_name, "Xframe II 10GbE network adapter");
+   vpd_addr = 0x80;
+   }
+   else {
+   strcpy(nic->product_name, "Xframe I 10GbE network adapter");
+   vpd_addr = 0x50;
+   }
+
+   for (i = 0; i < 256; i +=4 ) {
+   pci_write_config_byte(nic->pdev, (vpd_addr + 2), i);
+   pci_read_config_byte(nic->pdev,  (vpd_addr + 2), &data);
+   pci_write_config_byte(nic->pdev, (vpd_addr + 3), 0);
+   for (cnt = 0; cnt <5; cnt++) {
+   msleep(2);
+   pci_read_config_byte(nic->pdev, (vpd_addr + 3), &data);
+   if (data == 0x80)
+   break;
+   }
+   if (cnt >= 5) {
+   DBG_PRINT(ERR_DBG, "Read of VPD data failed\n");
+   fail = 1;
+   break;
+   }
+   pci_read_config_dword(nic->pdev,  (vpd_addr + 4),
+ (u32 *)&vpd_data[i]);
+   }
+   if ((!fail) && (vpd_data[1] < VPD_PRODUCT_NAME_LEN)) {
+   memset(nic->product_name, 0, vpd_data[1]);
+   memcpy(nic->product_name, &vpd_data[3], vpd_data[1]);
+   }
+}
+
 /**
  *  s2io_ethtool_geeprom  - reads the value stored in the Eeprom.
  *  @sp : private member of the device structure, which is a pointer to the *  
 s2io_nic structure.
@@ -5962,6 +6008,55 @@ module_param(intr_type, int, 0);
 module_param(lro, int, 0);
 module_param(lro_max_pkts, int, 0);
 
+static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
+{
+   if ( tx_fifo_num > 8) {
+   DBG_PRINT(ERR_DBG, "s2io: Requested number of Tx fifos not "
+"supported\n");
+   DBG_PRINT(ERR_DBG, "s2io: Default to 8 Tx fifos\n");
+   tx_fifo_num = 8;
+   }
+   if ( rx_ring_num

[patch 1/5] s2io driver updates

2006-04-21 Thread Ananda Raju
hi,
This patch contains all the changes that were done to improve 
performance of s2io driver. one line  description of the changes 
are 

1. For Non NAPI case the rx interrupt handler is being called 
   unconditionally
2. code optimization and adding prefetch skb->data
3. Remove modulo operations in fast path
4. Enable Group Reads and set backoff interval to 0x1000
5. correct PIC_CNTL_SHARED_SPLITS  macro definition, and reduce 
   pause parameter
6. Corrected logic of identifying rx buffer level in rx_buffer_level()
7. fix DMA map and unmap done with different sizes in 1-buf mode
8. Removed forcible disabling of ERO
9. Send up the packets with transfer code = 0x5

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr netdev/drivers/net/s2io-regs.h perf_fixes/drivers/net/s2io-regs.h
--- netdev/drivers/net/s2io-regs.h  2006-04-13 06:47:17.0 -0700
+++ perf_fixes/drivers/net/s2io-regs.h  2006-04-13 06:48:16.0 -0700
@@ -187,7 +187,7 @@ typedef struct _XENA_dev_config {
 /* PIC Control registers */
u64 pic_control;
 #define PIC_CNTL_RX_ALARM_MAP_1BIT(0)
-#define PIC_CNTL_SHARED_SPLITS(n)  vBIT(n,11,4)
+#define PIC_CNTL_SHARED_SPLITS(n)  vBIT(n,11,5)
 
u64 swapper_ctrl;
 #define SWAPPER_CTRL_PIF_R_FE  BIT(0)
@@ -284,9 +284,13 @@ typedef struct _XENA_dev_config {
u64 gpio_control;
 #define GPIO_CTRL_GPIO_0   BIT(8)
u64 misc_control;
+#define EXT_REQ_EN BIT(1)
 #define MISC_LINK_STABILITY_PRD(val)   vBIT(val,29,3)
 
-   u8 unused7_1[0x240 - 0x208];
+   u8 unused7_1[0x230 - 0x208];
+
+   u64 pic_control2;
+   u64 ini_dperr_ctrl;
 
u64 wreq_split_mask;
 #defineWREQ_SPLIT_MASK_SET_MASK(val)   vBIT(val, 52, 12)
@@ -493,6 +497,7 @@ typedef struct _XENA_dev_config {
 #define PRC_CTRL_NO_SNOOP_DESC BIT(22)
 #define PRC_CTRL_NO_SNOOP_BUFF BIT(23)
 #define PRC_CTRL_BIMODAL_INTERRUPT BIT(37)
+#define PRC_CTRL_GROUP_READS   BIT(38)
 #define PRC_CTRL_RXD_BACKOFF_INTERVAL(val) vBIT(val,40,24)
 
u64 prc_alarm_action;
diff -upNr netdev/drivers/net/s2io.c perf_fixes/drivers/net/s2io.c
--- netdev/drivers/net/s2io.c   2006-04-13 06:47:17.0 -0700
+++ perf_fixes/drivers/net/s2io.c   2006-04-13 08:02:56.0 -0700
@@ -106,18 +106,14 @@ static inline int RXD_IS_UP2DT(RxD_t *rx
 #define LOW2
 static inline int rx_buffer_level(nic_t * sp, int rxb_size, int ring)
 {
-   int level = 0;
mac_info_t *mac_control;
 
mac_control = &sp->mac_control;
-   if ((mac_control->rings[ring].pkt_cnt - rxb_size) > 16) {
-   level = LOW;
-   if (rxb_size <= rxd_count[sp->rxd_mode]) {
-   level = PANIC;
-   }
-   }
-
-   return level;
+   if (rxb_size <= rxd_count[sp->rxd_mode])
+   return PANIC;
+   else if ((mac_control->rings[ring].pkt_cnt - rxb_size) > 16)
+   return  LOW;
+   return 0;
 }
 
 /* Ethtool related variables and Macros. */
@@ -311,7 +307,7 @@ static unsigned int rts_frm_len[MAX_RX_R
 {[0 ...(MAX_RX_RINGS - 1)] = 0 };
 static unsigned int rx_ring_mode = 1;
 static unsigned int use_continuous_tx_intrs = 1;
-static unsigned int rmac_pause_time = 65535;
+static unsigned int rmac_pause_time = 0x100;
 static unsigned int mc_pause_threshold_q0q3 = 187;
 static unsigned int mc_pause_threshold_q4q7 = 187;
 static unsigned int shared_splits;
@@ -1545,13 +1541,22 @@ static int init_nic(struct s2io_nic *nic
val64 |= PIC_CNTL_SHARED_SPLITS(shared_splits);
writeq(val64, &bar0->pic_control);
 
+   if (nic->config.bus_speed == 266) {
+   writeq(TXREQTO_VAL(0x7f) | TXREQTO_EN, &bar0->txreqtimeout);
+   writeq(0x0, &bar0->read_retry_delay);
+   writeq(0x0, &bar0->write_retry_delay);
+   }
+
/*
 * Programming the Herc to split every write transaction
 * that does not start on an ADB to reduce disconnects.
 */
if (nic->device_type == XFRAME_II_DEVICE) {
-   val64 = WREQ_SPLIT_MASK_SET_MASK(255);
-   writeq(val64, &bar0->wreq_split_mask);
+   val64 = EXT_REQ_EN | MISC_LINK_STABILITY_PRD(3);
+   writeq(val64, &bar0->misc_control);
+   val64 = readq(&bar0->pic_control2);
+   val64 &= ~(BIT(13)|BIT(14)|BIT(15));
+   writeq(val64, &bar0->pic_control2);
}
 
/* Setting Link stability period to 64 ms */ 
@@ -1948,6 +1953,10 @@ static int start_nic(struct s2io_nic *ni
val64 |= PRC_CTRL_RC_ENABLED;
else
   

[ethtool] UFO patch

2006-03-14 Thread Ananda Raju
Hi,

Kernel version 2.6.15 onwards provides UDP Fragmentation Offload (UFO)
This patch to ethtool provides UFO (UDP Fragmentation Offload) on/off support 
using -K option similar to feature TSO.

To find out whether UFO is enabled or not use 
#ethtool -k eth3
Offload parameters for eth3:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp segmentation offload: on
udp fragmentation offload: on
#

To turn off UFO use following command.
#ethtool -K eth3 ufo off

To turn off UFO use following command.
#ethtool -K eth3 ufo on


Please review the patch.

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -uNr ethtool/ethtool-copy.h ethtool_ufo/ethtool-copy.h
--- ethtool/ethtool-copy.h  2006-03-14 02:33:38.0 -0800
+++ ethtool_ufo/ethtool-copy.h  2006-03-14 02:24:13.0 -0800
@@ -283,6 +283,8 @@
 #define ETHTOOL_GSTATS 0x001d /* get NIC-specific statistics */
 #define ETHTOOL_GTSO   0x001e /* Get TSO enable (ethtool_value) */
 #define ETHTOOL_STSO   0x001f /* Set TSO enable (ethtool_value) */
+#define ETHTOOL_GUFO   0x0021 /* Get UFO enable (ethtool_value) */
+#define ETHTOOL_SUFO   0x0022 /* Set UFO enable (ethtool_value) */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET ETHTOOL_GSET
diff -uNr ethtool/ethtool.8 ethtool_ufo/ethtool.8
--- ethtool/ethtool.8   2006-03-14 02:33:38.0 -0800
+++ ethtool_ufo/ethtool.8   2006-03-14 02:34:54.0 -0800
@@ -153,6 +153,7 @@
 .B2 tx on off
 .B2 sg on off
 .B2 tso on off
+.B2 ufo on off
 
 .B ethtool \-p|\-\-blink
 .I ethX
@@ -272,6 +273,9 @@
 .A2 tso on off
 Specify if tcp segmentation offload is enabled.
 .TP
+.A2 ufo on off
+Specify if UDP fragmentation offload is enabled 
+.TP
 .B \-p \-\-identify
 initiates adapter-specific action intended to enable an operator to
 easily identify the adapter by sight.  Typically this involves
diff -uNr ethtool/ethtool.c ethtool_ufo/ethtool.c
--- ethtool/ethtool.c   2006-03-14 02:33:38.0 -0800
+++ ethtool_ufo/ethtool.c   2006-03-14 02:24:07.0 -0800
@@ -144,7 +144,8 @@
"   [ rx on|off ]\n"
"   [ tx on|off ]\n"
"   [ sg on|off ]\n"
-   "   [ tso on|off ]\n" },
+   "   [ tso on|off ]\n"
+   "   [ ufo on|off ]\n" },
 { "-i", "--driver", MODE_GDRV, "Show driver information" }, 
 { "-d", "--register-dump", MODE_GREGS, "Do a register dump" },
 { "-e", "--eeprom-dump", MODE_GEEPROM, "Do a EEPROM dump",
@@ -189,6 +190,7 @@
 static int off_csum_tx_wanted = -1;
 static int off_sg_wanted = -1;
 static int off_tso_wanted = -1;
+static int off_ufo_wanted = -1;
 
 static struct ethtool_pauseparam epause;
 static int gpause_changed = 0;
@@ -292,6 +294,7 @@
{ "tx", CMDL_BOOL, &off_csum_tx_wanted, NULL },
{ "sg", CMDL_BOOL, &off_sg_wanted, NULL },
{ "tso", CMDL_BOOL, &off_tso_wanted, NULL },
+   { "ufo", CMDL_BOOL, &off_ufo_wanted, NULL },
 };
 
 static struct cmdline_info cmdline_pause[] = {
@@ -1112,17 +1115,19 @@
return 0;
 }
 
-static int dump_offload (int rx, int tx, int sg, int tso)
+static int dump_offload (int rx, int tx, int sg, int tso, int ufo)
 {
fprintf(stdout,
"rx-checksumming: %s\n"
"tx-checksumming: %s\n"
"scatter-gather: %s\n"
-   "tcp segmentation offload: %s\n",
+   "tcp segmentation offload: %s\n"
+   "udp fragmentation offload: %s\n",
rx ? "on" : "off",
tx ? "on" : "off",
sg ? "on" : "off",
-   tso ? "on" : "off");
+   tso ? "on" : "off",
+   ufo ? "on" : "off");
 
return 0;
 }
@@ -1386,7 +1391,7 @@
 static int do_goffload(int fd, struct ifreq *ifr)
 {
struct ethtool_value eval;
-   int err, allfail = 1, rx = 0, tx = 0, sg = 0, tso = 0;
+   int err, allfail = 1, rx = 0, tx = 0, sg = 0, tso = 0, ufo = 0;
 
fprintf(stdout, "Offload parameters for %s:\n", devname);
 
@@ -1430,12 +1435,22 @@
allfail = 0;
}
 
+   eval.cmd = ETHTOOL_GUFO;
+   ifr->ifr_data = (caddr_t)&eval;
+   err = ioctl(fd, SIOCETHTOOL, ifr);
+   if (err)
+   perror("Cannot get device udp large send offload settings");
+   else {
+   ufo = eval.data;
+   allfail = 0;
+   }
+
if (allfail) {
   

[PATCH 2.6.16-rc1] s2io: scatter-gather fix

2006-01-19 Thread Ananda Raju
Hi,
There is a problem with fragmented skb in s2io driver version 2.0.9.4 
available in 2.6.16-rc1 kernel. The adapter will fail to transmit if 
any scatter-gather skb arrives.  This patch provides fix for the above
described problem. 

Please review the patch.

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr org/drivers/net/s2io.c mod/drivers/net/s2io.c
--- org/drivers/net/s2io.c  2006-01-18 06:03:29.0 -0800
+++ mod/drivers/net/s2io.c  2006-01-18 06:04:01.0 -0800
@@ -3586,7 +3586,7 @@ static int s2io_xmit(struct sk_buff *skb
txdp->Buffer_Pointer = (u64) pci_map_page
(sp->pdev, frag->page, frag->page_offset,
 frag->size, PCI_DMA_TODEVICE);
-   txdp->Control_1 |= TXD_BUFFER0_SIZE(frag->size);
+   txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size);
if (skb_shinfo(skb)->ufo_size)
txdp->Control_1 |= TXD_UFO_EN;
}

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [patch 1/1] git-netdev-all: s2io warning fix

2005-12-21 Thread Ananda Raju
Hi 

Is there any was we can get the latest s2io driver changes accepted by
kernel community. I tried to get the latest source using 

#git pull
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

The s2io.c which I got doesn't contain modification to UFO and the s2io
warning fix mentioned in the following mail.

Can any one let us know how we can get the s2io.c file which contain UFO and
"s2io warning fix" patch applied

We are planning for one more patch submission, to avoid any conflicts while
applying to 2.6 kernel we want the latest file 


Thanks
Ananda 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 14, 2005 7:25 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [patch 1/1] git-netdev-all: s2io warning fix


From: Andrew Morton <[EMAIL PROTECTED]>

drivers/net/s2io.c: In function `s2io_txdl_getskb':
drivers/net/s2io.c:2023: warning: cast from pointer to integer of different
size
drivers/net/s2io.c: In function `s2io_open':
drivers/net/s2io.c:3325: warning: long long unsigned int format, u64 arg
(arg 3)
drivers/net/s2io.c:: warning: long long unsigned int format, u64 arg
(arg 3)
drivers/net/s2io.c: In function `s2io_eeprom_test':
drivers/net/s2io.c:4749: warning: long long unsigned int format, long
unsigned int arg (arg 3)
drivers/net/s2io.c:4749: warning: long long unsigned int format, u64 arg
(arg 4)
drivers/net/s2io.c:4768: warning: long long unsigned int format, long
unsigned int arg (arg 3)
drivers/net/s2io.c:4768: warning: long long unsigned int format, u64 arg
(arg 4)

I had to update this patch because more warnings have just appeared.

You cannot print a u64 with %l or %ll.  You do not know what type the
architecture is using.  It must be cast to a type which matches the printf
control string - unsigned long long.

The patch also fixes some overly-long strings.  Please try to keep the code
looking neat in an 80-col window.

Cc: Jeff Garzik <[EMAIL PROTECTED]>
Cc: Ananda Raju <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/net/s2io.c |   16 +++-
 1 files changed, 11 insertions(+), 5 deletions(-)

diff -puN drivers/net/s2io.c~git-netdev-all-s2io-warning-fix
drivers/net/s2io.c
--- 25-alpha/drivers/net/s2io.c~git-netdev-all-s2io-warning-fix 2005-12-14
19:25:05.0 -0800
+++ 25-alpha-akpm/drivers/net/s2io.c2005-12-14 19:25:05.0 -0800
@@ -2020,7 +2020,7 @@ static struct sk_buff *s2io_txdl_getskb(
u16 j, frg_cnt;
 
txds = txdlp;
-   if (txds->Host_Control == (u64) nic->ufo_in_band_v) {
+   if (txds->Host_Control == (u64)(long)nic->ufo_in_band_v) {
pci_unmap_single(nic->pdev, (dma_addr_t)
txds->Buffer_Pointer, sizeof(u64),
PCI_DMA_TODEVICE);
@@ -3323,7 +3323,7 @@ failed\n", dev->name);
  s2io_msix_fifo_handle, 0,
sp->desc1,
  sp->s2io_entries[i].arg);
DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n",
sp->desc1, 
-
sp->msix_info[i].addr);
+   (unsigned long
long)sp->msix_info[i].addr);
} else {
sprintf(sp->desc2, "%s:MSI-X-%d-RX",
dev->name, i);
@@ -3331,7 +3331,7 @@ failed\n", dev->name);
  s2io_msix_ring_handle, 0,
sp->desc2,
  sp->s2io_entries[i].arg);
DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n",
sp->desc2, 
-
sp->msix_info[i].addr);
+(unsigned long
long)sp->msix_info[i].addr);
}
if (err) {
DBG_PRINT(ERR_DBG, "%s: MSI-X-%d
registration \
@@ -4746,7 +4746,10 @@ static int s2io_eeprom_test(nic_t * sp, 
fail = 1;
 
if (ret_data != 0x012345) {
-   DBG_PRINT(ERR_DBG, "%s: eeprom test error at offset 0x4F0.
Data written %llx Data read %llx\n", dev->name, (u64)0x12345, ret_data); 
+   DBG_PRINT(ERR_DBG, "%s: eeprom test error at offset 0x4F0. "
+   "Data written %llx Data read %llx\n",
+   dev->name, (unsigned long long)0x12345,
+   (unsigned long long)ret_data);
fail = 1;
}
 
@@ -4765,7 +4768,10 @@ static int s2io_eeprom_test(nic_t * sp, 
fail = 1;
 
if (ret_data != 0x012345) {
-   DBG_PRINT(ERR_DBG, "%s: eeprom test error at offset 0x7F0.
Data written %llx Data read %llx\n", dev->name, (u64)0x12345, ret_data); 
+   DBG_PRINT(ER

RE: [BULK] Re: [PATCH 2.6.15] s2io: UFO support

2005-12-12 Thread Ananda Raju
Hi Jeff

I don't see the UFO changes to S2io driver in Kernel v2.6.15-rc5.  Can you
please let us know when the changes will be available in main stream

Ananda 
-Original Message-
From: Jeff Garzik [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 18, 2005 10:28 AM
To: Ananda Raju
Cc: netdev@vger.kernel.org; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: [BULK] Re: [PATCH 2.6.15] s2io: UFO support
Importance: Low

applied to 'upstream' branch


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2.6.15] s2io: UFO support

2005-11-14 Thread Ananda Raju
Hi, 

Will send you updated patch which uses __cpu_to_be64().

Here is quick test I did with 60k packet buffer. With UFO we reach upto 5.87
Gbits/sec compared to 3.55Gbits/sec non UFO case

With two threads we can reach upto 7.25 Gbits/sec where as non UFO still
remains at 3.5 Gbits/sec

linux:/home/araju/patch_sub/ufo # /home/tools/iperf-2.0.1/src/iperf -c
17.1.1.220 -u -l60k -w256m -b10g

Client connecting to 17.1.1.220, UDP port 5001
Sending 61440 byte datagrams
UDP buffer size:   228 KByte (WARNING: requested   256 MByte)

[  3] local 17.1.1.221 port 32775 connected with 17.1.1.220 port 5001
[  3]  0.0-10.0 sec  6.83 GBytes  5.87 Gbits/sec
[  3] Sent 119356 datagrams
[  3] WARNING: did not receive ack of last datagram after 10 tries.

linux:/home/araju/patch_sub/ufo # /tmp/ethtool-3/ethtool -K eth3 ufo off

linux:/home/araju/patch_sub/ufo # /home/tools/iperf-2.0.1/src/iperf -c
17.1.1.220 -u -l60k -w256m -b10g

Client connecting to 17.1.1.220, UDP port 5001
Sending 61440 byte datagrams
UDP buffer size:   228 KByte (WARNING: requested   256 MByte)

[  3] local 17.1.1.221 port 32775 connected with 17.1.1.220 port 5001
[  3]  0.0-10.0 sec  4.13 GBytes  3.55 Gbits/sec
[  3] Sent 72181 datagrams
[  3] WARNING: did not receive ack of last datagram after 10 tries.
linux:/home/araju/patch_sub/ufo # ifconfig eth3
eth3  Link encap:Ethernet  HWaddr 00:11:25:7B:00:E2
  inet addr:17.1.1.221  Bcast:17.255.255.255  Mask:255.0.0.0
  inet6 addr: fe80::211:25ff:fe7b:e2/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:17 errors:0 dropped:0 overruns:0 frame:0
  TX packets:34713919 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:3246 (3.1 Kb)  TX bytes:51228028448 (48854.8 Mb)
  Interrupt:201


linux:/home/araju/patch_sub/ufo # /home/tools/iperf-2.0.1/src/iperf -c
17.1.1.220 -u -l60k -w256m -b5g -P2

Client connecting to 17.1.1.220, UDP port 5001
Sending 61440 byte datagrams
UDP buffer size:   228 KByte (WARNING: requested   256 MByte)

[  3] local 17.1.1.221 port 32775 connected with 17.1.1.220 port 5001
[  4] local 17.1.1.221 port 32776 connected with 17.1.1.220 port 5001
write2 failed: Connection refused
[  4]  0.0- 1.0 sec149 MBytes  1.23 Gbits/sec
[  4] Sent 2550 datagrams
[  4] WARNING: did not receive ack of last datagram after 10 tries.
[  3]  0.0-10.0 sec  3.82 GBytes  3.29 Gbits/sec
[  3] Sent 66840 datagrams
[SUM]  0.0-10.0 sec  3.97 GBytes  3.41 Gbits/sec
[  3] WARNING: did not receive ack of last datagram after 10 tries.

linux:/home/araju/patch_sub/ufo # /tmp/ethtool-3/ethtool -K eth3 ufo on

linux:/home/araju/patch_sub/ufo # /home/tools/iperf-2.0.1/src/iperf -c
17.1.1.220 -u -l60k -w256m -b5g -P2

Client connecting to 17.1.1.220, UDP port 5001
Sending 61440 byte datagrams
UDP buffer size:   228 KByte (WARNING: requested   256 MByte)

[  4] local 17.1.1.221 port 32777 connected with 17.1.1.220 port 5001
[  3] local 17.1.1.221 port 32776 connected with 17.1.1.220 port 5001
[  4]  0.0-10.0 sec  4.91 GBytes  4.22 Gbits/sec
[  4] Sent 61308 datagrams
[  3]  0.0-10.0 sec  3.53 GBytes  3.03 Gbits/sec
[  3] Sent 61641 datagrams
[SUM]  0.0-10.0 sec  8.44 GBytes  7.25 Gbits/sec
[  4] WARNING: did not receive ack of last datagram after 10 tries.
[  3] WARNING: did not receive ack of last datagram after 10 tries.
linux:/home/araju/patch_sub/ufo #


-Original Message-
From: Andi Kleen [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 14, 2005 1:57 PM
To: Ananda Raju
Cc: [EMAIL PROTECTED]; netdev@vger.kernel.org; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [PATCH 2.6.15] s2io: UFO support

On Monday 14 November 2005 21:25, Ananda Raju wrote:
> Hi,
> This patch implements the UFO support in S2io driver. This patch uses the
UFO 
> interface available in linux-2.6.15 kernel.

Can you share some numbers on how much difference it makes vs non UFO?


> +#ifdef __BIG_ENDIAN
> + sp->ufo_in_band_v[put_off] =
> + (u64)skb_shinfo(skb)->ip6_frag_id;
> +#else
> + sp->ufo_in_band_v[put_off] =
> + (u64)skb_shinfo(skb)->ip6_frag_id << 32;
> +#endif

With __cpu_to_be64 you could avoid the ifdef.


-Andi

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ethtool-3] UFO patch

2005-11-14 Thread Ananda Raju
Hi,

Kernel version 2.6.15 onwards provides UDP Fragmentation Offload (UFO)
This patch to ethtool provides UFO (UDP Fragmentation Offload) on/off support 
using -K option similar to feature TSO.

To find out whether UFO is enabled or not use 
#ethtool -k eth3
Offload parameters for eth3:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp segmentation offload: on
udp fragmentation offload: on
#

To turn off UFO use following command.
#ethtool -K eth3 ufo off

To turn off UFO use following command.
#ethtool -K eth3 ufo on


Please review the patch.

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -uNr ethtool-3/ethtool-copy.h ethtool-3_ufo/ethtool-copy.h
--- ethtool-3/ethtool-copy.h2005-10-14 08:34:20.0 -0700
+++ ethtool-3_ufo/ethtool-copy.h2005-10-14 08:33:41.0 -0700
@@ -283,6 +283,8 @@
 #define ETHTOOL_GSTATS 0x001d /* get NIC-specific statistics */
 #define ETHTOOL_GTSO   0x001e /* Get TSO enable (ethtool_value) */
 #define ETHTOOL_STSO   0x001f /* Set TSO enable (ethtool_value) */
+#define ETHTOOL_GUFO   0x0021 /* Get UFO enable (ethtool_value) */
+#define ETHTOOL_SUFO   0x0022 /* Set UFO enable (ethtool_value) */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET ETHTOOL_GSET
diff -uNr ethtool-3/ethtool.c ethtool-3_ufo/ethtool.c
--- ethtool-3/ethtool.c 2005-10-14 08:34:15.0 -0700
+++ ethtool-3_ufo/ethtool.c 2005-10-14 08:33:26.0 -0700
@@ -119,6 +119,7 @@
  * [ tx on|off ] \
  * [ sg on|off ] \
  * [ tso on|off ]
+ * [ ufo on|off ]
  * ethtool -r DEVNAME
  * ethtool -p DEVNAME [ %d ]
  * ethtool -t DEVNAME [ online|offline ]
@@ -191,6 +192,7 @@
"   [ tx on|off ] \\\n"
"   [ sg on|off ] \\\n"
"   [ tso on|off ]\n"
+   "   [ ufo on|off ]\n"
"   ethtool -r DEVNAME\n"
"   ethtool -p DEVNAME [ %%d ]\n"
"   ethtool -t DEVNAME [online|(offline)]\n"
@@ -236,6 +238,7 @@
 static int off_csum_tx_wanted = -1;
 static int off_sg_wanted = -1;
 static int off_tso_wanted = -1;
+static int off_ufo_wanted = -1;
 
 static struct ethtool_pauseparam epause;
 static int gpause_changed = 0;
@@ -339,6 +342,7 @@
{ "tx", CMDL_BOOL, &off_csum_tx_wanted, NULL },
{ "sg", CMDL_BOOL, &off_sg_wanted, NULL },
{ "tso", CMDL_BOOL, &off_tso_wanted, NULL },
+   { "ufo", CMDL_BOOL, &off_ufo_wanted, NULL },
 };
 
 static struct cmdline_info cmdline_pause[] = {
@@ -1184,17 +1188,19 @@
return 0;
 }
 
-static int dump_offload (int rx, int tx, int sg, int tso)
+static int dump_offload (int rx, int tx, int sg, int tso, int ufo)
 {
fprintf(stdout,
"rx-checksumming: %s\n"
"tx-checksumming: %s\n"
"scatter-gather: %s\n"
-   "tcp segmentation offload: %s\n",
+   "tcp segmentation offload: %s\n"
+   "udp fragmentation offload: %s\n",
rx ? "on" : "off",
tx ? "on" : "off",
sg ? "on" : "off",
-   tso ? "on" : "off");
+   tso ? "on" : "off",
+   ufo ? "on" : "off");
 
return 0;
 }
@@ -1458,7 +1464,7 @@
 static int do_goffload(int fd, struct ifreq *ifr)
 {
struct ethtool_value eval;
-   int err, allfail = 1, rx = 0, tx = 0, sg = 0, tso = 0;
+   int err, allfail = 1, rx = 0, tx = 0, sg = 0, tso = 0, ufo = 0;
 
fprintf(stdout, "Offload parameters for %s:\n", devname);
 
@@ -1502,12 +1508,22 @@
allfail = 0;
}
 
+   eval.cmd = ETHTOOL_GUFO;
+   ifr->ifr_data = (caddr_t)&eval;
+   err = ioctl(fd, SIOCETHTOOL, ifr);
+   if (err)
+   perror("Cannot get device udp large send offload settings");
+   else {
+   ufo = eval.data;
+   allfail = 0;
+   }
+
if (allfail) {
fprintf(stdout, "no offload info available\n");
return 83;
}
 
-   return dump_offload(rx, tx, sg, tso);
+   return dump_offload(rx, tx, sg, tso, ufo);
 }
 
 static int do_soffload(int fd, struct ifreq *ifr)
@@ -1562,6 +1578,17 @@
return 88;
}
}
+   if (off_ufo_wanted >= 0) {
+   changed = 1;
+   eval.cmd = ETHTOOL_SUFO;
+   eval.data = (off_ufo_wanted == 1);
+   ifr->ifr_data = (caddr_t)&eval;
+ 

[PATCH 2.6.15] s2io: UFO support

2005-11-14 Thread Ananda Raju
Hi,
This patch implements the UFO support in S2io driver. This patch uses the UFO 
interface available in linux-2.6.15 kernel.

Please review the patch.

Signed-off-by: Ananda Raju <[EMAIL PROTECTED]>
---
diff -upNr old/drivers/net/s2io.c new/drivers/net/s2io.c
--- old/drivers/net/s2io.c  2005-11-11 07:26:39.0 -0800
+++ new/drivers/net/s2io.c  2005-11-14 03:27:18.0 -0800
@@ -66,7 +66,7 @@
 #include "s2io.h"
 #include "s2io-regs.h"
 
-#define DRV_VERSION "Version 2.0.9.3"
+#define DRV_VERSION "Version 2.0.9.4"
 
 /* S2io Driver name & version. */
 static char s2io_driver_name[] = "Neterion";
@@ -412,7 +412,7 @@ static int init_shared_mem(struct s2io_n
config->tx_cfg[i].fifo_len - 1;
mac_control->fifos[i].fifo_no = i;
mac_control->fifos[i].nic = nic;
-   mac_control->fifos[i].max_txds = MAX_SKB_FRAGS + 1;
+   mac_control->fifos[i].max_txds = MAX_SKB_FRAGS + 2;
 
for (j = 0; j < page_num; j++) {
int k = 0;
@@ -459,6 +459,10 @@ static int init_shared_mem(struct s2io_n
}
}
 
+   nic->ufo_in_band_v = kmalloc((sizeof(u64) * size), GFP_KERNEL);
+   if (!nic->ufo_in_band_v)
+   return -ENOMEM;
+
/* Allocation and initialization of RXDs in Rings */
size = 0;
for (i = 0; i < config->rx_ring_num; i++) {
@@ -731,6 +735,8 @@ static void free_shared_mem(struct s2io_
mac_control->stats_mem,
mac_control->stats_mem_phy);
}
+   if (nic->ufo_in_band_v)
+   kfree(nic->ufo_in_band_v);
 }
 
 /**
@@ -2003,6 +2009,49 @@ static int start_nic(struct s2io_nic *ni
 
return SUCCESS;
 }
+/**
+ * s2io_txdl_getskb - Get the skb from txdl, unmap and return skb
+ */
+static struct sk_buff *s2io_txdl_getskb(fifo_info_t *fifo_data, TxD_t *txdlp, 
int get_off)
+{
+   nic_t *nic = fifo_data->nic;
+   struct sk_buff *skb;
+   TxD_t *txds;
+   u16 j, frg_cnt;
+
+   txds = txdlp;
+   if (txds->Host_Control == (u64) nic->ufo_in_band_v) {
+   pci_unmap_single(nic->pdev, (dma_addr_t)
+   txds->Buffer_Pointer, sizeof(u64),
+   PCI_DMA_TODEVICE);
+   txds++;
+   }
+
+   skb = (struct sk_buff *) ((unsigned long)
+   txds->Host_Control);
+   if (!skb) {
+   memset(txdlp, 0, (sizeof(TxD_t) * fifo_data->max_txds));
+   return NULL;
+   }
+   pci_unmap_single(nic->pdev, (dma_addr_t)
+txds->Buffer_Pointer,
+skb->len - skb->data_len,
+PCI_DMA_TODEVICE);
+   frg_cnt = skb_shinfo(skb)->nr_frags;
+   if (frg_cnt) {
+   txds++;
+   for (j = 0; j < frg_cnt; j++, txds++) {
+   skb_frag_t *frag = &skb_shinfo(skb)->frags[j];
+   if (!txds->Buffer_Pointer)
+   break;
+   pci_unmap_page(nic->pdev, (dma_addr_t) 
+   txds->Buffer_Pointer,
+  frag->size, PCI_DMA_TODEVICE);
+   }
+   }
+   txdlp->Host_Control = 0;
+   return(skb);
+}
 
 /**
  *  free_tx_buffers - Free all queued Tx buffers
@@ -2020,7 +2069,7 @@ static void free_tx_buffers(struct s2io_
int i, j;
mac_info_t *mac_control;
struct config_param *config;
-   int cnt = 0, frg_cnt;
+   int cnt = 0;
 
mac_control = &nic->mac_control;
config = &nic->config;
@@ -2029,38 +2078,11 @@ static void free_tx_buffers(struct s2io_
for (j = 0; j < config->tx_cfg[i].fifo_len - 1; j++) {
txdp = (TxD_t *) mac_control->fifos[i].list_info[j].
list_virt_addr;
-   skb =
-   (struct sk_buff *) ((unsigned long) txdp->
-   Host_Control);
-   if (skb == NULL) {
-   memset(txdp, 0, sizeof(TxD_t) *
-  config->max_txds);
-   continue;
-   }
-   frg_cnt = skb_shinfo(skb)->nr_frags;
-   pci_unmap_single(nic->pdev, (dma_addr_t)
-txdp->Buffer_Pointer,
-skb->len - skb->data_len,
-PCI_DMA_TODEVICE);
-   if (frg_cnt) {
-   TxD_t *temp;
-