replace code with FIELD_SIZEOF
Subsystems (2)
PATCH 1/6 replace code with FIELD_SIZEOF
From: Julia Lawall <[email protected]>
---
drivers/net/e1000/e1000_ethtool.c | 2 +- drivers/net/igb/igb_ethtool.c | 2 +- drivers/net/ixgb/ixgb_ethtool.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/e1000/e1000_ethtool.c +1 -1
@@ -50,7 +50,7 @@ struct e1000_stats {int stat_offset; }; -#define E1000_STAT (m) sizeof(((struct e1000_adapter *)0)->m), \ +#define E1000_STAT (m) FIELD_SIZEOF(struct e1000_adapter, m), \ offsetof(struct e1000_adapter, m)static const struct e1000_stats e1000_gstrings_stats[] = { {"rx_packets" ,E1000_STAT (stats.gprc) },
drivers/net/igb/igb_ethtool.c +1 -1
@@ -43,7 +43,7 @@ struct igb_stats {int stat_offset; }; -#define IGB_STAT (m) sizeof(((struct igb_adapter *)0)->m), \ +#define IGB_STAT (m) FIELD_SIZEOF(struct igb_adapter, m), \ offsetof(struct igb_adapter, m)static const struct igb_stats igb_gstrings_stats[] = { {"rx_packets" ,IGB_STAT (stats.gprc) },
drivers/net/ixgb/ixgb_ethtool.c +1 -1
@@ -49,7 +49,7 @@ struct ixgb_stats {int stat_offset; }; -#define IXGB_STAT (m) sizeof(((struct ixgb_adapter *)0)->m), \ +#define IXGB_STAT (m) FIELD_SIZEOF(struct ixgb_adapter, m), \ offsetof(struct ixgb_adapter, m)static struct ixgb_stats ixgb_gstrings_stats[] = { {"rx_packets" ,IXGB_STAT (net_stats.rx_packets)},
PATCH 2/6 e1000: warn if this driver is used for e1000e devices
We're already starting to see reports from users still using e1000 where they should be using e1000e now that this is actually possible. Just to prevent some of this thrash, add a big warning on load on these devices that people should switch to e1000e.
---
drivers/net/e1000/e1000_main.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/net/e1000/e1000_main.c +8 -0
@@ -1203,6 +1203,14 @@ e1000_probe(struct pci_dev *pdev,printk ("%s\n" ,print_mac (mac, netdev->dev_addr)); +if (adapter->hw.bus_type == e1000_bus_type_pci_express) { +DPRINTK (PROBE ,WARNING ,"This device (id %04x:%04x) will no " +"longer be supported by this driver in the future.\n" , + pdev->vendor, pdev->device); +DPRINTK (PROBE ,WARNING ,"please use the \"e1000e\" " +"driver instead.\n" ); + } +/* reset the hardware with the new settings */ e1000_reset (adapter);
PATCH 3/6 e1000e: Fix logic reversal keeping link active
In reply to Auke KokA logic mishap caused the adapter to keep link while we can disable it due to WoL not being active, and vice versa.
---
drivers/net/e1000e/netdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000e/netdev.c +1 -1
@@ -2008,7 +2008,7 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)u16 mii_reg;/* WoL is enabled */ -if (!adapter->wol) +if (adapter->wol)return ;/* non-copper PHY? */
PATCH 4/6 ixgbe: warn when device is in a x4 or lower width slot
In reply to Auke KokIt's easy to oversee this issue when working with this card as evrything will work OK but performance is severely limited (something like 1.5gbit on a x1 link) if the pci-express slot does not offer more bandwidth.
---
drivers/net/ixgbe/ixgbe_main.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +8 -0
@@ -2778,6 +2778,14 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, hw->mac.type, hw->phy.type, (part_num >> 8), (part_num & 0xff)); +if (link_width <=IXGBE_PCI_LINK_WIDTH_4 ) { +dev_warn (&pdev->dev,"PCI-Express bandwidth available for " +"this card is not sufficient for optimal " +"performance.\n" ); +dev_warn (&pdev->dev,"For optimal performance a x8 " +"PCI-Express slot is required.\n" ); + } +/* reset the hardware with the new settings */ ixgbe_start_hw (hw);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 5/6 ixgbe: Disallow device reset during ethtool test
In reply to Auke Kok---
drivers/net/ixgbe/ixgbe_main.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +4 -0
@@ -1942,6 +1942,10 @@ static int ixgbe_open(struct net_device *netdev)int err;u32 num_rx_queues = adapter->num_rx_queues; +/* disallow open during test */ +if (test_bit (__IXGBE_TESTING, &adapter->state)) +return -EBUSY ; + try_intr_reinit:/* allocate transmit descriptors */ err =ixgbe_setup_all_tx_resources (adapter);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
PATCH 6/6 ixgbe: remove accidentally added #ifdef
In reply to Auke KokLet's not add these #ifdef NETIF_F_TSO's back.
---
drivers/net/ixgbe/ixgbe_main.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +0 -5
@@ -220,7 +220,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter, tx_ring->stats.bytes += tx_buffer_info->length;if (cleaned) {struct sk_buff *skb = tx_buffer_info->skb; -#ifdef NETIF_F_TSO unsigned int segs, bytecount; segs =skb_shinfo (skb)->gso_segs ?:1 ;/* multiply data chunks by size of headers */
@@ -228,10 +227,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter, skb->len; total_tx_packets += segs; total_tx_bytes += bytecount; -#else - total_tx_packets++; - total_tx_bytes += skb->len; -#endif }ixgbe_unmap_and_free_tx_resource (adapter, tx_buffer_info);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Quoted 10 lines · Auke Kok
From: Julia Lawall <[email protected]>
Signed-off-by Julia Lawall <[email protected]>Signed-off-by Auke Kok <[email protected]>---
drivers/net/e1000/e1000_ethtool.c | 2 +- drivers/net/igb/igb_ethtool.c | 2 +- drivers/net/ixgb/ixgb_ethtool.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
applied 1-6 to #upstream-fixes
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/