iavf: Create VLAN tag elements starting from the first element
Subsystems (2)
PATCH 1/11 iavf: Create VLAN tag elements starting from the first element
From: Akeem G Abodunrin <[email protected]>
This patch changes how VLAN tag are being populated and programmed into the HW - Instead of start adding VF VLAN tag from the last member of the element list, start from the first member of the list, until number of allowed VLAN tags is exhausted in the HW.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -2
@@ -665,8 +665,7 @@ iavf_vlan_filter *iavf_add_vlan(struct iavf_adapter *adapter, u16 vlan) f->vlan = vlan; -INIT_LIST_HEAD (&f->list); -list_add (&f->list, &adapter->vlan_filter_list); +list_add_tail (&f->list, &adapter->vlan_filter_list); f->add = true; adapter->aq_required |=IAVF_FLAG_AQ_ADD_VLAN_FILTER ; }
Signature · 1 line
2.19.2
PATCH 2/11 iavf: use signed variable
From: Mitch Williams <[email protected]>
The counter variable in iavf_clean_tx_irq starts out negative and climbs to 0. So allocating it as u16 is actually a really bad idea that just happens to work because the value underflows and overflows consistently on most architectures.
Replace the u16 with an int so signed math works as expected.
--- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_txrx.c +1 -1
@@ -190,7 +190,7 @@ void iavf_detect_recover_hung(struct iavf_vsi *vsi)static bool iavf_clean_tx_irq (struct iavf_vsi *vsi,struct iavf_ring *tx_ring,int napi_budget) { -u16 i = tx_ring->next_to_clean; +int i = tx_ring->next_to_clean;struct iavf_tx_buffer *tx_buf;struct iavf_tx_desc *tx_desc;unsigned int total_bytes =0 , total_packets =0 ;
Signature · 1 line
2.19.2
Bowers
PATCH 2/11 iavf: use signed variable
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S5 iavf 02/11] iavf: use signed variableFrom: Mitch Williams <[email protected]>
The counter variable in
iavf_clean_tx_irqstarts out negative and climbs to 0. So allocating it as u16 is actually a really bad idea that just happens to work because the value underflows and overflows consistently on most architectures.
Quoted 6 lines
Replace the u16 with an int so signed math works as expected.
Signed-off-by Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 3/11 iavf: wait longer for close to complete
In reply to Alice MichaelFrom: Mitch Williams <[email protected]>
On some hardware/driver/architecture combinations, it may take longer than 200msec for all close operations to be completed, causing a spurious error message to be logged.
Increase the timeout value to 500msec to avoid this erroneous error.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -3021,7 +3021,7 @@ static int iavf_close(struct net_device *netdev) status =wait_event_timeout (adapter->down_waitqueue, adapter->state == __IAVF_DOWN, -msecs_to_jiffies (200 )); +msecs_to_jiffies (500 ));if (!status)netdev_warn (netdev,"Device resources not yet released\n" );return 0 ;
Signature · 1 line
2.19.2
Bowers
PATCH 3/11 iavf: wait longer for close to complete
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S5 iavf 03/11] iavf: wait longer for close to completeFrom: Mitch Williams <[email protected]>
On some hardware/driver/architecture combinations, it may take longer than 200msec for all close operations to be completed, causing a spurious error message to be logged.
Quoted 6 lines
Increase the timeout value to 500msec to avoid this erroneous error.
Signed-off-by Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 4/11 iavf: Change GFP_KERNEL to GFP_ATOMIC in kzalloc()
In reply to Alice MichaelFrom: Aleksandr Loktionov <[email protected]>
iavf_add_vlan() is being called in atomic context so kzalloc() needs GFP_ATOMIC. This patch fixes it.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -659,7 +659,7 @@ iavf_vlan_filter *iavf_add_vlan(struct iavf_adapter *adapter, u16 vlan) f =iavf_find_vlan (adapter, vlan);if (!f) { - f =kzalloc (sizeof (*f),GFP_KERNEL ); + f =kzalloc (sizeof (*f),GFP_ATOMIC );if (!f) goto clearout;
Signature · 1 line
2.19.2
Loktionov
PATCH 4/11 iavf: Change GFP_KERNEL to GFP_ATOMIC in kzalloc()
ACK
-----Original Message-----
From: Michael, Alice
Sent: Tuesday, May 14, 2019 7:37 PM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Loktionov, Aleksandr <[email protected]>
Subject: [next PATCH S5 iavf 04/11] iavf: Change GFP_KERNEL to GFP_ATOMIC in kzalloc()
From: Aleksandr Loktionov <[email protected]>
iavf_add_vlan() is being called in atomic context so kzalloc() needs GFP_ATOMIC. This patch fixes it.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
@@ -659,7 +659,7 @@ iavf_vlan_filter *iavf_add_vlan(struct iavf_adapter *adapter, u16 vlan) f =iavf_find_vlan (adapter, vlan);if (!f) { - f =kzalloc (sizeof (*f),GFP_KERNEL ); + f =kzalloc (sizeof (*f),GFP_ATOMIC );if (!f) goto clearout;
--
2.19.2
--------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
Bowers
PATCH 4/11 iavf: Change GFP_KERNEL to GFP_ATOMIC in kzalloc()
In reply to Alice MichaelQuoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Loktionov, Aleksandr <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S5 iavf 04/11] iavf: ChangeGFP_KERNELtoGFP_ATOMICinkzalloc()From: Aleksandr Loktionov <[email protected]>
Quoted 7 lines
iavf_add_vlan()is being called in atomic context sokzalloc()needsGFP_ATOMIC. This patch fixes it.Signed-off-by Aleksandr Loktionov <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 5/11 iavf: Fix the math for valid length for ADq enable
In reply to Alice MichaelFrom: Avinash Dayanand <[email protected]>
There was a calculation error in virtchnl regarding the valid length which was fixed recently and a corresponding change needs to go into the code while we enable ADq.
--- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +1 -1
@@ -983,7 +983,7 @@ void iavf_enable_channels(struct iavf_adapter *adapter)return ; } - len = (adapter->num_tc *sizeof (struct virtchnl_channel_info )) + + len = ((adapter->num_tc -1 ) *sizeof (struct virtchnl_channel_info )) +sizeof (struct virtchnl_tc_info ); vti =kzalloc (len,GFP_KERNEL );
Signature · 1 line
2.19.2
Bowers
PATCH 5/11 iavf: Fix the math for valid length for ADq enable
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S5 iavf 05/11] iavf: Fix the math for valid length for ADq enableFrom: Avinash Dayanand <[email protected]>
Quoted 8 lines
There was a calculation error in virtchnl regarding the valid length which was fixed recently and a corresponding change needs to go into the code while we enable ADq.
Signed-off-by Avinash Dayanand <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 6/11 iavf: Move commands processing to the separate function
In reply to Alice MichaelFrom: Jakub Pawlak <[email protected]>
Move the commands processing outside the watchdog_task() function. This reduce length and complexity of the function which is mainly designed to process the watchdog state machine.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 197 +++++++++++--------- 1 file changed, 105 insertions(+), 92 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +105 -92
@@ -1546,123 +1546,66 @@ static void iavf_watchdog_timer(struct timer_list *t) }/** -* iavf_watchdog_task - Periodic call-back task -* @work: pointer to work_struct +* iavf_process_aq_command - process aq_required flags +* and sends aq command +* @adapter: pointer to iavf adapter structure +* +* Returns 0 on success +* Returns error code if no command was sent +* or error code if the command failed. **/ -static void iavf_watchdog_task (struct work_struct *work) +static int iavf_process_aq_command (struct iavf_adapter *adapter) { -struct iavf_adapter *adapter =container_of (work, - struct iavf_adapter, - watchdog_task); -struct iavf_hw *hw = &adapter->hw; -u32 reg_val; - -if (test_and_set_bit (__IAVF_IN_CRITICAL_TASK, &adapter->crit_section)) - goto restart_watchdog; - -if (adapter->flags &IAVF_FLAG_PF_COMMS_FAILED ) { - reg_val =rd32 (hw,IAVF_VFGEN_RSTAT ) & -IAVF_VFGEN_RSTAT_VFR_STATE_MASK ; -if ((reg_val ==VIRTCHNL_VFR_VFACTIVE ) || - (reg_val ==VIRTCHNL_VFR_COMPLETED )) { -/* A chance for redemption! */ -dev_err (&adapter->pdev->dev,"Hardware came out of reset. Attempting reinit.\n" ); - adapter->state = __IAVF_STARTUP; - adapter->flags &= ~IAVF_FLAG_PF_COMMS_FAILED ; -schedule_delayed_work (&adapter->init_task,10 ); -clear_bit (__IAVF_IN_CRITICAL_TASK, - &adapter->crit_section); -/* Don't reschedule the watchdog, since we've restarted -* the init task. When init_task contacts the PF and -* gets everything set up again, it'll restart the -* watchdog for us. Down, boy. Sit. Stay. Woof. -*/ -return ; - } - adapter->aq_required =0 ; - adapter->current_op =VIRTCHNL_OP_UNKNOWN ; - goto watchdog_done; - } - -if ((adapter->state < __IAVF_DOWN) || - (adapter->flags &IAVF_FLAG_RESET_PENDING )) - goto watchdog_done; - -/* check for reset */ - reg_val =rd32 (hw,IAVF_VF_ARQLEN1 ) &IAVF_VF_ARQLEN1_ARQENABLE_MASK ; -if (!(adapter->flags &IAVF_FLAG_RESET_PENDING ) && !reg_val) { - adapter->state = __IAVF_RESETTING; - adapter->flags |=IAVF_FLAG_RESET_PENDING ; -dev_err (&adapter->pdev->dev,"Hardware reset detected\n" ); -schedule_work (&adapter->reset_task); - adapter->aq_required =0 ; - adapter->current_op =VIRTCHNL_OP_UNKNOWN ; - goto watchdog_done; - } - -/* Process admin queue tasks. After init, everything gets done -* here so we don't race on the admin queue. -*/ -if (adapter->current_op) { -if (!iavf_asq_done (hw)) { -dev_dbg (&adapter->pdev->dev,"Admin queue timeout\n" ); -iavf_send_api_ver (adapter); - } - goto watchdog_done; - } -if (adapter->aq_required &IAVF_FLAG_AQ_GET_CONFIG ) { -iavf_send_vf_config_msg (adapter); - goto watchdog_done; - } - +if (adapter->aq_required &IAVF_FLAG_AQ_GET_CONFIG ) +return iavf_send_vf_config_msg (adapter);if (adapter->aq_required &IAVF_FLAG_AQ_DISABLE_QUEUES ) {iavf_disable_queues (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_MAP_VECTORS ) {iavf_map_queues (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_ADD_MAC_FILTER ) {iavf_add_ether_addrs (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_ADD_VLAN_FILTER ) {iavf_add_vlans (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_DEL_MAC_FILTER ) {iavf_del_ether_addrs (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_DEL_VLAN_FILTER ) {iavf_del_vlans (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING ) {iavf_enable_vlan_stripping (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPING ) {iavf_disable_vlan_stripping (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_CONFIGURE_QUEUES ) {iavf_configure_queues (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_ENABLE_QUEUES ) {iavf_enable_queues (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_CONFIGURE_RSS ) {
@@ -1670,68 +1613,138 @@ static void iavf_watchdog_task(struct work_struct *work)* PF, so we don't have to set current_op as we will * not get a response through the ARQ. */ -iavf_init_rss (adapter); adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_RSS ; - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_GET_HENA ) {iavf_get_hena (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_SET_HENA ) {iavf_set_hena (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_SET_RSS_KEY ) {iavf_set_rss_key (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_SET_RSS_LUT ) {iavf_set_rss_lut (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_REQUEST_PROMISC ) {iavf_set_promiscuous (adapter,FLAG_VF_UNICAST_PROMISC |FLAG_VF_MULTICAST_PROMISC ); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_REQUEST_ALLMULTI ) {iavf_set_promiscuous (adapter,FLAG_VF_MULTICAST_PROMISC ); - goto watchdog_done; +return 0 ; }if ((adapter->aq_required &IAVF_FLAG_AQ_RELEASE_PROMISC ) && (adapter->aq_required &IAVF_FLAG_AQ_RELEASE_ALLMULTI )) {iavf_set_promiscuous (adapter,0 ); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_ENABLE_CHANNELS ) {iavf_enable_channels (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_DISABLE_CHANNELS ) {iavf_disable_channels (adapter); - goto watchdog_done; +return 0 ; } -if (adapter->aq_required &IAVF_FLAG_AQ_ADD_CLOUD_FILTER ) {iavf_add_cloud_filter (adapter); - goto watchdog_done; +return 0 ; }if (adapter->aq_required &IAVF_FLAG_AQ_DEL_CLOUD_FILTER ) {iavf_del_cloud_filter (adapter); +return 0 ; + } + +return -EAGAIN ; +} + +/** +* iavf_watchdog_task - Periodic call-back task +* @work: pointer to work_struct +**/ +static void iavf_watchdog_task (struct work_struct *work) +{ +struct iavf_adapter *adapter =container_of (work, + struct iavf_adapter, + watchdog_task); +struct iavf_hw *hw = &adapter->hw; +u32 reg_val; + +if (test_and_set_bit (__IAVF_IN_CRITICAL_TASK, &adapter->crit_section)) + goto restart_watchdog; + +if (adapter->flags &IAVF_FLAG_PF_COMMS_FAILED ) { + reg_val =rd32 (hw,IAVF_VFGEN_RSTAT ) & +IAVF_VFGEN_RSTAT_VFR_STATE_MASK ; +if (reg_val ==VIRTCHNL_VFR_VFACTIVE || + reg_val ==VIRTCHNL_VFR_COMPLETED ) { +/* A chance for redemption! */ +dev_err (&adapter->pdev->dev,"Hardware came out of reset. Attemptingreinit.\n" ); + adapter->state = __IAVF_STARTUP; + adapter->flags &= ~IAVF_FLAG_PF_COMMS_FAILED ; +schedule_delayed_work (&adapter->init_task,10 ); +clear_bit (__IAVF_IN_CRITICAL_TASK, + &adapter->crit_section); +/* Don't reschedule the watchdog, since we've restarted +* the init task. When init_task contacts the PF and +* gets everything set up again, it'll restart the +* watchdog for us. Down, boy. Sit. Stay. Woof. +*/ +return ; + } + adapter->aq_required =0 ; + adapter->current_op =VIRTCHNL_OP_UNKNOWN ; goto watchdog_done; } -schedule_delayed_work (&adapter->client_task,msecs_to_jiffies (5 )); +if (adapter->state < __IAVF_DOWN || + (adapter->flags &IAVF_FLAG_RESET_PENDING )) + goto watchdog_done; -if (adapter->state == __IAVF_RUNNING) +/* check for reset */ + reg_val =rd32 (hw,IAVF_VF_ARQLEN1 ) &IAVF_VF_ARQLEN1_ARQENABLE_MASK ; +if (!(adapter->flags &IAVF_FLAG_RESET_PENDING ) && !reg_val) { + adapter->state = __IAVF_RESETTING; + adapter->flags |=IAVF_FLAG_RESET_PENDING ; +dev_err (&adapter->pdev->dev,"Hardware reset detected\n" ); +schedule_work (&adapter->reset_task); + adapter->aq_required =0 ; + adapter->current_op =VIRTCHNL_OP_UNKNOWN ; + goto watchdog_done; + } + +/* Process admin queue tasks. After init, everything gets done +* here so we don't race on the admin queue. +* The check is made against -EAGAIN, as it's the error code that +* would be returned on no op to run. Failures of called functions +* return other values. +*/ +if (adapter->current_op) { +if (!iavf_asq_done (hw)) { +dev_dbg (&adapter->pdev->dev,"Admin queue timeout\n" ); +iavf_send_api_ver (adapter); + } + }else if (iavf_process_aq_command (adapter) == -EAGAIN && + adapter->state == __IAVF_RUNNING) {iavf_request_stats (adapter); + } + +schedule_delayed_work (&adapter->client_task,msecs_to_jiffies (5 )); + watchdog_done:if (adapter->state == __IAVF_RUNNING)iavf_detect_recover_hung (&adapter->vsi);
Signature · 1 line
2.19.2
Bowers
PATCH 6/11 iavf: Move commands processing to the separate function
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Pawlak, Jakub <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S5 iavf 06/11] iavf: Move commands processing to the separate functionFrom: Jakub Pawlak <[email protected]>
Quoted 8 lines
Move the commands processing outside the
watchdog_task()function. This reduce length and complexity of the function which is mainly designed to process the watchdog state machine.Signed-off-by Jakub Pawlak <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_main.c | 197 +++++++++++--------- 1 file changed, 105 insertions(+), 92 deletions(-)
PATCH 7/11 iavf: Remove timer for work triggering, use delaying work instead
In reply to Alice MichaelFrom: Jakub Pawlak <[email protected]>
Remove the watchdog timer, instead declare watchdog task as delayed work and use dedicated workqueue to service driver tasks. The dedicated driver workqueue iavf_wq is common for all driver instances.
--- drivers/net/ethernet/intel/iavf/iavf.h | 4 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 4 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 66 ++++++++----------- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 2 +- 4 files changed, 31 insertions(+), 45 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +2 -2
@@ -216,7 +216,6 @@ struct iavf_cloud_filter {/* board specific private data structure */ struct iavf_adapter { -struct timer_list watchdog_timer;struct work_struct reset_task;struct work_struct adminq_task;struct delayed_work client_task;
@@ -303,7 +302,7 @@ struct iavf_adapter {enum iavf_state_t state;unsigned long crit_section; -struct work_struct watchdog_task; +struct delayed_work watchdog_task;bool netdev_registered;bool link_up;enum virtchnl_link_speed link_speed;
@@ -359,6 +358,7 @@ struct iavf_device {/* needed by iavf_ethtool.c */ extern char iavf_driver_name[];extern const char iavf_driver_version[]; +extern struct workqueue_struct *iavf_wq;int iavf_up (struct iavf_adapter *adapter);void iavf_down (struct iavf_adapter *adapter);
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +2 -2
@@ -510,7 +510,7 @@ static int iavf_set_priv_flags(struct net_device *netdev, u32 flags)if (changed_flags &IAVF_FLAG_LEGACY_RX ) {if (netif_running (netdev)) { adapter->flags |=IAVF_FLAG_RESET_NEEDED ; -schedule_work (&adapter->reset_task); +queue_work (iavf_wq, &adapter->reset_task); } }
@@ -622,7 +622,7 @@ static int iavf_set_ringparam(struct net_device *netdev,if (netif_running (netdev)) { adapter->flags |=IAVF_FLAG_RESET_NEEDED ; -schedule_work (&adapter->reset_task); +queue_work (iavf_wq, &adapter->reset_task); }return 0 ;
drivers/net/ethernet/intel/iavf/iavf_main.c +26 -40
190 lines not on this page · raw message
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +1 -1
@@ -1238,7 +1238,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,if (!(adapter->flags &IAVF_FLAG_RESET_PENDING )) { adapter->flags |=IAVF_FLAG_RESET_PENDING ;dev_info (&adapter->pdev->dev,"Scheduling reset task\n" ); -schedule_work (&adapter->reset_task); +queue_work (iavf_wq, &adapter->reset_task); }break ;default :
Signature · 1 line
2.19.2
Bowers
PATCH 7/11 iavf: Remove timer for work triggering, use delaying work instead
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Pawlak, Jakub <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S5 iavf 07/11] iavf: Remove timer for work triggering, use delaying work insteadFrom: Jakub Pawlak <[email protected]>
Remove the watchdog timer, instead declare watchdog task as delayed work and use dedicated workqueue to service driver tasks. The dedicated driver workqueue
iavf_wqis common for all driver instances.
Quoted 7 lines
Signed-off-by Jakub Pawlak <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf.h | 4 +- .../net/ethernet/intel/iavf/iavf_ethtool.c | 4 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 66 ++++++++----------- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 2 +- 4 files changed, 31 insertions(+), 45 deletions(-)
PATCH 8/11 iavf: Refactor the watchdog state machine
In reply to Alice MichaelFrom: Jan Sokolowski <[email protected]>
Refactor the watchdog state machine implementation. Add the additional state __IAVF_COMM_FAILED to process the PF communication fails. Prepare the watchdog state machine to integrate with init state machine.
--- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 73 ++++++++++++--------- 2 files changed, 44 insertions(+), 30 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -0
@@ -171,6 +171,7 @@ enum iavf_state_t { __IAVF_INIT_GET_RESOURCES,/* aq msg sent, awaiting reply */ __IAVF_INIT_SW,/* got resources, setting up structs */ __IAVF_RESETTING,/* in reset */ + __IAVF_COMM_FAILED,/* communication with PF failed */ /* Below here, watchdog is running */ __IAVF_DOWN,/* ready, can be opened */ __IAVF_DOWN_PENDING, /* descending, waiting for watchdog */
drivers/net/ethernet/intel/iavf/iavf_main.c +43 -30
106 lines not on this page · raw message
Signature · 1 line
2.19.2
Bowers
PATCH 8/11 iavf: Refactor the watchdog state machine
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Pawlak, Jakub <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S5 iavf 08/11] iavf: Refactor the watchdog state machineFrom: Jan Sokolowski <[email protected]>
Refactor the watchdog state machine implementation.
Add the additional state__IAVF_COMM_FAILEDto process the PF communication fails. Prepare the watchdog state machine to integrate with init state machine.
Quoted 5 lines
Signed-off-by Jakub Pawlak <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 73 ++++++++++++--------- 2 files changed, 44 insertions(+), 30 deletions(-)
PATCH 9/11 iavf: Refactor init state machine
In reply to Alice MichaelFrom: Jakub Pawlak <[email protected]>
Cleanup of init state machine, move state specific code to separate functions and rewrite the iavf_init_task() function.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 447 ++++++++++++-------- 1 file changed, 259 insertions(+), 188 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +259 -188
@@ -14,6 +14,8 @@static int iavf_setup_all_tx_resources (struct iavf_adapter *adapter);static int iavf_setup_all_rx_resources (struct iavf_adapter *adapter);static int iavf_close (struct net_device *netdev); +static int iavf_init_get_resources (struct iavf_adapter *adapter); +static int iavf_check_reset_complete (struct iavf_hw *hw);char iavf_driver_name[] ="iavf" ; static const char iavf_driver_string[] =
@@ -57,6 +59,7 @@ MODULE_DESCRIPTION("Intel(R) Ethernet Adaptive Virtual Function Network Driver")MODULE_LICENSE ("GPL v2" );MODULE_VERSION (DRV_VERSION ); +static const struct net_device_ops iavf_netdev_ops;struct workqueue_struct *iavf_wq;/**
@@ -1659,6 +1662,249 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)return -EAGAIN ; } +/** +* iavf_startup - first step of driver startup +* @adapter: board private structure +* +* Function process __IAVF_STARTUP driver state. +* When success the state is changed to __IAVF_INIT_VERSION_CHECK +* when fails it returns -EAGAIN +**/ +static int iavf_startup (struct iavf_adapter *adapter) +{ +struct pci_dev *pdev = adapter->pdev; +struct iavf_hw *hw = &adapter->hw; +int err; + +WARN_ON (adapter->state != __IAVF_STARTUP); + +/* driver loaded, probe complete */ + adapter->flags &= ~IAVF_FLAG_PF_COMMS_FAILED ; + adapter->flags &= ~IAVF_FLAG_RESET_PENDING ; + err =iavf_set_mac_type (hw); +if (err) { +dev_err (&pdev->dev,"Failed to set MAC type (%d)\n" , err); + goto err; + } + + err =iavf_check_reset_complete (hw); +if (err) { +dev_info (&pdev->dev,"Device is still in reset (%d), retrying\n" , + err); + goto err; + } + hw->aq.num_arq_entries =IAVF_AQ_LEN ; + hw->aq.num_asq_entries =IAVF_AQ_LEN ; + hw->aq.arq_buf_size =IAVF_MAX_AQ_BUF_SIZE ; + hw->aq.asq_buf_size =IAVF_MAX_AQ_BUF_SIZE ; + + err =iavf_init_adminq (hw); +if (err) { +dev_err (&pdev->dev,"Failed to init Admin Queue (%d)\n" , err); + goto err; + } + err =iavf_send_api_ver (adapter); +if (err) { +dev_err (&pdev->dev,"Unable to send to PF (%d)\n" , err); +iavf_shutdown_adminq (hw); + goto err; + } + adapter->state = __IAVF_INIT_VERSION_CHECK; +err: +return err; +} + +/** +* iavf_init_version_check - second step of driver startup +* @adapter: board private structure +* +* Function process __IAVF_INIT_VERSION_CHECK driver state. +* When success the state is changed to __IAVF_INIT_GET_RESOURCES +* when fails it returns -EAGAIN +**/ +static int iavf_init_version_check (struct iavf_adapter *adapter) +{ +struct iavf_hw *hw = &adapter->hw; +struct pci_dev *pdev = adapter->pdev; +int err = -EAGAIN ; + +WARN_ON (adapter->state != __IAVF_INIT_VERSION_CHECK); + +if (!iavf_asq_done (hw)) { +dev_err (&pdev->dev,"Admin queue command never completed\n" ); +iavf_shutdown_adminq (hw); + adapter->state = __IAVF_STARTUP; + goto err; + } + +/* aq msg sent, awaiting reply */ + err =iavf_verify_api_ver (adapter); +if (err) { +if (err ==IAVF_ERR_ADMIN_QUEUE_NO_WORK ) + err =iavf_send_api_ver (adapter); +else +dev_err (&pdev->dev,"Unsupported PF API version %d.%d, expected %d.%d\n" , + adapter->pf_version.major, + adapter->pf_version.minor, +VIRTCHNL_VERSION_MAJOR , +VIRTCHNL_VERSION_MINOR ); + goto err; + } + err =iavf_send_vf_config_msg (adapter); +if (err) { +dev_err (&pdev->dev,"Unable to send config request (%d)\n" , + err); + goto err; + } + adapter->state = __IAVF_INIT_GET_RESOURCES; + +err: +return err; +} + +/** +* iavf_init_get_resources - third step of driver startup +* @adapter: board private structure +* +* Function process __IAVF_INIT_GET_RESOURCES driver state and +* finishes driver initialization procedure. +* When success the state is changed to __IAVF_DOWN +* when fails it returns -EAGAIN +**/ +static int iavf_init_get_resources (struct iavf_adapter *adapter) +{ +struct net_device *netdev = adapter->netdev; +struct iavf_hw *hw = &adapter->hw; +struct pci_dev *pdev = adapter->pdev; +int err =0 , bufsz; + +WARN_ON (adapter->state != __IAVF_INIT_GET_RESOURCES); +/* aq msg sent, awaiting reply */ +if (!adapter->vf_res) { + bufsz =sizeof (struct virtchnl_vf_resource ) + + (IAVF_MAX_VF_VSI * +sizeof (struct virtchnl_vsi_resource )); + adapter->vf_res =kzalloc (bufsz,GFP_KERNEL ); +if (!adapter->vf_res) + goto err; + } + err =iavf_get_vf_config (adapter); +if (err ==IAVF_ERR_ADMIN_QUEUE_NO_WORK ) { + err =iavf_send_vf_config_msg (adapter); + goto err; + }else if (err ==IAVF_ERR_PARAM ) { +/* We only get ERR_PARAM if the device is in a very bad +* state or if we've been disabled for previous bad +* behavior. Either way, we're done now. +*/ +iavf_shutdown_adminq (hw); +dev_err (&pdev->dev,"Unable to get VF config due to PF error condition, not retrying\n" ); +return 0 ; + } +if (err) { +dev_err (&pdev->dev,"Unable to get VF config (%d)\n" , err); + goto err_alloc; + } + +if (iavf_process_config (adapter)) + goto err_alloc; + adapter->current_op =VIRTCHNL_OP_UNKNOWN ; + + adapter->flags |=IAVF_FLAG_RX_CSUM_ENABLED ; + + netdev->netdev_ops = &iavf_netdev_ops; +iavf_set_ethtool_ops (netdev); + netdev->watchdog_timeo =5 *HZ ; + +/* MTU range: 68 - 9710 */ + netdev->min_mtu =ETH_MIN_MTU ; + netdev->max_mtu =IAVF_MAX_RXBUFFER -IAVF_PACKET_HDR_PAD ; + +if (!is_valid_ether_addr (adapter->hw.mac.addr)) { +dev_info (&pdev->dev,"Invalid MAC address %pM, using random\n" , + adapter->hw.mac.addr); +eth_hw_addr_random (netdev); +ether_addr_copy (adapter->hw.mac.addr, netdev->dev_addr); + }else { + adapter->flags |=IAVF_FLAG_ADDR_SET_BY_PF ; +ether_addr_copy (netdev->dev_addr, adapter->hw.mac.addr); +ether_addr_copy (netdev->perm_addr, adapter->hw.mac.addr); + } + + adapter->tx_desc_count =IAVF_DEFAULT_TXD ; + adapter->rx_desc_count =IAVF_DEFAULT_RXD ; + err =iavf_init_interrupt_scheme (adapter); +if (err) + goto err_sw_init; +iavf_map_rings_to_vectors (adapter); +if (adapter->vf_res->vf_cap_flags & +VIRTCHNL_VF_OFFLOAD_WB_ON_ITR ) + adapter->flags |=IAVF_FLAG_WB_ON_ITR_CAPABLE ; + + err =iavf_request_misc_irq (adapter); +if (err) + goto err_sw_init; + +netif_carrier_off (netdev); + adapter->link_up = false; + +/* set the semaphore to prevent any callbacks after device registration +* up to time when state of driver will be set to __IAVF_DOWN +*/ +rtnl_lock (); +if (!adapter->netdev_registered) { + err =register_netdevice (netdev); +if (err) { +rtnl_unlock (); + goto err_register; + } + } + + adapter->netdev_registered = true; + +netif_tx_stop_all_queues (netdev); +if (CLIENT_ALLOWED (adapter)) { + err =iavf_lan_add_device (adapter); +if (err) { +rtnl_unlock (); +dev_info (&pdev->dev,"Failed to add VF to client API service list: %d\n" , + err); + } + } +dev_info (&pdev->dev,"MAC address: %pM\n" , adapter->hw.mac.addr); +if (netdev->features &NETIF_F_GRO ) +dev_info (&pdev->dev,"GRO is enabled\n" ); + + adapter->state = __IAVF_DOWN; +set_bit (__IAVF_VSI_DOWN, adapter->vsi.state); +rtnl_unlock (); + +iavf_misc_irq_enable (adapter); +wake_up (&adapter->down_waitqueue); + + adapter->rss_key =kzalloc (adapter->rss_key_size,GFP_KERNEL ); + adapter->rss_lut =kzalloc (adapter->rss_lut_size,GFP_KERNEL ); +if (!adapter->rss_key || !adapter->rss_lut) + goto err_mem; +if (RSS_AQ (adapter)) + adapter->aq_required |=IAVF_FLAG_AQ_CONFIGURE_RSS ; +else +iavf_init_rss (adapter); + +return err; +err_mem: +iavf_free_rss (adapter); +err_register: +iavf_free_misc_irq (adapter); +err_sw_init: +iavf_reset_interrupt_capability (adapter); +err_alloc: +kfree (adapter->vf_res); + adapter->vf_res =NULL ; +err: +return err; +} +/** * iavf_watchdog_task - Periodic call-back task * @work: pointer to work_struct
@@ -3364,207 +3610,32 @@ static void iavf_init_task(struct work_struct *work)struct iavf_adapter *adapter =container_of (work, struct iavf_adapter, init_task.work); -struct net_device *netdev = adapter->netdev;struct iavf_hw *hw = &adapter->hw; -struct pci_dev *pdev = adapter->pdev; -int err;switch (adapter->state) {case __IAVF_STARTUP: -/* driver loaded, probe complete */ - adapter->flags &= ~IAVF_FLAG_PF_COMMS_FAILED ; - adapter->flags &= ~IAVF_FLAG_RESET_PENDING ; - err =iavf_set_mac_type (hw); -if (err) { -dev_err (&pdev->dev,"Failed to set MAC type (%d)\n" , - err); - goto err; - } - err =iavf_check_reset_complete (hw); -if (err) { -dev_info (&pdev->dev,"Device is still in reset (%d), retrying\n" , - err); - goto err; - } - hw->aq.num_arq_entries =IAVF_AQ_LEN ; - hw->aq.num_asq_entries =IAVF_AQ_LEN ; - hw->aq.arq_buf_size =IAVF_MAX_AQ_BUF_SIZE ; - hw->aq.asq_buf_size =IAVF_MAX_AQ_BUF_SIZE ; - - err =iavf_init_adminq (hw); -if (err) { -dev_err (&pdev->dev,"Failed to init Admin Queue (%d)\n" , - err); - goto err; - } - err =iavf_send_api_ver (adapter); -if (err) { -dev_err (&pdev->dev,"Unable to send to PF (%d)\n" , err); -iavf_shutdown_adminq (hw); - goto err; - } - adapter->state = __IAVF_INIT_VERSION_CHECK; - goto restart; +if (iavf_startup (adapter) <0 ) + goto init_failed; +break ;case __IAVF_INIT_VERSION_CHECK: -if (!iavf_asq_done (hw)) { -dev_err (&pdev->dev,"Admin queue command never completed\n" ); -iavf_shutdown_adminq (hw); - adapter->state = __IAVF_STARTUP; - goto err; - } - -/* aq msg sent, awaiting reply */ - err =iavf_verify_api_ver (adapter); -if (err) { -if (err ==IAVF_ERR_ADMIN_QUEUE_NO_WORK ) - err =iavf_send_api_ver (adapter); -else -dev_err (&pdev->dev,"Unsupported PF API version %d.%d, expected %d.%d\n" , - adapter->pf_version.major, - adapter->pf_version.minor, -VIRTCHNL_VERSION_MAJOR , -VIRTCHNL_VERSION_MINOR ); - goto err; - } - err =iavf_send_vf_config_msg (adapter); -if (err) { -dev_err (&pdev->dev,"Unable to send config request (%d)\n" , - err); - goto err; - } - adapter->state = __IAVF_INIT_GET_RESOURCES; - goto restart; -case __IAVF_INIT_GET_RESOURCES: -/* aq msg sent, awaiting reply */ -if (!adapter->vf_res) { - adapter->vf_res =kzalloc (struct_size (adapter->vf_res, - vsi_res,IAVF_MAX_VF_VSI ), -GFP_KERNEL ); -if (!adapter->vf_res) - goto err; - } - err =iavf_get_vf_config (adapter); -if (err ==IAVF_ERR_ADMIN_QUEUE_NO_WORK ) { - err =iavf_send_vf_config_msg (adapter); - goto err; - }else if (err ==IAVF_ERR_PARAM ) { -/* We only get ERR_PARAM if the device is in a very bad -* state or if we've been disabled for previous bad -* behavior. Either way, we're done now. -*/ -iavf_shutdown_adminq (hw); -dev_err (&pdev->dev,"Unable to get VF config due to PF error condition, not retrying\n" ); -return ; - } -if (err) { -dev_err (&pdev->dev,"Unable to get VF config (%d)\n" , - err); - goto err_alloc; - } - adapter->state = __IAVF_INIT_SW; +if (iavf_init_version_check (adapter) <0 ) + goto init_failed;break ; +case __IAVF_INIT_GET_RESOURCES: +if (iavf_init_get_resources (adapter) <0 ) + goto init_failed; +return ;default : - goto err_alloc; + goto init_failed; } -if (iavf_process_config (adapter)) - goto err_alloc; - adapter->current_op =VIRTCHNL_OP_UNKNOWN ; - - adapter->flags |=IAVF_FLAG_RX_CSUM_ENABLED ; - - netdev->netdev_ops = &iavf_netdev_ops; -iavf_set_ethtool_ops (netdev); - netdev->watchdog_timeo =5 *HZ ; - -/* MTU range: 68 - 9710 */ - netdev->min_mtu =ETH_MIN_MTU ; - netdev->max_mtu =IAVF_MAX_RXBUFFER -IAVF_PACKET_HDR_PAD ; - -if (!is_valid_ether_addr (adapter->hw.mac.addr)) { -dev_info (&pdev->dev,"Invalid MAC address %pM, using random\n" , - adapter->hw.mac.addr); -eth_hw_addr_random (netdev); -ether_addr_copy (adapter->hw.mac.addr, netdev->dev_addr); - }else { - adapter->flags |=IAVF_FLAG_ADDR_SET_BY_PF ; -ether_addr_copy (netdev->dev_addr, adapter->hw.mac.addr); -ether_addr_copy (netdev->perm_addr, adapter->hw.mac.addr); - } - -queue_delayed_work (iavf_wq, &adapter->watchdog_task,1 ); - - adapter->tx_desc_count =IAVF_DEFAULT_TXD ; - adapter->rx_desc_count =IAVF_DEFAULT_RXD ; - err =iavf_init_interrupt_scheme (adapter); -if (err) - goto err_sw_init; -iavf_map_rings_to_vectors (adapter); -if (adapter->vf_res->vf_cap_flags & -VIRTCHNL_VF_OFFLOAD_WB_ON_ITR ) - adapter->flags |=IAVF_FLAG_WB_ON_ITR_CAPABLE ; - - err =iavf_request_misc_irq (adapter); -if (err) - goto err_sw_init; - -netif_carrier_off (netdev); - adapter->link_up = false; - -if (!adapter->netdev_registered) { - err =register_netdev (netdev); -if (err) - goto err_register; - } - - adapter->netdev_registered = true; - -netif_tx_stop_all_queues (netdev); -if (CLIENT_ALLOWED (adapter)) { - err =iavf_lan_add_device (adapter); -if (err) -dev_info (&pdev->dev,"Failed to add VF to client API service list: %d\n" , - err); - } - -dev_info (&pdev->dev,"MAC address: %pM\n" , adapter->hw.mac.addr); -if (netdev->features &NETIF_F_GRO ) -dev_info (&pdev->dev,"GRO is enabled\n" ); - - adapter->state = __IAVF_DOWN; -set_bit (__IAVF_VSI_DOWN, adapter->vsi.state); -iavf_misc_irq_enable (adapter); -wake_up (&adapter->down_waitqueue); - - adapter->rss_key =kzalloc (adapter->rss_key_size,GFP_KERNEL ); - adapter->rss_lut =kzalloc (adapter->rss_lut_size,GFP_KERNEL ); -if (!adapter->rss_key || !adapter->rss_lut) - goto err_mem; - -if (RSS_AQ (adapter)) { - adapter->aq_required |=IAVF_FLAG_AQ_CONFIGURE_RSS ; -mod_delayed_work (iavf_wq, &adapter->watchdog_task,1 ); - }else { -iavf_init_rss (adapter); - } -return ; -restart:queue_delayed_work (iavf_wq, &adapter->init_task,msecs_to_jiffies (30 ));return ; -err_mem: -iavf_free_rss (adapter); -err_register: -iavf_free_misc_irq (adapter); -err_sw_init: -iavf_reset_interrupt_capability (adapter); -err_alloc: -kfree (adapter->vf_res); - adapter->vf_res =NULL ; -err: -/* Things went into the weeds, so try again later */ +init_failed:if (++adapter->aq_wait_count >IAVF_AQ_MAX_ERR ) { -dev_err (&pdev->dev,"Failed to communicate with PF; waiting before retry\n" ); +dev_err (&adapter->pdev->dev, +"Failed to communicate with PF; waiting before retry\n" ); adapter->flags |=IAVF_FLAG_PF_COMMS_FAILED ;iavf_shutdown_adminq (hw); adapter->state = __IAVF_STARTUP;
Signature · 1 line
2.19.2
Bowers
PATCH 9/11 iavf: Refactor init state machine
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Pawlak, Jakub <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S5 iavf 09/11] iavf: Refactor init state machineFrom: Jakub Pawlak <[email protected]>
Quoted 8 lines
Cleanup of init state machine, move state specific code to separate functions and rewrite the
iavf_init_task()function.Signed-off-by Jakub Pawlak <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_main.c | 447 ++++++++++++-------- 1 file changed, 259 insertions(+), 188 deletions(-)
PATCH 10/11 iavf: add call to iavf_[add|del]_cloud_filter
In reply to Alice MichaelFrom: Paul Greenwalt <[email protected]>
Add call to iavf_add_cloud_filter and iavf_del_cloud_filter from iavf_process_aq_command to clear aq_required IAVF_FLAG_AQ_ADD_CLOUD_FILTER and IAVF_FLAG_AQ_DEL_CLOUD_FILTER bits.
aq_required IAVF_FLAG_AQ_DEL_CLOUD_FILTER bit is being set in iavf_down and iavf_delete_clsflower, and are never cleared.
aq_required IAVF_FLAG_AQ_ADD_CLOUD_FILTER bit is being set in iavf_handle_reset and iavf_configure_clsflower, and are never cleared.
Since the aq_required is not zero, iavf_watchdog_task is setting the queue_delayed_work to 20 msec instead of the longer delay.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +8 -1
@@ -1658,7 +1658,14 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)iavf_del_cloud_filter (adapter);return 0 ; } - +if (adapter->aq_required &IAVF_FLAG_AQ_DEL_CLOUD_FILTER ) { +iavf_del_cloud_filter (adapter); +return 0 ; + } +if (adapter->aq_required &IAVF_FLAG_AQ_ADD_CLOUD_FILTER ) { +iavf_add_cloud_filter (adapter); +return 0 ; + }return -EAGAIN ; }
Signature · 1 line
2.19.2
Greenwalt
PATCH 10/11 iavf: add call to iavf_[add|del]_cloud_filter
ACK
Thanks,
Paul
-----Original Message-----
From: Michael, Alice
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Greenwalt, Paul <[email protected]>
Subject: [next PATCH S5 iavf 10/11] iavf: add call to iavf_[add|del]_cloud_filter
From: Paul Greenwalt <[email protected]>
Add call to iavf_add_cloud_filter and iavf_del_cloud_filter from iavf_process_aq_command to clear aq_required IAVF_FLAG_AQ_ADD_CLOUD_FILTER and IAVF_FLAG_AQ_DEL_CLOUD_FILTER bits.
aq_required IAVF_FLAG_AQ_DEL_CLOUD_FILTER bit is being set in iavf_down and iavf_delete_clsflower, and are never cleared.
aq_required IAVF_FLAG_AQ_ADD_CLOUD_FILTER bit is being set in iavf_handle_reset and iavf_configure_clsflower, and are never cleared.
Since the aq_required is not zero, iavf_watchdog_task is setting the queue_delayed_work to 20 msec instead of the longer delay.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +8 -1
@@ -1658,7 +1658,14 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)iavf_del_cloud_filter (adapter);return 0 ; } - +if (adapter->aq_required &IAVF_FLAG_AQ_DEL_CLOUD_FILTER ) { +iavf_del_cloud_filter (adapter); +return 0 ; + } +if (adapter->aq_required &IAVF_FLAG_AQ_ADD_CLOUD_FILTER ) { +iavf_add_cloud_filter (adapter); +return 0 ; + }return -EAGAIN ; }
--
2.19.2
Bowers
PATCH 10/11 iavf: add call to iavf_[add|del]_cloud_filter
In reply to Alice MichaelQuoted 22 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S5 iavf 10/11] iavf: add call to iavf_[add|del]_cloud_filterFrom: Paul Greenwalt <[email protected]>
Add call to
iavf_add_cloud_filterandiavf_del_cloud_filterfromiavf_process_aq_commandto clearaq_requiredIAVF_FLAG_AQ_ADD_CLOUD_FILTERandIAVF_FLAG_AQ_DEL_CLOUD_FILTERbits.
aq_requiredIAVF_FLAG_AQ_DEL_CLOUD_FILTERbit is being set iniavf_downandiavf_delete_clsflower, and are never cleared.
aq_requiredIAVF_FLAG_AQ_ADD_CLOUD_FILTERbit is being set iniavf_handle_resetandiavf_configure_clsflower, and are never cleared.
Quoted 7 lines
Since the
aq_requiredis not zero,iavf_watchdog_taskis setting thequeue_delayed_workto 20 msec instead of the longer delay.Signed-off-by Paul Greenwalt <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
PATCH 11/11 iavf: allow null RX descriptors
In reply to Alice MichaelFrom: Mitch Williams <[email protected]>
In some circumstances, the hardware can hand us a null receive descriptor, with no data attached but otherwise valid. Unfortunately, the driver was ill-equipped to handle such an event, and would stop processing packets at that point.
To fix this, use the Descriptor Done bit instead of the size to determine whether or not a descriptor is ready to be processed. Add some checks to allow for unused buffers.
--- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_txrx.c +18 -3
@@ -1236,6 +1236,9 @@ static void iavf_add_rx_frag(struct iavf_ring *rx_ring,unsigned int truesize =SKB_DATA_ALIGN (size +iavf_rx_offset (rx_ring));#endif +if (!size) +return ; +skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, rx_buffer->page, rx_buffer->page_offset, size, truesize);
@@ -1260,6 +1263,9 @@ static struct iavf_rx_buffer *iavf_get_rx_buffer(struct iavf_ring *rx_ring, {struct iavf_rx_buffer *rx_buffer; +if (!size) +return NULL ; + rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];prefetchw (rx_buffer->page);
@@ -1299,6 +1305,8 @@ static struct sk_buff *iavf_construct_skb(struct iavf_ring *rx_ring,unsigned int headlen;struct sk_buff *skb; +if (!rx_buffer) +return NULL ;/* prefetch first cache line of first page */ prefetch (va);#if L1_CACHE_BYTES <128
@@ -1363,6 +1371,8 @@ static struct sk_buff *iavf_build_skb(struct iavf_ring *rx_ring,#endif struct sk_buff *skb; +if (!rx_buffer) +return NULL ;/* prefetch first cache line of first page */ prefetch (va);#if L1_CACHE_BYTES <128
@@ -1398,6 +1408,9 @@ static struct sk_buff *iavf_build_skb(struct iavf_ring *rx_ring,static void iavf_put_rx_buffer (struct iavf_ring *rx_ring,struct iavf_rx_buffer *rx_buffer) { +if (!rx_buffer) +return ; +if (iavf_can_reuse_rx_page (rx_buffer)) {/* hand second half of page back to the ring */ iavf_reuse_rx_page (rx_ring, rx_buffer);
@@ -1496,11 +1509,12 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_ring, int budget)* verified the descriptor has been written back. */ dma_rmb (); +#define IAVF_RXD_DD BIT(IAVF_RX_DESC_STATUS_DD_SHIFT) +if (!iavf_test_staterr (rx_desc,IAVF_RXD_DD )) +break ; size = (qword &IAVF_RXD_QW1_LENGTH_PBUF_MASK ) >>IAVF_RXD_QW1_LENGTH_PBUF_SHIFT ; -if (!size) -break ;iavf_trace (clean_rx_irq, rx_ring, rx_desc, skb); rx_buffer =iavf_get_rx_buffer (rx_ring, size);
@@ -1516,7 +1530,8 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_ring, int budget)/* exit if we failed to retrieve a buffer */ if (!skb) { rx_ring->rx_stats.alloc_buff_failed++; - rx_buffer->pagecnt_bias++; +if (rx_buffer) + rx_buffer->pagecnt_bias++;break ; }
Signature · 1 line
2.19.2
Bowers
PATCH 11/11 iavf: allow null RX descriptors
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired- lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S5 iavf 11/11] iavf: allow null RX descriptorsFrom: Mitch Williams <[email protected]>
In some circumstances, the hardware can hand us a null receive descriptor, with no data attached but otherwise valid. Unfortunately, the driver was ill- equipped to handle such an event, and would stop processing packets at that point.
Quoted 8 lines
To fix this, use the Descriptor Done bit instead of the size to determine whether or not a descriptor is ready to be processed. Add some checks to allow for unused buffers.
Signed-off-by Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
Bowers
PATCH 1/11 iavf: Create VLAN tag elements starting from the first element
In reply to Alice MichaelQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Alice Michael
Sent: Tuesday, May 14, 2019 10:37 AM
To: Michael, Alice <[email protected]>; intel-wired-
lan at lists.osuosl.org
Cc: Abodunrin, Akeem G <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S5 iavf 01/11] iavf: Create VLAN tag elements starting from the first elementFrom: Akeem G Abodunrin <[email protected]>
This patch changes how VLAN tag are being populated and programmed into the HW - Instead of start adding VF VLAN tag from the last member of the element list, start from the first member of the list, until number of allowed VLAN tags is exhausted in the HW.
Quoted 4 lines
Signed-off-by Akeem G Abodunrin <[email protected]>--- drivers/net/ethernet/intel/iavf/iavf_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)