i40e/i40evf updates
Subsystems (2)
cover i40e/i40evf updates
Alan Brady adds code to fix disable overflow promiscuous mode and adds code to refactor AQ CMD buffer debug printing.
Carolyn Wyborny adds code to fix Adaptive ITR enabling.
Harshitha Ramamurthy adds code for error handling for link event.
Joshua Hay adds code to enable mc magic pkt wakeup during power down.
Jacob Keller removes unnecessary call to i40e_update_link_info, converts to cpu from le16 to generate switch_id, adds code to properly convert le16 value to CPU format and marks the value passed to csum_replace_by_diff as __wsum.
Mitch Williams adds code to free rings in remove function and adds one comment.
drivers/net/ethernet/intel/i40e/i40e.h | 2 + drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 2 + drivers/net/ethernet/intel/i40e/i40e_common.c | 19 ++-- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 5 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 112 +++++++++++++++++----- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 17 ++-- drivers/net/ethernet/intel/i40evf/i40e_common.c | 19 ++-- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 17 ++-- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 8 +- 9 files changed, 145 insertions(+), 56 deletions(-)
Signature · 1 line
2.4.11
PATCH 1/11 i40e: fix disable overflow promiscuous mode
From: Alan Brady <[email protected]>
There exists a bug in which the driver is unable to exit overflow promiscuous mode after having added "too many" mac filters. It is expected that after triggering overflow promiscuous, removing the failed/extra filters should then disable overflow promiscuous mode.
The bug exists because we were intentionally skipping the sync_vsi_filter path in cases where we were removing failed filters since they shouldn't have been added to the firmware in the first place, however we still need to go through the sync_vsi_filter code path to determine whether or not it is ok to exit overflow promiscuous mode. This patch fixes the bug by making sure we go through the sync_vsi_filter path in cases of failed filters.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +7 -5
@@ -1453,18 +1453,20 @@ void __i40e_del_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f)if (!f)return ; +/* If the filter was never added to firmware then we can just delete it +* directly and we don't want to set the status to remove or else an +* admin queue command will unnecessarily fire. +*/ if ((f->state ==I40E_FILTER_FAILED ) || (f->state ==I40E_FILTER_NEW )) { -/* this one never got added by the FW. Just remove it, -* no need to sync anything. -*/ hash_del (&f->hlist);kfree (f); }else { f->state =I40E_FILTER_REMOVE ; - vsi->flags |=I40E_VSI_FLAG_FILTER_CHANGED ; - vsi->back->flags |=I40E_FLAG_FILTER_SYNC ; } + + vsi->flags |=I40E_VSI_FLAG_FILTER_CHANGED ; + vsi->back->flags |=I40E_FLAG_FILTER_SYNC ; }/**
Signature · 1 line
2.4.11
Bowers
PATCH 1/11 i40e: fix disable overflow promiscuous mode
Quoted 23 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Brady, Alan <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S57 01/11] i40e: fix disable overflow promiscuous modeFrom: Alan Brady <[email protected]>
There exists a bug in which the driver is unable to exit overflow promiscuous mode after having added "too many" mac filters. It is expected that after triggering overflow promiscuous, removing the failed/extra filters should then disable overflow promiscuous mode.
The bug exists because we were intentionally skipping the
sync_vsi_filterpath in cases where we were removing failed filters since they shouldn't have been added to the firmware in the first place, however we still need to go through thesync_vsi_filtercode path to determine whether or not it is ok to exit overflow promiscuous mode. This patch fixes the bug by making sure we go through thesync_vsi_filterpath in cases of failed filters.
Quoted 5 lines
Signed-off-by Alan Brady <[email protected]>Change-ID I634d249ca3e5fa50729553137c295e73e7722143--- drivers/net/ethernet/intel/i40e/i40e_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
PATCH 2/11 i40e: enable mc magic pkt wakeup during power down
In reply to Bimmy PujariFrom: "Joshua Hay" <[email protected]>
This patch adds a call to the mac_address_write admin q function during power down to update the PRTPM_SAH/SAL registers with the MC_MAG_EN bit thus enabling multicast magic packet wakeup.
A FW workaround is needed to write the multicast magic wake up enable bit in the PRTPM_SAH register. The FW expects the mac address write admin q cmd to be called first with one of the WRITE_TYPE_LAA flags and then with the multicast relevant flags.
*Note: This solution only works for X722 devices currently. A PFR will clear the previously mentioned bit by default, but X722 has support for a WOL_PRESERVE_ON_PFR flag which prevents the bit from being cleared. Once other devices support this flag, this solution should work as well.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 2 + drivers/net/ethernet/intel/i40e/i40e_main.c | 74 ++++++++++++++++++++--- 3 files changed, 67 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -387,6 +387,7 @@ struct i40e_pf {#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(51)#define I40E_FLAG_HAVE_CRT_RETIMER BIT_ULL(52)#define I40E_FLAG_PTP_L4_CAPABLE BIT_ULL(53) +#define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE BIT_ULL(54)/* tracks features that get auto disabled by errors */ u64 auto_disable_flags;
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +2 -0
@@ -538,6 +538,8 @@ I40E_CHECK_STRUCT_LEN(24, i40e_aqc_mac_address_read_data);/* Manage MAC Address Write Command (0x0108) */ struct i40e_aqc_mac_address_write {__le16 command_flags; +#define I40E_AQC_MC_MAG_EN 0x0100 +#define I40E_AQC_WOL_PRESERVE_ON_PFR 0x0200#define I40E_AQC_WRITE_TYPE_LAA_ONLY 0x0000#define I40E_AQC_WRITE_TYPE_LAA_WOL 0x4000#define I40E_AQC_WRITE_TYPE_PORT 0x8000
drivers/net/ethernet/intel/i40e/i40e_main.c +64 -10
98 lines not on this page · raw message
Signature · 1 line
2.4.11
PATCH 3/11 i40e: remove unnecessary call to i40e_update_link_info
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
This call is made just prior to running i40e_link_event. In i40e_link_event, we set hw->phy.get_link_info to true just prior to calling i40e_get_link_status, which conveniently runs i40e_update_link_info for us. Thus, we are running i40e_update_link_info twice, which seems like something we don't need to do...
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -1
@@ -10777,7 +10777,6 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)i40e_pf_config_rss (pf);/* fill in link information and enable LSE reporting */ -i40e_update_link_info (&pf->hw);i40e_link_event (pf);/* Initialize user-specific link properties */
Signature · 1 line
2.4.11
Bowers
PATCH 3/11 i40e: remove unnecessary call to i40e_update_link_info
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S57 03/11] i40e: remove unnecessary call toi40e_update_link_infoFrom: Jacob Keller <[email protected]>
This call is made just prior to running
i40e_link_event. Ini40e_link_event, we sethw->phy.get_link_infoto true just prior to callingi40e_get_link_status, which conveniently runsi40e_update_link_infofor us. Thus, we are runningi40e_update_link_infotwice, which seems like something we don't need to do...
Quoted 5 lines
Signed-off-by Jacob Keller <[email protected]>Change-ID I36467a570f44b7546d218c99e134ff97c2709315--- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 - 1 file changed, 1 deletion(-)
PATCH 4/11 i40evf: free rings in remove function
In reply to Bimmy PujariFrom: Mitch Williams <[email protected]>
When the i40evf_remove() calls netdev close, the device doesn't actually close - it schedules the work for the watchdog to perform. Since we're stopping the watchdog, this work doesn't get done. However, we're resetting the part, so we can free resources after the reset request has gone through. This plugs a memory leak.
---
Testing Hints : Load/unload test
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +2 -1
@@ -2871,7 +2871,8 @@ static void i40evf_remove(struct pci_dev *pdev)i40evf_request_reset (adapter);msleep (50 ); } - +i40evf_free_all_tx_resources (adapter); +i40evf_free_all_rx_resources (adapter);i40evf_misc_irq_disable (adapter);i40evf_free_misc_irq (adapter);i40evf_reset_interrupt_capability (adapter);
Signature · 1 line
2.4.11
Bowers
PATCH 4/11 i40evf: free rings in remove function
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S57 04/11] i40evf: free rings in remove functionFrom: Mitch Williams <[email protected]>
When the
i40evf_remove()calls netdev close, the device doesn't actually close - it schedules the work for the watchdog to perform. Since we're stopping the watchdog, this work doesn't get done. However, we're resetting the part, so we can free resources after the reset request has gone through. This plugs a memory leak.
Quoted 7 lines
Signed-off-by Mitch Williams <[email protected]>Change-ID Id5335dcaf76ce00d2a4c3d26e9faf711d7f051cf---
Testing Hints : Load/unload testdrivers/net/ethernet/intel/i40evf/i40evf_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH 5/11 i40evf: add comment
In reply to Bimmy PujariFrom: Mitch Williams <[email protected]>
Add a comment to reduce confusion.
---
Testing Hints : No code change, just a comment
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +5 -0
@@ -2153,6 +2153,11 @@ static int i40evf_close(struct net_device *netdev) adapter->state = __I40EVF_DOWN_PENDING;i40evf_free_traffic_irqs (adapter); +/* We explicitly don't free resources here because the hardware is +* still active and can DMA into memory. Resources are cleared in +* i40evf_virtchnl_completion() after we get confirmation from the PF +* driver that the rings have been stopped. +*/ return 0 ; }
Signature · 1 line
2.4.11
Bowers
PATCH 5/11 i40evf: add comment
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S57 05/11] i40evf: add commentFrom: Mitch Williams <[email protected]>
Add a comment to reduce confusion.
Quoted 7 lines
Signed-off-by Mitch Williams <[email protected]>Change-ID I3d5819c0f3f5174680442ae54398a073d4a61f4f---
Testing Hints : No code change, just a commentdrivers/net/ethernet/intel/i40evf/i40evf_main.c | 5 +++++ 1 file changed, 5 insertions(+)
PATCH 6/11 i40e: Fix Adaptive ITR enabling
In reply to Bimmy PujariFrom: Carolyn Wyborny <[email protected]>
This patch fixes a bug introduced with the addition of the per queue ITR feature support in ethtool. With that addition, there were functions added which converted the ITR settings to binary values. The IS_ENABLED macros that run on those values check whether a bit is set or not and with the value being binary, the bit check always returned ITR disabled which prevents any updating of the ITR rate. This patch fixes the problem by changing the functions to return the current ITR value instead and renaming it to better reflect its function. These functions now provide a value which will be accurately asessed and update the ITR as intended.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 ++++++------ drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +6 -6
@@ -1864,14 +1864,14 @@ static u32 i40e_buildreg_itr(const int type, const u16 itr)/* a small macro to shorten up some long lines */ #define INTREG I40E_PFINT_DYN_CTLN -static inline int get_rx_itr_enabled (struct i40e_vsi *vsi,int idx) +static inline int get_rx_itr (struct i40e_vsi *vsi,int idx) { -return !!(vsi->rx_rings[idx]->rx_itr_setting); +return vsi->rx_rings[idx]->rx_itr_setting; } -static inline int get_tx_itr_enabled (struct i40e_vsi *vsi,int idx) +static inline int get_tx_itr (struct i40e_vsi *vsi,int idx) { -return !!(vsi->tx_rings[idx]->tx_itr_setting); +return vsi->tx_rings[idx]->tx_itr_setting; }/**
@@ -1897,8 +1897,8 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,*/ rxval = txval =i40e_buildreg_itr (I40E_ITR_NONE ,0 ); - rx_itr_setting =get_rx_itr_enabled (vsi, idx); - tx_itr_setting =get_tx_itr_enabled (vsi, idx); + rx_itr_setting =get_rx_itr (vsi, idx); + tx_itr_setting =get_tx_itr (vsi, idx); if (q_vector->itr_countdown > 0 || (!ITR_IS_DYNAMIC(rx_itr_setting) &&
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +6 -6
@@ -1324,18 +1324,18 @@ static u32 i40e_buildreg_itr(const int type, const u16 itr)/* a small macro to shorten up some long lines */ #define INTREG I40E_VFINT_DYN_CTLN1 -static inline int get_rx_itr_enabled (struct i40e_vsi *vsi,int idx) +static inline int get_rx_itr (struct i40e_vsi *vsi,int idx) {struct i40evf_adapter *adapter = vsi->back; -return !!(adapter->rx_rings[idx].rx_itr_setting); +return adapter->rx_rings[idx].rx_itr_setting; } -static inline int get_tx_itr_enabled (struct i40e_vsi *vsi,int idx) +static inline int get_tx_itr (struct i40e_vsi *vsi,int idx) {struct i40evf_adapter *adapter = vsi->back; -return !!(adapter->tx_rings[idx].tx_itr_setting); +return adapter->tx_rings[idx].tx_itr_setting; }/**
@@ -1361,8 +1361,8 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,*/ rxval = txval =i40e_buildreg_itr (I40E_ITR_NONE ,0 ); - rx_itr_setting =get_rx_itr_enabled (vsi, idx); - tx_itr_setting =get_tx_itr_enabled (vsi, idx); + rx_itr_setting =get_rx_itr (vsi, idx); + tx_itr_setting =get_tx_itr (vsi, idx); if (q_vector->itr_countdown > 0 || (!ITR_IS_DYNAMIC(rx_itr_setting) &&
Signature · 1 line
2.4.11
Bowers
PATCH 6/11 i40e: Fix Adaptive ITR enabling
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S57 06/11] i40e: Fix Adaptive ITR enablingFrom: Carolyn Wyborny <[email protected]>
This patch fixes a bug introduced with the addition of the per queue ITR feature support in ethtool. With that addition, there were functions added which converted the ITR settings to binary values.
TheIS_ENABLEDmacros that run on those values check whether a bit is set or not and with the value being binary, the bit check always returned ITR disabled which prevents any updating of the ITR rate.
This patch fixes the problem by changing the functions to return the current ITR value instead and renaming it to better reflect its function. These functions now provide a value which will be accurately asessed and update the ITR as intended.
Quoted 6 lines
Signed-off-by Carolyn Wyborny <[email protected]>Change-ID I14f1d088d052e27f652aaa3113e186415ddea1fc--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 12 ++++++------ drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-)
PATCH 7/11 i40e: refactor AQ CMD buffer debug printing
In reply to Bimmy PujariFrom: Alan Brady <[email protected]>
This patch refactors the '%*ph' printk format specifier to instead use the print_hex_dump function, as recommended by the '%*ph' documentation. This produces better/more standardized output.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 19 ++++++++++++------- drivers/net/ethernet/intel/i40evf/i40e_common.c | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +12 -7
@@ -300,7 +300,6 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;u16 len;u8 *buf = (u8 *)buffer; -u16 i =0 ;if ((!(mask & hw->debug_mask)) || (desc ==NULL ))return ;
@@ -328,12 +327,18 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,if (buf_len < len) len = buf_len;/* write the full 16-byte chunks */ -for (i =0 ; i < (len -16 ); i +=16 ) -i40e_debug (hw, mask,"\t0x%04X %16ph\n" , i, buf + i); -/* write whatever's left over without overrunning the buffer */ -if (i < len) -i40e_debug (hw, mask,"\t0x%04X %*ph\n" , - i, len - i, buf + i); +if (hw->debug_mask & mask) { +char prefix[20 ]; + +snprintf (prefix,20 , +"i40e %02x:%02x.%x: \t0x" , + hw->bus.bus_id, + hw->bus.device, + hw->bus.func); + +print_hex_dump (KERN_INFO , prefix,DUMP_PREFIX_OFFSET , +16 ,1 , buf, len, false); + } } }
drivers/net/ethernet/intel/i40evf/i40e_common.c +12 -7
@@ -304,7 +304,6 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc, {struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;u8 *buf = (u8 *)buffer; -u16 i =0 ;if ((!(mask & hw->debug_mask)) || (desc ==NULL ))return ;
@@ -332,12 +331,18 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,if (buf_len < len) len = buf_len;/* write the full 16-byte chunks */ -for (i =0 ; i < (len -16 ); i +=16 ) -i40e_debug (hw, mask,"\t0x%04X %16ph\n" , i, buf + i); -/* write whatever's left over without overrunning the buffer */ -if (i < len) -i40e_debug (hw, mask,"\t0x%04X %*ph\n" , - i, len - i, buf + i); +if (hw->debug_mask & mask) { +char prefix[20 ]; + +snprintf (prefix,20 , +"i40evf %02x:%02x.%x: \t0x" , + hw->bus.bus_id, + hw->bus.device, + hw->bus.func); + +print_hex_dump (KERN_INFO , prefix,DUMP_PREFIX_OFFSET , +16 ,1 , buf, len, false); + } } }
Signature · 1 line
2.4.11
Bowers
PATCH 7/11 i40e: refactor AQ CMD buffer debug printing
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Brady, Alan <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S57 07/11] i40e: refactor AQ CMD buffer debug printingFrom: Alan Brady <[email protected]>
This patch refactors the '%*ph' printk format specifier to instead use the
print_hex_dumpfunction, as recommended by the '%*ph' documentation. This produces better/more standardized output.
Quoted 7 lines
Signed-off-by Alan Brady <[email protected]>Change-ID Id56700b4e8abc40ff8c04bc8379e7df04cb4d6fd--- drivers/net/ethernet/intel/i40e/i40e_common.c | 19 ++++++++++++------- drivers/net/ethernet/intel/i40evf/i40e_common.c | 19 ++++++++++++------ - 2 files changed, 24 insertions(+), 14 deletions(-)
PATCH 8/11 i40e: convert to cpu from le16 to generate switch_id correctly
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
On Big Endian platforms we would incorrectly calculate the wrong switch id since we did not properly convert the le16 value into CPU format. Caught by sparse.
--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +3 -2
@@ -974,7 +974,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,struct i40e_dcbx_config *r_cfg = &pf->hw.remote_dcbx_config;int i, ret; -u32 switch_id; +u16 switch_id; bw_data = kzalloc(sizeof( struct i40e_aqc_query_port_ets_config_resp),
@@ -986,7 +986,8 @@ static ssize_t i40e_dbg_command_write(struct file *filp, vsi = pf->vsi[pf->lan_vsi]; switch_id = - vsi->info.switch_id &I40E_AQ_VSI_SW_ID_MASK ; +le16_to_cpu (vsi->info.switch_id) & +I40E_AQ_VSI_SW_ID_MASK ; ret = i40e_aq_query_port_ets_config(&pf->hw, switch_id,
Signature · 1 line
2.4.11
Bowers
PATCH 8/11 i40e: convert to cpu from le16 to generate switch_id correctly
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S57 08/11] i40e: convert to cpu from le16 to generateswitch_idcorrectlyFrom: Jacob Keller <[email protected]>
On Big Endian platforms we would incorrectly calculate the wrong switch id since we did not properly convert the le16 value into CPU format. Caught by sparse.
Quoted 5 lines
Signed-off-by Jacob Keller <[email protected]>Change-ID I69a2f9fa064a0a91691f7d0e6fcc206adceb8e36--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
PATCH 9/11 i40e: properly convert le16 value to CPU format
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
This ensures that the pvid which is stored in __le16 format is converted to the CPU format. This will fix comparison issues on Big Endian platforms.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -5
@@ -1260,6 +1260,7 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi, struct hlist_head *tmp_del_list, int vlan_filters) { +s16 pvid =le16_to_cpu (vsi->info.pvid);struct i40e_mac_filter *f, *add_head;struct i40e_new_mac_filter *new;struct hlist_node *h;
@@ -1281,8 +1282,8 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi,/* Update the filters about to be added in place */ hlist_for_each_entry (new, tmp_add_list, hlist) { -if (vsi->info.pvid && new->f->vlan != vsi->info.pvid) - new->f->vlan = vsi->info.pvid; +if (pvid && new->f->vlan != pvid) + new->f->vlan = pvid;else if (vlan_filters && new->f->vlan ==I40E_VLAN_ANY ) new->f->vlan =0 ;else if (!vlan_filters && new->f->vlan ==0 )
@@ -1296,12 +1297,12 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi,* order to avoid duplicating code for adding the new filter * then deleting the old filter. */ -if ((vsi->info.pvid && f->vlan != vsi->info.pvid) || +if ((pvid && f->vlan != pvid) || (vlan_filters && f->vlan ==I40E_VLAN_ANY ) || (!vlan_filters && f->vlan ==0 )) {/* Determine the new vlan we will be adding */ -if (vsi->info.pvid) - new_vlan = vsi->info.pvid; +if (pvid) + new_vlan = pvid;else if (vlan_filters) new_vlan =0 ;else
Signature · 1 line
2.4.11
Bowers
PATCH 9/11 i40e: properly convert le16 value to CPU format
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S57 09/11] i40e: properly convert le16 value to CPU formatFrom: Jacob Keller <[email protected]>
Quoted 8 lines
This ensures that the pvid which is stored in
__le16format is converted to the CPU format. This will fix comparison issues on Big Endian platforms.Signed-off-by Jacob Keller <[email protected]>Change-ID I92c80d1315dc2a0f9f095d5a0c48d461beb052ed--- drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
PATCH 10/11 i40e: Error handling for link event
In reply to Bimmy PujariFrom: Harshitha Ramamurthy <[email protected]>
There exists an intermittent bug which causes the 'Link Detected' field reported by the 'ethtool <iface>' command to be 'Yes' when in fact, there is no link. This patch fixes the problem by enabling temporary link polling when i40e_get_link_status returns an error. This causes the driver to remember that an admin queue command failed and polls, until the function returns with a success.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -388,6 +388,7 @@ struct i40e_pf {#define I40E_FLAG_HAVE_CRT_RETIMER BIT_ULL(52)#define I40E_FLAG_PTP_L4_CAPABLE BIT_ULL(53)#define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE BIT_ULL(54) +#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(55)/* tracks features that get auto disabled by errors */ u64 auto_disable_flags;
drivers/net/ethernet/intel/i40e/i40e_main.c +12 -2
@@ -6367,7 +6367,16 @@ static void i40e_link_event(struct i40e_pf *pf) old_link = (pf->hw.phy.link_info_old.link_info &I40E_AQ_LINK_UP ); status =i40e_get_link_status (&pf->hw, &new_link); -if (status) { + +/* On success, disable temp link polling */ +if (status ==I40E_SUCCESS ) { +if (pf->flags &I40E_FLAG_TEMP_LINK_POLLING ) + pf->flags &= ~I40E_FLAG_TEMP_LINK_POLLING ; + }else { +/* Enable link polling temporarily until i40e_get_link_status +* returns I40E_SUCCESS +*/ + pf->flags |=I40E_FLAG_TEMP_LINK_POLLING ;dev_dbg (&pf->pdev->dev,"couldn't get link state, status: %d\n" , status);return ;
@@ -6419,7 +6428,8 @@ static void i40e_watchdog_subtask(struct i40e_pf *pf)return ; pf->service_timer_previous = jiffies; -if (pf->flags &I40E_FLAG_LINK_POLLING_ENABLED ) +if ((pf->flags &I40E_FLAG_LINK_POLLING_ENABLED ) || + (pf->flags &I40E_FLAG_TEMP_LINK_POLLING ))i40e_link_event (pf);/* Update the stats for active netdevs so the network stack
Signature · 1 line
2.4.11
Bowers
PATCH 10/11 i40e: Error handling for link event
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S57 10/11] i40e: Error handling for link eventFrom: Harshitha Ramamurthy <[email protected]>
There exists an intermittent bug which causes the 'Link Detected' field reported by the 'ethtool <iface>' command to be 'Yes' when in fact, there is no link. This patch fixes the problem by enabling temporary link polling when
i40e_get_link_statusreturns an error. This causes the driver to remember that an admin queue command failed and polls, until the function returns with a success.
Quoted 6 lines
Signed-off-by Harshitha Ramamurthy <[email protected]>Change-Id I64c69b008db4017b8729f3fc27b8f65c8fe2eaa0--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
PATCH 11/11 i40e: mark the value passed to csum_replace_by_diff as __wsum
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
Fix, or rather, avoid a sparse warning caused by the fact that csum_replace_by_diff expects to receive a __wsum value. Since the calculation appears to work, simply typecast the passed paylen value to __wsum to avoid the warning.
This seems pretty fishy since __wsum was obviously annotated as a separate type on purpose, so this throws the entire calculation into question. Since it currently appears to behave as expected, the typecast is probably safe.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 5 +++-- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +3 -2
@@ -2335,7 +2335,8 @@ static int i40e_tso(struct i40e_tx_buffer *first, u8 *hdr_len,/* remove payload length from outer checksum */ paylen = skb->len - l4_offset; -csum_replace_by_diff (&l4.udp->check,htonl (paylen)); +csum_replace_by_diff (&l4.udp->check, + (__force __wsum )htonl (paylen)); }/* reset pointers to inner headers */
@@ -2356,7 +2357,7 @@ static int i40e_tso(struct i40e_tx_buffer *first, u8 *hdr_len,/* remove payload length from inner checksum */ paylen = skb->len - l4_offset; -csum_replace_by_diff (&l4.tcp->check,htonl (paylen)); +csum_replace_by_diff (&l4.tcp->check, (__force __wsum )htonl (paylen));/* compute length of segmentation header */ *hdr_len = (l4.tcp->doff *4 ) + l4_offset;
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +3 -2
@@ -1629,7 +1629,8 @@ static int i40e_tso(struct i40e_tx_buffer *first, u8 *hdr_len,/* remove payload length from outer checksum */ paylen = skb->len - l4_offset; -csum_replace_by_diff (&l4.udp->check,htonl (paylen)); +csum_replace_by_diff (&l4.udp->check, + (__force __wsum )htonl (paylen)); }/* reset pointers to inner headers */
@@ -1650,7 +1651,7 @@ static int i40e_tso(struct i40e_tx_buffer *first, u8 *hdr_len,/* remove payload length from inner checksum */ paylen = skb->len - l4_offset; -csum_replace_by_diff (&l4.tcp->check,htonl (paylen)); +csum_replace_by_diff (&l4.tcp->check, (__force __wsum )htonl (paylen));/* compute length of segmentation header */ *hdr_len = (l4.tcp->doff *4 ) + l4_offset;
Signature · 1 line
2.4.11
Bowers
PATCH 11/11 i40e: mark the value passed to csum_replace_by_diff as __wsum
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Monday, December 12, 2016 3:44 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S57 11/11] i40e: mark the value passed tocsum_replace_by_diffas__wsumFrom: Jacob Keller <[email protected]>
Fix, or rather, avoid a sparse warning caused by the fact that
csum_replace_by_diffexpects to receive a__wsumvalue. Since the calculation appears to work, simply typecast the passed paylen value to__wsumto avoid the warning.This seems pretty fishy since
__wsumwas obviously annotated as a separate type on purpose, so this throws the entire calculation into question. Since it currently appears to behave as expected, the typecast is probably safe.
Quoted 6 lines
Signed-off-by Jacob Keller <[email protected]>Change-ID I4fdc5cddd589abc16098176e8a61127e761488f4--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 5 +++-- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)