From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:03:20
This series contains updates to iavf driver only.
Mateusz adds a wait for reset completion when changing queue count which
could otherwise cause issues with VF reset.
Nick adds a null check for vf_res in iavf_fix_features(), corrects
ordering of function calls to resolve dependency issues, and prevents
possible freeing of a lock which isn't being held.
Piotr fixes logic that did not allow setting all multicast mode without
promiscuous mode.
Jake prevents possible accidental freeing of filter structure.
Mitch adds null checks for key and indir parameters in iavf_get_rxfh().
Surabhi adds an additional check that would, previously, cause the driver
to print a false error due to values obtained while the VF is in reset.
Grzegorz prevents a queue request of 0 which would cause queue count to
reset to default values.
Akeem restores VLAN filters when bringing the interface back up.
The following are changes since commit cf4f5530bb55ef7d5a91036b26676643b80b1616:
net/smc: Make sure the link_id is unique
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE
Akeem G Abodunrin (1):
iavf: Restore VLAN filters after link down
Grzegorz Szczurek (1):
iavf: Fix for setting queues to 0
Jacob Keller (1):
iavf: prevent accidental free of filter structure
Mateusz Palczewski (1):
iavf: Fix return of set the new channel count
Mitch Williams (1):
iavf: validate pointers
Nicholas Nunley (3):
iavf: check for null in iavf_fix_features
iavf: free q_vectors before queues in iavf_disable_vf
iavf: don't clear a lock we don't hold
Piotr Marczak (1):
iavf: Fix failure to exit out from last all-multicast mode
Surabhi Boob (1):
iavf: Fix for the false positive ASQ/ARQ errors while issuing VF reset
drivers/net/ethernet/intel/iavf/iavf.h | 1 +
.../net/ethernet/intel/iavf/iavf_ethtool.c | 30 +++++++---
drivers/net/ethernet/intel/iavf/iavf_main.c | 55 ++++++++++++++-----
3 files changed, 64 insertions(+), 22 deletions(-)
--
2.31.1
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:03:18
From: Nicholas Nunley <redacted>
iavf_free_queues() clears adapter->num_active_queues, which
iavf_free_q_vectors() relies on, so swap the order of these two function
calls in iavf_disable_vf(). This resolves a panic encountered when the
interface is disabled and then later brought up again after PF
communication is restored.
Fixes: 65c7006f234c ("i40evf: assign num_active_queues inside i40evf_alloc_queues")
Signed-off-by: Nicholas Nunley <redacted>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:03:45
From: Piotr Marczak <redacted>
The driver could only quit allmulti when allmulti and promisc modes are
turn on at the same time. If promisc had been off there was no way to turn
off allmulti mode.
The patch corrects this behavior. Switching allmulti does not depends on
promisc state mode anymore
Fixes: f42a5c74da99 ("i40e: Add allmulti support for the VF")
Signed-off-by: Piotr Marczak <redacted>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:04:04
From: Mitch Williams <redacted>
In some cases, the ethtool get_rxfh handler may be called with a null
key or indir parameter. So check these pointers, or you will have a very
bad day.
Fixes: 43a3d9ba34c9 ("i40evf: Allow PF driver to configure RSS")
Signed-off-by: Mitch Williams <redacted>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
@@ -1859,14 +1859,13 @@ static int iavf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,if(hfunc)*hfunc=ETH_RSS_HASH_TOP;-if(!indir)-return0;--memcpy(key,adapter->rss_key,adapter->rss_key_size);+if(key)+memcpy(key,adapter->rss_key,adapter->rss_key_size);-/* Each 32 bits pointed by 'indir' is stored with a lut entry */-for(i=0;i<adapter->rss_lut_size;i++)-indir[i]=(u32)adapter->rss_lut[i];+if(indir)+/* Each 32 bits pointed by 'indir' is stored with a lut entry */+for(i=0;i<adapter->rss_lut_size;i++)+indir[i]=(u32)adapter->rss_lut[i];return0;}
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:04:36
From: Nicholas Nunley <redacted>
If the driver has lost contact with the PF then it enters a disabled state
and frees adapter->vf_res. However, ndo_fix_features can still be called on
the interface, so we need to check for this condition first. Since we have
no information on the features at this time simply leave them unmodified
and return.
Fixes: c4445aedfe09 ("i40evf: Fix VLAN features")
Signed-off-by: Nicholas Nunley <redacted>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:04:45
From: Nicholas Nunley <redacted>
In iavf_configure_clsflower() the function will bail out if it is unable
to obtain the crit_section lock in a reasonable time. However, it will
clear the lock when exiting, so fix this.
Fixes: 640a8af5841f ("i40evf: Reorder configure_clsflower to avoid deadlock on error")
Signed-off-by: Nicholas Nunley <redacted>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:06:23
From: Grzegorz Szczurek <redacted>
Now setting combine to 0 will be rejected with the
appropriate error code.
This has been implemented by adding a condition that checks
the value of combine equal to zero.
Without this patch, when the user requested it, no error was
returned and combine was set to the default value for VF.
Fixes: 5520deb15326 ("iavf: Enable support for up to 16 queues")
Signed-off-by: Grzegorz Szczurek <redacted>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -1787,7 +1787,7 @@ static int iavf_set_channels(struct net_device *netdev,/* All of these should have already been checked by ethtool before this*evengetstous,butjusttobesure.*/-if(num_req>adapter->vsi_res->num_queue_pairs)+if(num_req==0||num_req>adapter->vsi_res->num_queue_pairs)return-EINVAL;if(num_req==adapter->num_active_queues)
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:06:28
From: Akeem G Abodunrin <redacted>
Restore VLAN filters after the link is brought down, and up - since all
filters are deleted from HW during the netdev link down routine.
Fixes: ed1f5b58ea01 ("i40evf: remove VLAN filters on close")
Signed-off-by: Akeem G Abodunrin <redacted>
Tested-by: George Kuruvinakunnel <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf.h | 1 +
drivers/net/ethernet/intel/iavf/iavf_main.c | 35 ++++++++++++++++++---
2 files changed, 31 insertions(+), 5 deletions(-)
@@ -709,8 +726,11 @@ static int iavf_vlan_rx_add_vid(struct net_device *netdev,if(!VLAN_ALLOWED(adapter))return-EIO;+if(iavf_add_vlan(adapter,vid)==NULL)return-ENOMEM;++set_bit(vid,adapter->vsi.active_vlans);return0;}
@@ -725,11 +745,13 @@ static int iavf_vlan_rx_kill_vid(struct net_device *netdev,{structiavf_adapter*adapter=netdev_priv(netdev);-if(VLAN_ALLOWED(adapter)){-iavf_del_vlan(adapter,vid);-return0;-}-return-EIO;+if(!VLAN_ALLOWED(adapter))+return-EIO;++iavf_del_vlan(adapter,vid);+clear_bit(vid,adapter->vsi.active_vlans);++return0;}/**
@@ -3309,6 +3331,9 @@ static int iavf_open(struct net_device *netdev)spin_unlock_bh(&adapter->mac_vlan_list_lock);+/* Restore VLAN filters that were removed with IFF_DOWN */+iavf_restore_filters(adapter);+iavf_configure(adapter);iavf_up_complete(adapter);
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:06:29
From: Mateusz Palczewski <redacted>
Fixed return correct code from set the new channel count.
Implemented by check if reset is done in appropriate time.
This solution give a extra time to pf for reset vf in case
when user want set new channel count for all vfs.
Without this patch it is possible to return misleading output
code to user and vf reset not to be correctly performed by pf.
Fixes: 5520deb15326 ("iavf: Enable support for up to 16 queues")
Signed-off-by: Grzegorz Szczurek <redacted>
Signed-off-by: Mateusz Palczewski <redacted>
Tested-by: Konrad Jankowski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
@@ -1776,6 +1776,7 @@ static int iavf_set_channels(struct net_device *netdev,{structiavf_adapter*adapter=netdev_priv(netdev);u32num_req=ch->combined_count;+inti;if((adapter->vf_res->vf_cap_flags&VIRTCHNL_VF_OFFLOAD_ADQ)&&adapter->num_tc){
@@ -1798,6 +1799,20 @@ static int iavf_set_channels(struct net_device *netdev,adapter->num_req_queues=num_req;adapter->flags|=IAVF_FLAG_REINIT_ITR_NEEDED;iavf_schedule_reset(adapter);++/* wait for the reset is done */+for(i=0;i<IAVF_RESET_WAIT_COMPLETE_COUNT;i++){+msleep(IAVF_RESET_WAIT_MS);+if(adapter->flags&IAVF_FLAG_RESET_PENDING)+continue;+break;+}+if(i==IAVF_RESET_WAIT_COMPLETE_COUNT){+adapter->flags&=~IAVF_FLAG_REINIT_ITR_NEEDED;+adapter->num_active_queues=num_req;+return-EOPNOTSUPP;+}+return0;}
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:06:36
From: Surabhi Boob <redacted>
While issuing VF Reset from the guest OS, the VF driver prints
logs about critical / Overflow error detection. This is not an
actual error since the VF_MBX_ARQLEN register is set to all FF's
for a short period of time and the VF would catch the bits set if
it was reading the register during that spike of time.
This patch introduces an additional check to ignore this condition
since the VF is in reset.
Fixes: 19b73d8efaa4 ("i40evf: Add additional check for reset")
Signed-off-by: Surabhi Boob <redacted>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-11-16 00:06:48
From: Jacob Keller <jacob.e.keller@intel.com>
In iavf_config_clsflower, the filter structure could be accidentally
released at the end, if iavf_parse_cls_flower or iavf_handle_tclass ever
return a non-zero but positive value.
In this case, the function continues through to the end, and will call
kfree() on the filter structure even though it has been added to the
linked list.
This can actually happen because iavf_parse_cls_flower will return
a positive IAVF_ERR_CONFIG value instead of the traditional negative
error codes.
Fix this by ensuring that the kfree() check and error checks are
similar. Use the more idiomatic "if (err)" to catch all non-zero error
codes.
Fixes: 0075fa0fadd0 ("i40evf: Add support to apply cloud filters")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -3108,11 +3108,11 @@ static int iavf_configure_clsflower(struct iavf_adapter *adapter,/* start out with flow type and eth type IPv4 to begin with */filter->f.flow_type=VIRTCHNL_TCP_V4_FLOW;err=iavf_parse_cls_flower(adapter,cls_flower,filter);-if(err<0)+if(err)gotoerr;err=iavf_handle_tclass(adapter,tc,filter);-if(err<0)+if(err)gotoerr;/* add filter to the list */
From: Stefan Assmann <hidden> Date: 2021-11-16 07:07:48
On 2021-11-15 15:59, Tony Nguyen wrote:
quoted hunk
From: Mateusz Palczewski <redacted>
Fixed return correct code from set the new channel count.
Implemented by check if reset is done in appropriate time.
This solution give a extra time to pf for reset vf in case
when user want set new channel count for all vfs.
Without this patch it is possible to return misleading output
code to user and vf reset not to be correctly performed by pf.
Fixes: 5520deb15326 ("iavf: Enable support for up to 16 queues")
Signed-off-by: Grzegorz Szczurek <redacted>
Signed-off-by: Mateusz Palczewski <redacted>
Tested-by: Konrad Jankowski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
@@ -1776,6 +1776,7 @@ static int iavf_set_channels(struct net_device *netdev,{structiavf_adapter*adapter=netdev_priv(netdev);u32num_req=ch->combined_count;+inti;if((adapter->vf_res->vf_cap_flags&VIRTCHNL_VF_OFFLOAD_ADQ)&&adapter->num_tc){
@@ -1798,6 +1799,20 @@ static int iavf_set_channels(struct net_device *netdev,adapter->num_req_queues=num_req;adapter->flags|=IAVF_FLAG_REINIT_ITR_NEEDED;iavf_schedule_reset(adapter);++/* wait for the reset is done */+for(i=0;i<IAVF_RESET_WAIT_COMPLETE_COUNT;i++){+msleep(IAVF_RESET_WAIT_MS);+if(adapter->flags&IAVF_FLAG_RESET_PENDING)+continue;+break;+}+if(i==IAVF_RESET_WAIT_COMPLETE_COUNT){+adapter->flags&=~IAVF_FLAG_REINIT_ITR_NEEDED;+adapter->num_active_queues=num_req;
Hi Mateusz,
I'm not sure I understand why you touch flags and num_active_queues here
even though the reset is still in progress? Shouldn't we just bail out
and report the error?
+ return -EOPNOTSUPP;
Is this really the correct thing to report? Setting the queue count is
supported, the device is just busy, so isn't EAGAIN a better way to
express this?
Stefan
From: Stefan Assmann <hidden> Date: 2021-11-16 07:24:48
On 2021-11-15 15:59, Tony Nguyen wrote:
From: Jacob Keller <jacob.e.keller@intel.com>
In iavf_config_clsflower, the filter structure could be accidentally
released at the end, if iavf_parse_cls_flower or iavf_handle_tclass ever
return a non-zero but positive value.
In this case, the function continues through to the end, and will call
kfree() on the filter structure even though it has been added to the
linked list.
This can actually happen because iavf_parse_cls_flower will return
a positive IAVF_ERR_CONFIG value instead of the traditional negative
error codes.
Hi Jacob,
where exactly does this happen?
Looking at iavf_parse_cls_flower() I see all returns of IAVF_ERR_CONFIG
as "return IAVF_ERR_CONFIG;" while IAVF_ERR_CONFIG is defined as
IAVF_ERR_CONFIG = -4,
I'm not opposed to this change, just wondering what's going on.
Stefan
quoted hunk
Fix this by ensuring that the kfree() check and error checks are
similar. Use the more idiomatic "if (err)" to catch all non-zero error
codes.
Fixes: 0075fa0fadd0 ("i40evf: Add support to apply cloud filters")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -3108,11 +3108,11 @@ static int iavf_configure_clsflower(struct iavf_adapter *adapter,/* start out with flow type and eth type IPv4 to begin with */filter->f.flow_type=VIRTCHNL_TCP_V4_FLOW;err=iavf_parse_cls_flower(adapter,cls_flower,filter);-if(err<0)+if(err)gotoerr;err=iavf_handle_tclass(adapter,tc,filter);-if(err<0)+if(err)gotoerr;/* add filter to the list */
Hello:
This series was applied to netdev/net.git (master)
by Tony Nguyen [off-list ref]:
On Mon, 15 Nov 2021 15:59:24 -0800 you wrote:
This series contains updates to iavf driver only.
Mateusz adds a wait for reset completion when changing queue count which
could otherwise cause issues with VF reset.
Nick adds a null check for vf_res in iavf_fix_features(), corrects
ordering of function calls to resolve dependency issues, and prevents
possible freeing of a lock which isn't being held.
[...]
From: "Keller, Jacob E" <jacob.e.keller@intel.com> Date: 2021-11-16 20:18:19
On 11/15/2021 11:24 PM, Stefan Assmann wrote:
On 2021-11-15 15:59, Tony Nguyen wrote:
quoted
From: Jacob Keller <jacob.e.keller@intel.com>
In iavf_config_clsflower, the filter structure could be accidentally
released at the end, if iavf_parse_cls_flower or iavf_handle_tclass ever
return a non-zero but positive value.
In this case, the function continues through to the end, and will call
kfree() on the filter structure even though it has been added to the
linked list.
This can actually happen because iavf_parse_cls_flower will return
a positive IAVF_ERR_CONFIG value instead of the traditional negative
error codes.
Hi Jacob,
where exactly does this happen?
Looking at iavf_parse_cls_flower() I see all returns of IAVF_ERR_CONFIG
as "return IAVF_ERR_CONFIG;" while IAVF_ERR_CONFIG is defined as
IAVF_ERR_CONFIG = -4,
I'm not opposed to this change, just wondering what's going on.
Stefan
Heh.
I don't have memory of the full context for the original work. We've
been going through and trying to pull in fixes that we've done for our
out-of-tree driver and get everything upstream.
At first I thought this might be because of some history where these
values used to be positive in the out-of-tree history at some point...
But I think this wasn't true. It is possible that some other flow
accidentally sends a positive value, but I've long since lost memory of
if I had an example of that. You're correct that IAVF_ERR_CONFIG is (and
has been in both upstream and out-of-tree code since its inception)
negative.
I don't think this change is harmful, but I think you're right in
pointing out the description isn't really valid.
I'm happy to re-write this commit message for clarity.
I do think switching to "if (err)" is more idiomatic and the correct
thing to do.
Thanks,
Jake
quoted
Fix this by ensuring that the kfree() check and error checks are
similar. Use the more idiomatic "if (err)" to catch all non-zero error
codes.
Fixes: 0075fa0fadd0 ("i40evf: Add support to apply cloud filters")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Tony Brelinski <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/iavf/iavf_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -3108,11 +3108,11 @@ static int iavf_configure_clsflower(struct iavf_adapter *adapter,/* start out with flow type and eth type IPv4 to begin with */filter->f.flow_type=VIRTCHNL_TCP_V4_FLOW;err=iavf_parse_cls_flower(adapter,cls_flower,filter);-if(err<0)+if(err)gotoerr;err=iavf_handle_tclass(adapter,tc,filter);-if(err<0)+if(err)gotoerr;/* add filter to the list */
From: Stefan Assmann <hidden> Date: 2021-11-17 06:37:22
On 2021-11-16 20:18, Keller, Jacob E wrote:
On 11/15/2021 11:24 PM, Stefan Assmann wrote:
quoted
On 2021-11-15 15:59, Tony Nguyen wrote:
quoted
From: Jacob Keller <jacob.e.keller@intel.com>
In iavf_config_clsflower, the filter structure could be accidentally
released at the end, if iavf_parse_cls_flower or iavf_handle_tclass ever
return a non-zero but positive value.
In this case, the function continues through to the end, and will call
kfree() on the filter structure even though it has been added to the
linked list.
This can actually happen because iavf_parse_cls_flower will return
a positive IAVF_ERR_CONFIG value instead of the traditional negative
error codes.
Hi Jacob,
where exactly does this happen?
Looking at iavf_parse_cls_flower() I see all returns of IAVF_ERR_CONFIG
as "return IAVF_ERR_CONFIG;" while IAVF_ERR_CONFIG is defined as
IAVF_ERR_CONFIG = -4,
I'm not opposed to this change, just wondering what's going on.
Stefan
Heh.
I don't have memory of the full context for the original work. We've
been going through and trying to pull in fixes that we've done for our
out-of-tree driver and get everything upstream.
At first I thought this might be because of some history where these
values used to be positive in the out-of-tree history at some point...
But I think this wasn't true. It is possible that some other flow
accidentally sends a positive value, but I've long since lost memory of
if I had an example of that. You're correct that IAVF_ERR_CONFIG is (and
has been in both upstream and out-of-tree code since its inception)
negative.
I don't think this change is harmful, but I think you're right in
pointing out the description isn't really valid.
I'm happy to re-write this commit message for clarity.
I do think switching to "if (err)" is more idiomatic and the correct
thing to do.