RE: drivers/net/tokenring/3c359.c

2007-08-15 Thread Sivakumar Subramani
What exactly the difference between kzalloc and kcalloc? From the
definition, I could see that kcalloc should be used for array
allocation. But I could see kzalloc is used for allocation arrays as in
the below patch.

Any coding standard (or) developers can use kzalloc and kcalloc as per
their coding practice??

Thanks,
~Siva
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Jeff Garzik
Sent: Tuesday, August 14, 2007 11:20 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED];
Linux Kernel; kernel-janitors
Subject: Re: drivers/net/tokenring/3c359.c

Surya Prabhakar N wrote:
> Hi,
>Replacing kmalloc with kzalloc and cleaning up memset in 
> drivers/net/tokenring/3c359.c
> 
> 
> Signed-off-by: Surya Prabhakar <[EMAIL PROTECTED]>

applied


-
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: 2.6.22: ERROR: "__ucmpdi2" [drivers/net/s2io.ko] undefined!

2007-06-21 Thread Sivakumar Subramani
Hi,

We will include this fix in next set of patch submission. Thanks for the
fix.

Thanks,
~Siva 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Olaf Hering
Sent: Wednesday, June 20, 2007 2:11 AM
To: Stephen Hemminger
Cc: linux-kernel@vger.kernel.org; [EMAIL PROTECTED]
Subject: Re: 2.6.22: ERROR: "__ucmpdi2" [drivers/net/s2io.ko] undefined!

On Tue, Jun 19, Stephen Hemminger wrote:

> On Tue, 19 Jun 2007 21:02:53 +0200
> Olaf Hering <[EMAIL PROTECTED]> wrote:
> 
> > 
> > What happend to __ucmpdi2 from David Woodhouse?
> > google has a few hits about stuff like this on 32bit powerpc with
gcc 4.1.2:
> > 
> > ERROR: "__ucmpdi2" [drivers/net/s2io.ko] undefined!
> > 
> > using the drivers/net/s2io* files from 2.6.21 with 2.6.22-rc5 fixes 
> > the compile.
> > 
> > 25805dcf9d83098cf5492117ad2669cd14cc9b24 adds two u64 >>= 48 
> > followed by a switch statement (line 2889 and 6816).
> 
> Probably the "switch(err) {" needs a cast to a smaller type (like u8).

This change removes the calls to __ucmpdi2.

---
 drivers/net/s2io.c |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2868,6 +2868,7 @@ static void tx_intr_handler(struct fifo_
struct tx_curr_get_info get_info, put_info;
struct sk_buff *skb;
struct TxD *txdlp;
+   u8 err_mask;
 
get_info = fifo_data->tx_curr_get_info;
memcpy(&put_info, &fifo_data->tx_curr_put_info,
sizeof(put_info)); @@ -2886,8 +2887,8 @@ static void
tx_intr_handler(struct fifo_
}
 
/* update t_code statistics */
-   err >>= 48;
-   switch(err) {
+   err_mask = err >> 48;
+   switch(err_mask) {
case 2:
 
nic->mac_control.stats_info->sw_stat.
 
tx_buf_abort_cnt++;
@@ -6805,6 +6806,7 @@ static int rx_osm_handler(struct ring_in
u16 l3_csum, l4_csum;
unsigned long long err = rxdp->Control_1 & RXD_T_CODE;
struct lro *lro;
+   u8 err_mask;
 
skb->dev = dev;
 
@@ -6813,8 +6815,8 @@ static int rx_osm_handler(struct ring_in
if (err & 0x1) {
 
sp->mac_control.stats_info->sw_stat.parity_err_cnt++;
}
-   err >>= 48;
-   switch(err) {
+   err_mask = err >> 48;
+   switch(err_mask) {
case 1:
sp->mac_control.stats_info->sw_stat.
rx_parity_err_cnt++;
@@ -6867,9 +6869,9 @@ static int rx_osm_handler(struct ring_in
* Note that in this case, since checksum will be
incorrect,
* stack will validate the same.
*/
-   if (err != 0x5) {
-   DBG_PRINT(ERR_DBG, "%s: Rx error Value:
0x%llx\n",
-   dev->name, err);
+   if (err_mask != 0x5) {
+   DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n",
+   dev->name, err_mask);
sp->stats.rx_crc_errors++;
sp->mac_control.stats_info->sw_stat.mem_freed 
+= skb->truesize;
-
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 1/2] s2io: add PCI error recovery support

2007-05-18 Thread Sivakumar Subramani
Hi,

Fix looks good. I have couple of comments,

1) Return from s2io_updt_stats function if the PCI bus is offline
(pci_channel_offline). 
 if (pci_channel_offline(pdev))
return;

2) No Need to call netif_wake_queue() in s2io_io_resume as
netif_device_attach() will take care of calling it.

3) We need to return from s2io_msix_ring_handle(),
s2io_msix_fifo_handle(), s2io_msi_handle() if the PCI channel is
offline. Some thing similary to the below condition that is added in the
s2io_isr()

 -4117,6 +4129,10 @@ static irqreturn_t s2io_isr(int irq, voi
struct mac_info *mac_control;
struct config_param *config;

+   /* Pretend we handled any irq's from a disconnected card */
+   if (pci_channel_offline(sp->pdev))
+   return IRQ_NONE;

Thanks,
~Siva

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Linas Vepstas
Sent: Tuesday, May 15, 2007 5:08 AM
To: Jeff Garzik
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]; linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] s2io: add PCI error recovery support


This patch adds PCI error recovery support to the s2io 10-Gigabit
ethernet device driver. Third revision, blocks interrupts and the
watchdog.

Tested, seems to work well.

Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>
Acked-by: Ramkrishna Vepa <[EMAIL PROTECTED]>
Cc: Raghavendra Koushik <[EMAIL PROTECTED]>
Cc: Wen Xiong <[EMAIL PROTECTED]>



Jeff, please apply for 2.6.22

--linas


 drivers/net/s2io.c |  116
++---
 drivers/net/s2io.h |5 ++
 2 files changed, 116 insertions(+), 5 deletions(-)

Index: linux-2.6.22-rc1/drivers/net/s2io.c
===
--- linux-2.6.22-rc1.orig/drivers/net/s2io.c2007-05-14
17:05:03.0 -0500
+++ linux-2.6.22-rc1/drivers/net/s2io.c 2007-05-14 17:23:45.0
-0500
@@ -480,11 +480,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(). */
@@ -2700,6 +2707,9 @@ static void s2io_netpoll(struct net_devi
u64 val64 = 0xULL;
int i;
 
+   if (pci_channel_offline(nic->pdev))
+   return;
+
disable_irq(dev->irq);
 
atomic_inc(&nic->isr_cnt);
@@ -3225,6 +3235,8 @@ static void alarm_intr_handler(struct s2
int i;
if (atomic_read(&nic->card_state) == CARD_DOWN)
return;
+   if (pci_channel_offline(nic->pdev))
+   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) { @@ -4324,6 +4336,10 @@ static irqreturn_t s2io_isr(int irq, voi
struct mac_info *mac_control;
struct config_param *config;
 
+   /* Pretend we handled any irq's from a disconnected card */
+   if (pci_channel_offline(sp->pdev))
+   return IRQ_NONE;
+
atomic_inc(&sp->isr_cnt);
mac_control = &sp->mac_control;
config = &sp->config;
@@ -6579,7 +6595,7 @@ static void s2io_rem_isr(struct s2io_nic
} while(cnt < 5);
 }
 
-static void s2io_card_down(struct s2io_nic * sp)
+static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
 {
int cnt = 0;
struct XENA_dev_config __iomem *bar0 = sp->bar0; @@ -6594,7
+6610,8 @@ static void s2io_card_down(struct s2io_n
atomic_set(&sp->card_state, CARD_DOWN);
 
/* disable Tx and Rx traffic on the NIC */
-   stop_nic(sp);
+   if (do_io)
+   stop_nic(sp);
 
s2io_rem_isr(sp);
 
@@ -6602,7 +6619,7 @@ static void s2io_card_down(struct s2io_n
tasklet_kill(&sp->task);
 
/* Check if the device is Quiescent and then Reset the NIC */
-   do {
+   while(do_io) {
/* As per the HW requirement we need to replenish the
 * receive buffer to avoid the ring bump. Since there is
 * no intention of processing the Rx frame at this
pointwe are @@ -6627,8 +6644,9 @@ static void s2io_card_down(struct
s2io_n
  (unsigned long long) val64);
break;
}
-   } while (1);
-   s2io_reset(sp);
+   }
+   if (do_io)
+   s2io_reset(sp);
 
spin_lock_irqsave(&sp->tx_lock, flags);
/* Free all Tx buffers */
@@ -6643,6 +6661,11 @@ static void s2io_card_down(struct s2