i40e/i40evf updates
Subsystems (2)
cover i40e/i40evf updates
Alan Brady adds code to fix setting user defined RSS hash key & fix "dump port" command when NPAR enabled.
Anjali Singhai Jain adds code to change some init flow for the client.
Carolyn Wyborny adds code to fix to check for NULL & fix for extra byte swap in tunnel setup.
Mitch Williams adds code to return correct opcode to VF.
drivers/net/ethernet/intel/i40e/i40e.h | 2 ++ drivers/net/ethernet/intel/i40e/i40e_client.c | 41 ++++++++++++++++------ drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 7 +++- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++++--- drivers/net/ethernet/intel/i40e/i40e_main.c | 13 +++---- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 15 ++++++-- 6 files changed, 62 insertions(+), 28 deletions(-)
Signature · 1 line
2.4.11
PATCH 1/6 i40e: fix setting user defined RSS hash key
From: Alan Brady <[email protected]>
Previously, when using ethtool to change the RSS hash key, ethtool would report back saying the old key was still being used and no error was reported. It was unclear whether it was being reported incorrectly or being set incorrectly. Debugging revealed 'i40e_set_rxfh()' returned zero immediately instead of setting the key because a user defined indirection table is not supplied when changing the hash key.
This fix instead changes it such that if an indirection table is not supplied, then a default one is created and the hash key is now correctly set.
--- drivers/net/ethernet/intel/i40e/i40e.h | 2 ++ drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 +++++++----- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++---- 3 files changed, 11 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +2 -0
@@ -705,6 +705,8 @@ void i40e_do_reset_safe(struct i40e_pf *pf, u32 reset_flags);void i40e_do_reset (struct i40e_pf *pf,u32 reset_flags);int i40e_config_rss (struct i40e_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size);int i40e_get_rss (struct i40e_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size); +void i40e_fill_rss_lut (struct i40e_pf *pf,u8 *lut, +u16 rss_table_size,u16 rss_size);struct i40e_vsi *i40e_find_vsi_from_id (struct i40e_pf *pf,u16 id);void i40e_update_stats (struct i40e_vsi *vsi);void i40e_update_eth_stats (struct i40e_vsi *vsi);
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +7 -5
@@ -2922,15 +2922,13 @@ static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir, {struct i40e_netdev_priv *np =netdev_priv (netdev);struct i40e_vsi *vsi = np->vsi; +struct i40e_pf *pf = vsi->back;u8 *seed =NULL ;u16 i;if (hfunc !=ETH_RSS_HASH_NO_CHANGE && hfunc !=ETH_RSS_HASH_TOP )return -EOPNOTSUPP ; -if (!indir) -return 0 ; -if (key) {if (!vsi->rss_hkey_user) { vsi->rss_hkey_user = kzalloc(I40E_HKEY_ARRAY_SIZE,
@@ -2948,8 +2946,12 @@ static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir, }/* Each 32 bits pointed by 'indir' is stored with a lut entry */ -for (i =0 ; i <I40E_HLUT_ARRAY_SIZE ; i++) - vsi->rss_lut_user[i] = (u8)(indir[i]); +if (indir) +for (i =0 ; i <I40E_HLUT_ARRAY_SIZE ; i++) + vsi->rss_lut_user[i] = (u8)(indir[i]); +else +i40e_fill_rss_lut (pf, vsi->rss_lut_user,I40E_HLUT_ARRAY_SIZE , + vsi->rss_size);return i40e_config_rss (vsi, seed, vsi->rss_lut_user,I40E_HLUT_ARRAY_SIZE );
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -4
@@ -57,8 +57,6 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit);static int i40e_setup_misc_vector (struct i40e_pf *pf);static void i40e_determine_queue_usage (struct i40e_pf *pf);static int i40e_setup_pf_filter_control (struct i40e_pf *pf); -static void i40e_fill_rss_lut (struct i40e_pf *pf,u8 *lut, -u16 rss_table_size,u16 rss_size);static void i40e_fdir_sb_setup (struct i40e_pf *pf);static int i40e_veb_get_bw_info (struct i40e_veb *veb);
@@ -8228,8 +8226,8 @@ int i40e_get_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)* @rss_table_size: Lookup table size * @rss_size: Range of queue number for hashing */ -static void i40e_fill_rss_lut (struct i40e_pf *pf,u8 *lut, -u16 rss_table_size,u16 rss_size) +void i40e_fill_rss_lut (struct i40e_pf *pf,u8 *lut, +u16 rss_table_size,u16 rss_size) {u16 i;
Signature · 1 line
2.4.11
Bowers
PATCH 1/6 i40e: fix setting user defined RSS hash key
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Wednesday, August 24, 2016 11:34 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Brady, Alan <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S44 1/6] i40e: fix setting user defined RSS hash keyFrom: Alan Brady <[email protected]>
Previously, when using ethtool to change the RSS hash key, ethtool would report back saying the old key was still being used and no error was reported. It was unclear whether it was being reported incorrectly or being set incorrectly. Debugging revealed '
i40e_set_rxfh()' returned zero immediately instead of setting the key because a user defined indirection table is not supplied when changing the hash key.This fix instead changes it such that if an indirection table is not supplied, then a default one is created and the hash key is now correctly set.
Quoted 7 lines
Signed-off-by Alan Brady <[email protected]>Change-ID Iddb621897ecf208650272b7ee46702cad7b69a71--- drivers/net/ethernet/intel/i40e/i40e.h | 2 ++ drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 +++++++----- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++---- 3 files changed, 11 insertions(+), 9 deletions(-)
PATCH 2/6 i40e: fix "dump port" command when NPAR enabled
In reply to Bimmy PujariFrom: Alan Brady <[email protected]>
When using the debugfs to issue the "dump port" command with NPAR enabled, the firmware reports back with invalid argument.
The issue occurs because the pf->mac_seid was used to perform the query. This is fine when NPAR is disabled because the switch ID == pf->mac_seid, however this is not the case when NPAR is enabled. This fix instead goes through the VSI to determine the correct ID to use in either case.
HSD-number: 7661076
--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +6 -1
@@ -1054,6 +1054,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; bw_data = kzalloc(sizeof( struct i40e_aqc_query_port_ets_config_resp),
@@ -1063,8 +1064,12 @@ static ssize_t i40e_dbg_command_write(struct file *filp, goto command_write_done; } + vsi = pf->vsi[pf->lan_vsi]; + switch_id = + vsi->info.switch_id &I40E_AQ_VSI_SW_ID_MASK ; + ret =i40e_aq_query_port_ets_config (&pf->hw, - pf->mac_seid, + switch_id, bw_data,NULL );if (ret) { dev_info(&pf->pdev->dev,
Signature · 1 line
2.4.11
Bowers
PATCH 2/6 i40e: fix "dump port" command when NPAR enabled
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Wednesday, August 24, 2016 11:34 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Brady, Alan <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S44 2/6] i40e: fix "dump port" command when NPAR enabledFrom: Alan Brady <[email protected]>
When using the debugfs to issue the "dump port" command with NPAR enabled, the firmware reports back with invalid argument.
The issue occurs because the
pf->mac_seidwas used to perform the query. This is fine when NPAR is disabled because the switch ID ==pf->mac_seid, however this is not the case when NPAR is enabled. This fix instead goes through the VSI to determine the correct ID to use in either case.
Quoted 7 lines
HSD-number: 7661076
Signed-off-by Alan Brady <[email protected]>Change-ID I0cd67913a7f2c4a2962e06d39e32e7447cc55b6a--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
PATCH 3/6 i40e: Change some init flow for the client
In reply to Bimmy PujariFrom: Anjali Singhai Jain <[email protected]>
This change makes a common flow for Client instance open during init and reset path. The Client subtask can handle both the cases instead of making a separate notify_client_of_open call.
Also it may fix a bug during reset where the service task was leaking some memory and causing issues.
HSD-number: 7660752
Testing Hints :
The original bug related to the HSD was due the IWARP driver setting LAUNCH_ON_PROBE flag on its sidem which should be fixed
in the IWARP driver. This is further cleanup.
Test with init/reset/up/down/remove combinations on both LAN and IWARP driver side.
--- drivers/net/ethernet/intel/i40e/i40e_client.c | 41 ++++++++++++++++++++------- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 - 2 files changed, 30 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_client.c +30 -11
@@ -209,6 +209,7 @@ void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi)void i40e_notify_client_of_netdev_open (struct i40e_vsi *vsi) {struct i40e_client_instance *cdev; +int ret =0 ;if (!vsi)return ;
@@ -221,7 +222,14 @@ void i40e_notify_client_of_netdev_open(struct i40e_vsi *vsi) "Cannot locate client instance open routine\n");continue ; } - cdev->client->ops->open (&cdev->lan_info, cdev->client); +if (!(test_bit (__I40E_CLIENT_INSTANCE_OPENED, + &cdev->state))) { + ret = cdev->client->ops->open (&cdev->lan_info, + cdev->client); +if (!ret) +set_bit (__I40E_CLIENT_INSTANCE_OPENED, + &cdev->state); + } } }mutex_unlock (&i40e_client_instance_mutex);
@@ -432,12 +440,14 @@ struct i40e_vsi *i40e_vsi_lookup(struct i40e_pf *pf,* i40e_client_add_instance - add a client instance struct to the instance list * @pf: pointer to the board struct * @client: pointer to a client struct in the client list. +* @existing: if there was already an existing instance * -* Returns cdev ptr on success, NULL on failure +* Returns cdev ptr on success or if already exists, NULL on failure **/ static struct i40e_client_instance *i40e_client_add_instance (struct i40e_pf *pf, -struct i40e_client *client) +struct i40e_client *client, +bool *existing) {struct i40e_client_instance *cdev;struct netdev_hw_addr *mac =NULL ;
@@ -446,7 +456,7 @@ struct i40e_client_instance *i40e_client_add_instance(struct i40e_pf *pf,mutex_lock (&i40e_client_instance_mutex);list_for_each_entry (cdev, &i40e_client_instances, list) {if ((cdev->lan_info.pf == pf) && (cdev->client == client)) { - cdev =NULL ; + *existing = true; goto out; } }
@@ -530,6 +540,7 @@ void i40e_client_subtask(struct i40e_pf *pf) {struct i40e_client_instance *cdev;struct i40e_client *client; +bool existing = false;int ret =0 ;if (!(pf->flags &I40E_FLAG_SERVICE_CLIENT_REQUESTED ))
@@ -553,18 +564,25 @@ void i40e_client_subtask(struct i40e_pf *pf)/* check if L2 VSI is up, if not we are not ready */ if (test_bit (__I40E_DOWN, &pf->vsi[pf->lan_vsi]->state))continue ; + }else { +dev_warn (&pf->pdev->dev,"This client %s is being instanciated at probe\n" , + client->name); }/* Add the client instance to the instance list */ - cdev =i40e_client_add_instance (pf, client); + cdev =i40e_client_add_instance (pf, client, &existing);if (!cdev)continue ; -/* Also up the ref_cnt of no. of instances of this client */ -atomic_inc (&client->ref_cnt); -dev_info (&pf->pdev->dev,"Added instance of Client %s to PF%d bus=0x%02x func=0x%02x\n" , - client->name, pf->hw.pf_id, - pf->hw.bus.device, pf->hw.bus.func); +if (!existing) { +/* Also up the ref_cnt for no. of instances of this +* client. +*/ +atomic_inc (&client->ref_cnt); +dev_info (&pf->pdev->dev,"Added instance of Client %s to PF%d bus=0x%02x func=0x%02x\n" , + client->name, pf->hw.pf_id, + pf->hw.bus.device, pf->hw.bus.func); + }mutex_lock (&i40e_client_instance_mutex);/* Send an Open request to the client */
@@ -616,7 +634,8 @@ int i40e_lan_add_device(struct i40e_pf *pf) pf->hw.pf_id, pf->hw.bus.device, pf->hw.bus.func);/* Since in some cases register may have happened before a device gets -* added, we can schedule a subtask to go initiate the clients. +* added, we can schedule a subtask to go initiate the clients if +* they can be launched at probe time. */ pf->flags |=I40E_FLAG_SERVICE_CLIENT_REQUESTED ;i40e_service_event_schedule (pf);
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -1
@@ -5416,7 +5416,6 @@ int i40e_open(struct net_device *netdev)wr32 (&pf->hw,I40E_GLLAN_TSOMSK_L ,be32_to_cpu (TCP_FLAG_CWR ) >>16 );udp_tunnel_get_rx_info (netdev); -i40e_notify_client_of_netdev_open (vsi);return 0 ; }
Signature · 1 line
2.4.11
Bowers
PATCH 3/6 i40e: Change some init flow for the client
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Wednesday, August 24, 2016 11:34 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S44 3/6] i40e: Change some init flow for the clientFrom: Anjali Singhai Jain <[email protected]>
This change makes a common flow for Client instance open during init and reset path. The Client subtask can handle both the cases instead of making a separate
notify_client_of_opencall.
Also it may fix a bug during reset where the service task was leaking some memory and causing issues.HSD-number: 7660752
Testing Hints :
The original bug related to the HSD was due the IWARP driver settingLAUNCH_ON_PROBEflag on its sidem which should be fixed in the IWARP driver. This is further cleanup.
Test withinit/reset/up/down/removecombinations on both LAN and IWARP driver side.
Quoted 7 lines
Signed-off-by Anjali Singhai Jain <[email protected]>Change-Id I7232a32fd52b82e863abb54266fa83122f80a0cd--- drivers/net/ethernet/intel/i40e/i40e_client.c | 41 ++++++++++++++++++++------- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 - 2 files changed, 30 insertions(+), 12 deletions(-)
PATCH 4/6 i40e: return correct opcode to VF
In reply to Bimmy PujariFrom: Mitch Williams <[email protected]>
This conditional is backward, so the driver responds back to the VF with the wrong opcode. Do the old switcheroo to fix this.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -2
@@ -2365,8 +2365,8 @@ static int i40e_vc_iwarp_qvmap_msg(struct i40e_vf *vf, u8 *msg, u16 msglen, error_param:/* send the response to the VF */ return i40e_vc_send_resp_to_vf (vf, - config ?I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP : -I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP , + config ?I40E_VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP : +I40E_VIRTCHNL_OP_RELEASE_IWARP_IRQ_MAP , aq_ret); }
Signature · 1 line
2.4.11
Bowers
PATCH 4/6 i40e: return correct opcode to VF
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Wednesday, August 24, 2016 11:34 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S44 4/6] i40e: return correct opcode to VFFrom: Mitch Williams <[email protected]>
Quoted 8 lines
This conditional is backward, so the driver responds back to the VF with the wrong opcode. Do the old switcheroo to fix this.
Signed-off-by Mitch Williams <[email protected]>Change-ID I384035b0fef8a3881c176de4b4672009b3400b25--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH 5/6 i40e: Fix to check for NULL
In reply to Bimmy PujariFrom: Carolyn Wyborny <[email protected]>
This patch fixes an issue in the virt channel code, where a return from i40e_find_vsi_from_id was not checked for NULL when applicable. Without this patch, there is a risk for panic and static analysis tools complain. This patch fixes the problem by adding the check and adding an additional input check for similar reasons.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +10 -1
@@ -502,8 +502,16 @@ static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id,u32 qtx_ctl;int ret =0 ; +if (!i40e_vc_isvalid_vsi_id (vf, info->vsi_id)) { + ret = -ENOENT ; + goto error_context; + } pf_queue_id =i40e_vc_get_pf_queue_id (vf, vsi_id, vsi_queue_id); vsi =i40e_find_vsi_from_id (pf, vsi_id); +if (!vsi) { + ret = -ENOENT ; + goto error_context; + }/* clear the context structure first */ memset (&tx_ctx,0 ,sizeof (struct i40e_hmc_obj_txq ));
@@ -1624,7 +1632,8 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, vsi =i40e_find_vsi_from_id (pf, info->vsi_id);if (!test_bit (I40E_VF_STAT_ACTIVE , &vf->vf_states) || - !i40e_vc_isvalid_vsi_id (vf, info->vsi_id)) { + !i40e_vc_isvalid_vsi_id (vf, info->vsi_id) || + !vsi) { aq_ret =I40E_ERR_PARAM ; goto error_param; }
Signature · 1 line
2.4.11
Bowers
PATCH 5/6 i40e: Fix to check for NULL
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Wednesday, August 24, 2016 11:34 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S44 5/6] i40e: Fix to check for NULLFrom: Carolyn Wyborny <[email protected]>
This patch fixes an issue in the virt channel code, where a return from
i40e_find_vsi_from_idwas not checked for NULL when applicable. Without this patch, there is a risk for panic and static analysis tools complain. This patch fixes the problem by adding the check and adding an additional input check for similar reasons.
Quoted 5 lines
Signed-off-by Carolyn Wyborny <[email protected]>Change-ID I7e9be88eb7a3addb50eadc451c8336d9e06f5394--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
PATCH 6/6 i40e: Fix for extra byte swap in tunnel setup
In reply to Bimmy PujariFrom: Carolyn Wyborny <[email protected]>
This patch fixes an issue where we were byte swapping the port parameter, then byte swapping it again in function execution. Obviously, that's unnecessary, so take it out of the function calls. Without this patch, the udp based tunnel configuration would not be correct.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -3
@@ -7138,9 +7138,9 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf) pf->pending_udp_bitmap &= ~BIT_ULL (i); port = pf->udp_ports[i].index;if (port) - ret =i40e_aq_add_udp_tunnel (hw,ntohs (port), - pf->udp_ports[i].type, -NULL ,NULL ); + ret =i40e_aq_add_udp_tunnel (hw, port, + pf->udp_ports[i].type, +NULL ,NULL );else ret =i40e_aq_del_udp_tunnel (hw, i,NULL );
Signature · 1 line
2.4.11
Bowers
PATCH 6/6 i40e: Fix for extra byte swap in tunnel setup
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Wednesday, August 24, 2016 11:34 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S44 6/6] i40e: Fix for extra byte swap in tunnel setupFrom: Carolyn Wyborny <[email protected]>
This patch fixes an issue where we were byte swapping the port parameter, then byte swapping it again in function execution.
Obviously, that's unnecessary, so take it out of the function calls. Without this patch, the udp based tunnel configuration would not be correct.
Quoted 5 lines
Signed-off-by Carolyn Wyborny <[email protected]>Change-ID I788d83c5bd5732170f1a81dbfa0b1ac3ca8ea5b7--- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)