Re: [PATCH 02/11] ixgb: Fix the use of dprintk rather than printk

2006-05-19 Thread Auke Kok

Francois Romieu wrote:

Jeff Kirsher [EMAIL PROTECTED] :

@@ -486,8 +495,7 @@ ixgb_probe(struct pci_dev *pdev,
netif_carrier_off(netdev);
netif_stop_queue(netdev);
 
-	printk(KERN_INFO %s: Intel(R) PRO/10GbE Network Connection\n,

-  netdev-name);
+   DPRINTK(PROBE, INFO, Intel(R) PRO/10GbE Network Connection\n);


It could probably be factored out with ixgb_driver_string.


the driver name is different from the interface/device that it drives - Hence 
the different name. The 'Connection' name as above is the branding name as 
well, and that's why we print it here as such. e1000 does the same thing for 
the same reason.


Auke
-
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 02/11] ixgb: Fix the use of dprintk rather than printk

2006-04-24 Thread Stephen Hemminger
On Sat, 22 Apr 2006 11:03:01 +0200
Francois Romieu [EMAIL PROTECTED] wrote:

 Jeff Kirsher [EMAIL PROTECTED] :
 [...]
  diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
  index c83271b..a696c33 100644
  --- a/drivers/net/ixgb/ixgb.h
  +++ b/drivers/net/ixgb/ixgb.h
 [...]
  @@ -192,6 +197,7 @@ struct ixgb_adapter {
   
  /* structs defined in ixgb_hw.h */
  struct ixgb_hw hw;
  +   u16 msg_enable;
  struct ixgb_hw_stats stats;
   #ifdef CONFIG_PCI_MSI
  boolean_t have_msi;
  diff --git a/drivers/net/ixgb/ixgb_ethtool.c 
  b/drivers/net/ixgb/ixgb_ethtool.c
  index d38ade5..e8d83de 100644
  --- a/drivers/net/ixgb/ixgb_ethtool.c
  +++ b/drivers/net/ixgb/ixgb_ethtool.c
  @@ -251,6 +251,20 @@ ixgb_set_tso(struct net_device *netdev, 
   } 
   #endif /* NETIF_F_TSO */
   
  +static uint32_t
  +ixgb_get_msglevel(struct net_device *netdev)
  +{
  +   struct ixgb_adapter *adapter = netdev-priv;
  +   return adapter-msg_enable;
  +}
  +
  +static void
  +ixgb_set_msglevel(struct net_device *netdev, uint32_t data)
  +{
  +   struct ixgb_adapter *adapter = netdev-priv;
  +   adapter-msg_enable = data;
  +}
  +
 
 Minor nits:
 - you may consider removing the u{8/16/32} in drivers/net/ixgb
   for consistency sake in a different patch (there is a strong
   majority of uint_something in the driver).


All the uint32_t should be removed.  Kernel style is u32.
-
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 02/11] ixgb: Fix the use of dprintk rather than printk

2006-04-22 Thread Francois Romieu
Jeff Kirsher [EMAIL PROTECTED] :
[...]
 diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
 index c83271b..a696c33 100644
 --- a/drivers/net/ixgb/ixgb.h
 +++ b/drivers/net/ixgb/ixgb.h
[...]
 @@ -192,6 +197,7 @@ struct ixgb_adapter {
  
   /* structs defined in ixgb_hw.h */
   struct ixgb_hw hw;
 + u16 msg_enable;
   struct ixgb_hw_stats stats;
  #ifdef CONFIG_PCI_MSI
   boolean_t have_msi;
 diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
 index d38ade5..e8d83de 100644
 --- a/drivers/net/ixgb/ixgb_ethtool.c
 +++ b/drivers/net/ixgb/ixgb_ethtool.c
 @@ -251,6 +251,20 @@ ixgb_set_tso(struct net_device *netdev, 
  } 
  #endif /* NETIF_F_TSO */
  
 +static uint32_t
 +ixgb_get_msglevel(struct net_device *netdev)
 +{
 + struct ixgb_adapter *adapter = netdev-priv;
 + return adapter-msg_enable;
 +}
 +
 +static void
 +ixgb_set_msglevel(struct net_device *netdev, uint32_t data)
 +{
 + struct ixgb_adapter *adapter = netdev-priv;
 + adapter-msg_enable = data;
 +}
 +

Minor nits:
- you may consider removing the u{8/16/32} in drivers/net/ixgb
  for consistency sake in a different patch (there is a strong
  majority of uint_something in the driver).

- s/netdev-priv/netdev_priv(netdev)/ ?

[...]
 @@ -486,8 +495,7 @@ ixgb_probe(struct pci_dev *pdev,
   netif_carrier_off(netdev);
   netif_stop_queue(netdev);
  
 - printk(KERN_INFO %s: Intel(R) PRO/10GbE Network Connection\n,
 -netdev-name);
 + DPRINTK(PROBE, INFO, Intel(R) PRO/10GbE Network Connection\n);

It could probably be factored out with ixgb_driver_string.

-- 
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


[PATCH 02/11] ixgb: Fix the use of dprintk rather than printk

2006-04-21 Thread Jeff Kirsher

- use DPRINTK and msglvl instead of printk
- allow ethtool control of msglvl

Signed-off-by: Jeff Kirsher [EMAIL PROTECTED]
Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: John Ronciak [EMAIL PROTECTED]
---

 drivers/net/ixgb/ixgb.h |8 +-
 drivers/net/ixgb/ixgb_ethtool.c |   16 
 drivers/net/ixgb/ixgb_main.c|   52 +--
 3 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index c83271b..a696c33 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -84,7 +84,12 @@ struct ixgb_adapter;
 #define IXGB_DBG(args...)
 #endif
 
-#define IXGB_ERR(args...) printk(KERN_ERR ixgb:  args)
+#define PFX ixgb: 
+#define DPRINTK(nlevel, klevel, fmt, args...) \
+   (void)((NETIF_MSG_##nlevel  adapter-msg_enable)  \
+   printk(KERN_##klevel PFX %s: %s:  fmt, adapter-netdev-name, \
+   __FUNCTION__ , ## args))
+
 
 /* TX/RX descriptor defines */
 #define DEFAULT_TXD 256
@@ -192,6 +197,7 @@ struct ixgb_adapter {
 
/* structs defined in ixgb_hw.h */
struct ixgb_hw hw;
+   u16 msg_enable;
struct ixgb_hw_stats stats;
 #ifdef CONFIG_PCI_MSI
boolean_t have_msi;
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index d38ade5..e8d83de 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -251,6 +251,20 @@ ixgb_set_tso(struct net_device *netdev, 
 } 
 #endif /* NETIF_F_TSO */
 
+static uint32_t
+ixgb_get_msglevel(struct net_device *netdev)
+{
+   struct ixgb_adapter *adapter = netdev-priv;
+   return adapter-msg_enable;
+}
+
+static void
+ixgb_set_msglevel(struct net_device *netdev, uint32_t data)
+{
+   struct ixgb_adapter *adapter = netdev-priv;
+   adapter-msg_enable = data;
+}
+
 #define IXGB_GET_STAT(_A_, _R_) _A_-stats._R_
 
 static int 
@@ -714,6 +728,8 @@ static struct ethtool_ops ixgb_ethtool_o
.set_tx_csum = ixgb_set_tx_csum,
.get_sg = ethtool_op_get_sg,
.set_sg = ethtool_op_set_sg,
+   .get_msglevel = ixgb_get_msglevel,
+   .set_msglevel = ixgb_set_msglevel,
 #ifdef NETIF_F_TSO
.get_tso = ethtool_op_get_tso,
.set_tso = ixgb_set_tso,
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 0b9481a..6f8fd6f 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -148,6 +148,11 @@ MODULE_DESCRIPTION(Intel(R) PRO/10GbE N
 MODULE_LICENSE(GPL);
 MODULE_VERSION(DRV_VERSION);
 
+#define DEFAULT_DEBUG_LEVEL_SHIFT 3
+static int debug = DEFAULT_DEBUG_LEVEL_SHIFT;
+module_param(debug, int, 0);
+MODULE_PARM_DESC(debug, Debug level (0=none,...,16=all));
+
 /* some defines for controlling descriptor fetches in h/w */
 #define RXDCTL_WTHRESH_DEFAULT 16  /* chip writes back at this many or 
RXT0 */
 #define RXDCTL_PTHRESH_DEFAULT 0   /* chip considers prefech below
@@ -248,19 +253,20 @@ ixgb_up(struct ixgb_adapter *adapter)
 
if (!pcix)
   adapter-have_msi = FALSE;
-   else if((err = pci_enable_msi(adapter-pdev))) {
-   printk (KERN_ERR
+   else if ((err = pci_enable_msi(adapter-pdev))) {
+   DPRINTK(PROBE, ERR,
 Unable to allocate MSI interrupt Error: %d\n, err);
adapter-have_msi = FALSE;
/* proceed to try to request regular interrupt */
}
-   }
 
 #endif
-   if((err = request_irq(adapter-pdev-irq, ixgb_intr,
- SA_SHIRQ | SA_SAMPLE_RANDOM,
- netdev-name, netdev)))
+   if ((err = request_irq(adapter-pdev-irq, ixgb_intr,
+SA_SHIRQ | SA_SAMPLE_RANDOM, netdev-name, netdev))) {
+   DPRINTK(PROBE, ERR,
+Unable to allocate interrupt Error: %d\n, err);  
 
return err;
+   }
 
/* disable interrupts and get the hardware into a known state */
IXGB_WRITE_REG(adapter-hw, IMC, 0x);
@@ -326,7 +332,7 @@ ixgb_reset(struct ixgb_adapter *adapter)
 
ixgb_adapter_stop(adapter-hw);
if(!ixgb_init_hw(adapter-hw))
-   IXGB_DBG(ixgb_init_hw failed.\n);
+   DPRINTK(PROBE, ERR, ixgb_init_hw failed.\n);
 }
 
 /**
@@ -363,7 +369,7 @@ ixgb_probe(struct pci_dev *pdev,
} else {
if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) ||
   (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) {
-   IXGB_ERR(No usable DMA configuration, aborting\n);
+   DPRINTK(PROBE, ERR, No usable DMA configuration, 
aborting\n);
goto err_dma_mask;
}
pci_using_dac = 0;
@@ -388,6 +394,7 @@ ixgb_probe(struct pci_dev *pdev,
adapter-netdev = netdev;
adapter-pdev = pdev;
adapter-hw.back = adapter;
+   adapter-msg_enable =