bianbu-linux-6.6/drivers/net/ethernet/intel/iavf
Brett Creeley 7e85cf0949 iavf: Fix promiscuous mode configuration flow messages
[ Upstream commit 221465de6bd8090ab61267f019866e8d2dd4ea3d ]

Currently when configuring promiscuous mode on the AVF we detect a
change in the netdev->flags. We use IFF_PROMISC and IFF_ALLMULTI to
determine whether or not we need to request/release promiscuous mode
and/or multicast promiscuous mode. The problem is that the AQ calls for
setting/clearing promiscuous/multicast mode are treated separately. This
leads to a case where we can trigger two promiscuous mode AQ calls in
a row with the incorrect state. To fix this make a few changes.

Use IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE instead of the previous
IAVF_FLAG_AQ_[REQUEST|RELEASE]_[PROMISC|ALLMULTI] flags.

In iavf_set_rx_mode() detect if there is a change in the
netdev->flags in comparison with adapter->flags and set the
IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE aq_required bit. Then in
iavf_process_aq_command() only check for IAVF_FLAG_CONFIGURE_PROMISC_MODE
and call iavf_set_promiscuous() if it's set.

In iavf_set_promiscuous() check again to see which (if any) promiscuous
mode bits have changed when comparing the netdev->flags with the
adapter->flags. Use this to set the flags which get sent to the PF
driver.

Add a spinlock that is used for updating current_netdev_promisc_flags
and only allows one promiscuous mode AQ at a time.

[1] Fixes the fact that we will only have one AQ call in the aq_required
queue at any one time.

[2] Streamlines the change in promiscuous mode to only set one AQ
required bit.

[3] This allows us to keep track of the current state of the flags and
also makes it so we can take the most recent netdev->flags promiscuous
mode state.

[4] This fixes the problem where a change in the netdev->flags can cause
IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE to be set in iavf_set_rx_mode(),
but cleared in iavf_set_promiscuous() before the change is ever made via
AQ call.

Fixes: 47d3483988 ("i40evf: Add driver support for promiscuous mode")
Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:58:55 +01:00
..
iavf.h iavf: Fix promiscuous mode configuration flow messages 2023-11-20 11:58:55 +01:00
iavf_adminq.c iavf: Fix adminq error handling 2022-08-12 08:22:55 -07:00
iavf_adminq.h intel-ethernet: clean up W=1 warnings in kdoc 2020-09-25 16:28:59 -07:00
iavf_adminq_cmd.h iavf: replace i40e variables with iavf 2019-05-31 01:02:53 -07:00
iavf_adv_rss.c iavf: Support for modifying SCTP RSS flow hashing 2021-04-22 09:26:23 -07:00
iavf_adv_rss.h iavf: Support for modifying SCTP RSS flow hashing 2021-04-22 09:26:23 -07:00
iavf_alloc.h iavf: remove some unused functions and pointless wrappers 2023-06-22 09:26:55 -07:00
iavf_client.c virtchnl: fix fake 1-elem arrays for structures allocated as nents 2023-08-16 09:14:14 -07:00
iavf_client.h virtchnl: fix fake 1-elem arrays for structures allocated as nents 2023-08-16 09:14:14 -07:00
iavf_common.c iavf: remove some unused functions and pointless wrappers 2023-06-22 09:26:55 -07:00
iavf_devids.h
iavf_ethtool.c iavf: add iavf_schedule_aq_request() helper 2023-09-15 09:09:08 -07:00
iavf_fdir.c iavf: fix FDIR rule fields masks validation 2023-08-16 08:27:29 -07:00
iavf_fdir.h iavf: fix FDIR rule fields masks validation 2023-08-16 08:27:29 -07:00
iavf_main.c iavf: Fix promiscuous mode configuration flow messages 2023-11-20 11:58:55 +01:00
iavf_osdep.h iavf: remove some unused functions and pointless wrappers 2023-06-22 09:26:55 -07:00
iavf_prototype.h iavf: remove some unused functions and pointless wrappers 2023-06-22 09:26:55 -07:00
iavf_register.h iavf: remove mask from iavf_irq_enable_queues() 2023-06-10 00:09:54 -07:00
iavf_status.h virtchnl: i40e/iavf: rename iwarp to rdma 2023-01-25 08:55:19 -08:00
iavf_trace.h intel-ethernet: clean up W=1 warnings in kdoc 2020-09-25 16:28:59 -07:00
iavf_txrx.c iavf: make functions static where possible 2023-06-22 09:27:08 -07:00
iavf_txrx.h iavf: make functions static where possible 2023-06-22 09:27:08 -07:00
iavf_type.h iavf: clean up packet type lookup table 2021-06-18 09:04:44 -07:00
iavf_virtchnl.c iavf: Fix promiscuous mode configuration flow messages 2023-11-20 11:58:55 +01:00
Makefile iavf: Support for modifying TCP RSS flow hashing 2021-04-22 09:26:23 -07:00