From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:10
This series contains updates to i40e and i40evf only.
Alan fixes a bug in which the driver is unable to exit overflow
promiscuous mode after having added "too many" mac filters. Ractored
the '%*ph' printk format specifier to instead use the print_hex_dump().
Josh adds enabling multicast magic packet wakeup by adding calls to
the mac_address_write admin q function during power down to update the
PRTPM_SAH/SAL registers with the MC_MAG_EN bit.
Jake remove a duplicate call i40e_update_link_info(), since it does not
need to call it twice. Fixes and issue where we calculating the wrong
switch id on big endian platforms. Avoided sparse warning, by doing a
typecast to ensure the value is of the type expected by
csum_replace_by_diff().
Mitch fixes a memory leak by freeing resources during i40e_remove().
Cleans up some code confusion by adding a proper code comment.
Carolyn fixes a bug introduced with the addition of the per queue ITR
feature support in ethtool. Cleans up a duplicate device id from the
PCI table.
Harshitha fixes a bug which causes the 'Link Detected' field in
ethtool to report the correct link status.
Benjamin Poirier from SuSE applies a fix ec13ee80145c ("virtio_net:
invoke softirqs after __napi_schedule") to i40e driver as well.
The following are changes since commit 4e33e34625103593a71d2bae471ce49cef62ef06:
tcp: use page_ref_inc() in tcp_sendmsg()
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 40GbE
Alan Brady (2):
i40e: fix disable overflow promiscuous mode
i40e: refactor AQ CMD buffer debug printing
Benjamin Poirier (1):
i40e: Invoke softirqs after napi_reschedule
Carolyn Wyborny (2):
i40e: Fix Adaptive ITR enabling
i40e: remove duplicate device id from PCI table
Harshitha Ramamurthy (1):
i40e: Error handling for link event
Jacob Keller (4):
i40e: remove unnecessary call to i40e_update_link_info
i40e: convert to cpu from le16 to generate switch_id correctly
i40e: properly convert le16 value to CPU format
i40e: mark the value passed to csum_replace_by_diff as __wsum
Joshua Hay (1):
i40e: enable mc magic pkt wakeup during power down
Mitch Williams (2):
i40evf: free rings in remove function
i40evf: add 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 | 115 +++++++++++++++++-----
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, 147 insertions(+), 57 deletions(-)
--
2.11.0
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:10
From: Alan Brady <redacted>
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.
Change-ID: I634d249ca3e5fa50729553137c295e73e7722143
Signed-off-by: Alan Brady <redacted>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
@@ -1447,18 +1447,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+*directlyandwedon'twanttosetthestatustoremoveorelsean+*adminqueuecommandwillunnecessarilyfire.+*/if((f->state==I40E_FILTER_FAILED)||(f->state==I40E_FILTER_NEW)){-/* this one never got added by the FW. Just remove it,-*noneedtosyncanything.-*/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;}/**
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:10
From: Joshua Hay <redacted>
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.
Change-ID: I51bd5b8535bd9051c2676e27c999c1657f786827
Signed-off-by: Joshua Hay <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
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(-)
@@ -348,6 +348,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 */u64auto_disable_flags;
@@ -11741,6 +11742,53 @@ static void i40e_pci_error_resume(struct pci_dev *pdev)}/**+*i40e_enable_mc_magic_wake-enablemulticastmagicpacketwakeup+*usingthemac_address_writeadminqfunction+*@pf:pointertoi40e_pfstruct+**/+staticvoidi40e_enable_mc_magic_wake(structi40e_pf*pf)+{+structi40e_hw*hw=&pf->hw;+i40e_statusret;+u8mac_addr[6];+u16flags=0;++/* Get current MAC address in case it's an LAA */+if(pf->vsi[pf->lan_vsi]&&pf->vsi[pf->lan_vsi]->netdev){+ether_addr_copy(mac_addr,+pf->vsi[pf->lan_vsi]->netdev->dev_addr);+}else{+dev_err(&pf->pdev->dev,+"Failed to retrieve MAC address; using default\n");+ether_addr_copy(mac_addr,hw->mac.addr);+}++/* The FW expects the mac address write cmd to first be called with+*oneoftheseflagsbeforecallingitagainwiththemulticast+*enableflags.+*/+flags=I40E_AQC_WRITE_TYPE_LAA_WOL;++if(hw->func_caps.flex10_enable&&hw->partition_id!=1)+flags=I40E_AQC_WRITE_TYPE_LAA_ONLY;++ret=i40e_aq_mac_address_write(hw,flags,mac_addr,NULL);+if(ret){+dev_err(&pf->pdev->dev,+"Failed to update MAC address registers; cannot enable Multicast Magic packet wake up");+return;+}++flags=I40E_AQC_MC_MAG_EN+|I40E_AQC_WOL_PRESERVE_ON_PFR+|I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG;+ret=i40e_aq_mac_address_write(hw,flags,mac_addr,NULL);+if(ret)+dev_err(&pf->pdev->dev,+"Failed to enable Multicast Magic Packet wake up\n");+}++/***i40e_shutdown-PCIcallbackforshuttingdown*@pdev:PCIdeviceinformationstruct**/
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:11
From: Jacob Keller <jacob.e.keller@intel.com>
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...
Change-ID: I36467a570f44b7546d218c99e134ff97c2709315
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 1 -
1 file changed, 1 deletion(-)
@@ -10761,7 +10761,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 */
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:11
From: Mitch Williams <redacted>
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.
Change-ID: Id5335dcaf76ce00d2a4c3d26e9faf711d7f051cf
Signed-off-by: Mitch Williams <redacted>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -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+*stillactiveandcanDMAintomemory.Resourcesareclearedin+*i40evf_virtchnl_completion()afterwegetconfirmationfromthePF+*driverthattheringshavebeenstopped.+*/return0;}
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:13
From: Jacob Keller <jacob.e.keller@intel.com>
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.
Change-ID: I69a2f9fa064a0a91691f7d0e6fcc206adceb8e36
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:13
From: Carolyn Wyborny <redacted>
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.
Change-ID: I14f1d088d052e27f652aaa3113e186415ddea1fc
Signed-off-by: Carolyn Wyborny <redacted>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
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(-)
@@ -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-staticinlineintget_rx_itr_enabled(structi40e_vsi*vsi,intidx)+staticinlineintget_rx_itr(structi40e_vsi*vsi,intidx){-return!!(vsi->rx_rings[idx]->rx_itr_setting);+returnvsi->rx_rings[idx]->rx_itr_setting;}-staticinlineintget_tx_itr_enabled(structi40e_vsi*vsi,intidx)+staticinlineintget_tx_itr(structi40e_vsi*vsi,intidx){-return!!(vsi->tx_rings[idx]->tx_itr_setting);+returnvsi->tx_rings[idx]->tx_itr_setting;}/**
@@ -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-staticinlineintget_rx_itr_enabled(structi40e_vsi*vsi,intidx)+staticinlineintget_rx_itr(structi40e_vsi*vsi,intidx){structi40evf_adapter*adapter=vsi->back;-return!!(adapter->rx_rings[idx].rx_itr_setting);+returnadapter->rx_rings[idx].rx_itr_setting;}-staticinlineintget_tx_itr_enabled(structi40e_vsi*vsi,intidx)+staticinlineintget_tx_itr(structi40e_vsi*vsi,intidx){structi40evf_adapter*adapter=vsi->back;-return!!(adapter->tx_rings[idx].tx_itr_setting);+returnadapter->tx_rings[idx].tx_itr_setting;}/**
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:13
From: Alan Brady <redacted>
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.
Change-ID: Id56700b4e8abc40ff8c04bc8379e7df04cb4d6fd
Signed-off-by: Alan Brady <redacted>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
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(-)
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:13
From: Jacob Keller <jacob.e.keller@intel.com>
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.
Change-ID: I92c80d1315dc2a0f9f095d5a0c48d461beb052ed
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
@@ -1254,6 +1254,7 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi,structhlist_head*tmp_del_list,intvlan_filters){+s16pvid=le16_to_cpu(vsi->info.pvid);structi40e_mac_filter*f,*add_head;structi40e_new_mac_filter*new;structhlist_node*h;
@@ -1275,8 +1276,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;elseif(vlan_filters&&new->f->vlan==I40E_VLAN_ANY)new->f->vlan=0;elseif(!vlan_filters&&new->f->vlan==0)
@@ -1290,12 +1291,12 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi,*ordertoavoidduplicatingcodeforaddingthenewfilter*thendeletingtheoldfilter.*/-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;elseif(vlan_filters)new_vlan=0;else
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:13
From: Harshitha Ramamurthy <redacted>
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.
Change-Id: I64c69b008db4017b8729f3fc27b8f65c8fe2eaa0
Signed-off-by: Harshitha Ramamurthy <redacted>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e.h | 1 +
drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
@@ -349,6 +349,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 */u64auto_disable_flags;
@@ -6353,7 +6353,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+*returnsI40E_SUCCESS+*/+pf->flags|=I40E_FLAG_TEMP_LINK_POLLING;dev_dbg(&pf->pdev->dev,"couldn't get link state, status: %d\n",status);return;
@@ -6405,7 +6414,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
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:14
From: Jacob Keller <jacob.e.keller@intel.com>
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.
Change-ID: I4fdc5cddd589abc16098176e8a61127e761488f4
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
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(-)
From: Jeff Kirsher <hidden> Date: 2017-02-19 06:34:14
From: Benjamin Poirier <redacted>
The following message is logged from time to time when using i40e:
NOHZ: local_softirq_pending 08
i40e may schedule napi from a workqueue. Afterwards, softirqs are not run
in a deterministic time frame. The problem is the same as what was
described in commit ec13ee80145c ("virtio_net: invoke softirqs after
__napi_schedule") and this patch applies the same fix to i40e.
Signed-off-by: Benjamin Poirier <redacted>
Tested-by: Andrew Bowers <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++
1 file changed, 2 insertions(+)