i40e/i40evf updates
Subsystems (2)
cover i40e/i40evf updates
Anjali Singhai Jain, with Greg Rose as co-author adds driver support for promiscuous mode.
Greg Rose removes zero check for rule ID and adds support for promiscuous mode in VLAN.
Jesse Brandeburg ensures vlan tag is offlloaded only if enabled.
Kamil Krawczyk adds DeviceID for X722 QSFP+.
Kiran Patil allows user to change input set mask for flow director.
Michal Kosiarz adds device capability which defines if update is available.
Mitch Williams adds support for configuring VF RSS, checks that vsi_res pointer is valid before dereferencing it and allows PF driver to configure RSS.
Shannon Nelson cleans up code in preparation for future cloud work and specifies AQ event opcode to wait for.
drivers/net/ethernet/intel/i40e/i40e.h | 7 + drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 1 + drivers/net/ethernet/intel/i40e/i40e_common.c | 82 ++++- drivers/net/ethernet/intel/i40e/i40e_devids.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 128 +++++++- drivers/net/ethernet/intel/i40e/i40e_main.c | 35 ++- drivers/net/ethernet/intel/i40e/i40e_nvm.c | 49 ++- drivers/net/ethernet/intel/i40e/i40e_prototype.h | 8 + drivers/net/ethernet/intel/i40e/i40e_txrx.c | 5 +- drivers/net/ethernet/intel/i40e/i40e_type.h | 6 + drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 346 ++++++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 + .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_common.c | 1 + drivers/net/ethernet/intel/i40evf/i40e_devids.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 3 +- drivers/net/ethernet/intel/i40evf/i40e_type.h | 6 + drivers/net/ethernet/intel/i40evf/i40evf.h | 39 ++- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 121 ++++--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 327 +++++++------------ .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 130 ++++++++ 21 files changed, 976 insertions(+), 323 deletions(-)
Signature · 1 line
2.4.3
PATCH 1/13 i40e: Add support for configuring VF RSS
From: Mitch Williams <[email protected]>
Add support for configuring RSS on behalf of the VFs. This removes the burden of dealing with different hardware interfaces from the VF drivers, allowing for better future compatibility.
---
Testing Hints : Use ethtool to configure RSS key and LUT, test traffic spreads to different queues.
drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 35 +++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 193 ++++++++++++++++++++- 3 files changed, 217 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -202,6 +202,7 @@ struct i40e_lump_tracking {#define I40E_HKEY_ARRAY_SIZE ((I40E_PFQF_HKEY_MAX_INDEX + 1) * 4)#define I40E_HLUT_ARRAY_SIZE ((I40E_PFQF_HLUT_MAX_INDEX + 1) * 4) +#define I40E_VF_HLUT_ARRAY_SIZE ((I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4)enum i40e_fd_stat_idx {I40E_FD_STAT_ATR ,
drivers/net/ethernet/intel/i40e/i40e_main.c +28 -7
@@ -8082,24 +8082,45 @@ static int i40e_config_rss_reg(struct i40e_vsi *vsi, const u8 *seed, {struct i40e_pf *pf = vsi->back;struct i40e_hw *hw = &pf->hw; +u16 vf_id = vsi->vf_id;u8 i;/* Fill out hash function seed */ if (seed) {u32 *seed_dw = (u32 *)seed; -for (i =0 ; i <=I40E_PFQF_HKEY_MAX_INDEX ; i++) -i40e_write_rx_ctl (hw,I40E_PFQF_HKEY (i), seed_dw[i]); +if (vsi->type ==I40E_VSI_MAIN ) { +for (i =0 ; i <=I40E_PFQF_HKEY_MAX_INDEX ; i++) +i40e_write_rx_ctl (hw,I40E_PFQF_HKEY (i), + seed_dw[i]); + }else if (vsi->type ==I40E_VSI_SRIOV ) { +for (i =0 ; i <=I40E_VFQF_HKEY1_MAX_INDEX ; i++) +i40e_write_rx_ctl (hw, +I40E_VFQF_HKEY1 (i, vf_id), + seed_dw[i]); + }else { +dev_err (&pf->pdev->dev,"Cannot set RSS seed - invalid VSI type\n" ); + } }if (lut) {u32 *lut_dw = (u32 *)lut; -if (lut_size !=I40E_HLUT_ARRAY_SIZE ) -return -EINVAL ; - -for (i =0 ; i <=I40E_PFQF_HLUT_MAX_INDEX ; i++) -wr32 (hw,I40E_PFQF_HLUT (i), lut_dw[i]); +if (vsi->type ==I40E_VSI_MAIN ) { +if (lut_size !=I40E_HLUT_ARRAY_SIZE ) +return -EINVAL ; +for (i =0 ; i <=I40E_PFQF_HLUT_MAX_INDEX ; i++) +wr32 (hw,I40E_PFQF_HLUT (i), lut_dw[i]); + }else if (vsi->type ==I40E_VSI_SRIOV ) { +if (lut_size !=I40E_VF_HLUT_ARRAY_SIZE ) +return -EINVAL ; +for (i =0 ; i <=I40E_VFQF_HLUT_MAX_INDEX ; i++) +i40e_write_rx_ctl (hw, +I40E_VFQF_HLUT1 (i, vf_id), + lut_dw[i]); + }else { +dev_err (&pf->pdev->dev,"Cannot set RSS LUT - invalid VSI type\n" ); + } }i40e_flush (hw);
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +188 -5
224 lines not on this page · raw message
Signature · 1 line
2.4.3
Bowers
PATCH 1/13 i40e: Add support for configuring VF RSS
Quoted 20 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 01/13] i40e: Add support for configuring VF RSSFrom: Mitch Williams <[email protected]>
Add support for configuring RSS on behalf of the VFs. This removes the burden of dealing with different hardware interfaces from the VF drivers, allowing for better future compatibility.
Signed-off-by Mitch Williams <[email protected]>Change-ID Icea75d3f37241ee8e447be5779e5abb53ddf04c0---
Testing Hints : Use ethtool to configure RSS key and LUT, test traffic spreads to different queues.
Quoted 5 lines
drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 35 +++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 193 ++++++++++++++++++++- 3 files changed, 217 insertions(+), 12 deletions(-)
VF traffic spreads among queues as expected
PATCH 2/13 i40evf: Don't Panic
In reply to Harshitha RamamurthyFrom: Mitch Williams <[email protected]>
Under some circumstances the driver remove function may be called before the driver is fully initialized. So we can't assume that we know where our towel is at, or that all of the data structures are initialized.
To ensure that we don't panic, check that the vsi_res pointer is valid before dereferencing it. Then drink beer and eat peanuts.
--- drivers/net/ethernet/intel/i40evf/i40evf.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +4 -2
@@ -256,8 +256,10 @@ struct i40evf_adapter {bool netdev_registered;bool link_up;enum i40e_virtchnl_ops current_op; -#define CLIENT_ENABLED (_a) ((_a)->vf_res->vf_offload_flags & \ - I40E_VIRTCHNL_VF_OFFLOAD_IWARP) +#define CLIENT_ENABLED (_a) ((_a)->vf_res ? \ + (_a)->vf_res->vf_offload_flags & \ + I40E_VIRTCHNL_VF_OFFLOAD_IWARP : \ + 0)#define RSS_AQ (_a) ((_a)->vf_res->vf_offload_flags & \ I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ)#define VLAN_ALLOWED (_a) ((_a)->vf_res->vf_offload_flags & \
Signature · 1 line
2.4.3
Bowers
PATCH 2/13 i40evf: Don't Panic
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 02/13] i40evf: Don't PanicFrom: Mitch Williams <[email protected]>
Under some circumstances the driver remove function may be called before the driver is fully initialized. So we can't assume that we know where our towel is at, or that all of the data structures are initialized.
Quoted 8 lines
To ensure that we don't panic, check that the
vsi_respointer is valid before dereferencing it. Then drink beer and eat peanuts.Signed-off-by Mitch Williams <[email protected]>Change-ID If697b4db57348e39f9538793e16aa755e3e1af03--- drivers/net/ethernet/intel/i40evf/i40evf.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Added and removed driver in rapid succession, no panics
PATCH 3/13 i40e: Code cleanup in i40e_add_fdir_ethtool
In reply to Harshitha RamamurthyFrom: Shannon Nelson <[email protected]>
A little bit of code cleanup in prep for more cloud filter work.
---
Testing Hints :
Compiles, FD filters still work
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +7 -5
@@ -2506,7 +2506,6 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,if (!vsi)return -EINVAL ; - pf = vsi->back;if (!(pf->flags &I40E_FLAG_FD_SB_ENABLED ))
@@ -2564,15 +2563,18 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, input->src_ip[0 ] = fsp->h_u.tcp_ip4_spec.ip4dst;if (ntohl (fsp->m_ext.data[1 ])) { -if (ntohl (fsp->h_ext.data[1 ]) >= pf->num_alloc_vfs) { -netif_info (pf, drv, vsi->netdev,"Invalid VF id\n" ); + vf_id =ntohl (fsp->h_ext.data[1 ]); +if (vf_id >= pf->num_alloc_vfs) { +netif_info (pf, drv, vsi->netdev, +"Invalid VF id %d\n" , vf_id); goto free_input; } - vf_id =ntohl (fsp->h_ext.data[1 ]);/* Find vsi id from vf id and override dest vsi */ input->dest_vsi = pf->vf[vf_id].lan_vsi_id;if (input->q_index >= pf->vf[vf_id].num_queue_pairs) { -netif_info (pf, drv, vsi->netdev,"Invalid queue id\n" ); +netif_info (pf, drv, vsi->netdev, +"Invalid queue id %d for VF %d\n" , + input->q_index, vf_id); goto free_input; } }
Signature · 1 line
2.4.3
Bowers
PATCH 3/13 i40e: Code cleanup in i40e_add_fdir_ethtool
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 03/13] i40e: Code cleanup ini40e_add_fdir_ethtoolFrom: Shannon Nelson <[email protected]>
A little bit of code cleanup in prep for more cloud filter work.
Quoted 8 lines
Signed-off-by Shannon Nelson <[email protected]>Change-ID I0dc33ce0d4c207944336a07437640fef920c100c---
Testing Hints :
Compiles, FD filters still workdrivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
Flow director filters work as expected
PATCH 4/13 i40e: Specify AQ event opcode to wait for
In reply to Harshitha RamamurthyFrom: Shannon Nelson <[email protected]>
To add a little flexibility to the nvmupdate facility, this code adds the ability to specify an AQ event opcode to wait on after the Exec_AQ request.
---
Testing Hints (required if no HSD):
make use of the devel test program i40e_aq_cmd.c # ethtool -s p4p1 msglvl 0xf000008f turn on nvmupdate debugging # i40e_aq_cmd p4p1 aq should run with no errors # i40e_aq_cmd p4p1 aq 0x0222 should complain that it can't finish Cannot get AQ result: Device or resource busy # i40e_aq_cmd p4p1 stat should log stat info with state 3 and opc 0x0222 should return non-zero # i40e_aq_cmd p4p1 clear should run with no error # i40e_aq_cmd p4p1 stat should log stat info with state 0 and opc 0x0000 # i40e_aq_cmd p4p1 aq should run with no error
drivers/net/ethernet/intel/i40e/i40e_nvm.c | 49 +++++++++++++++++++++++---- drivers/net/ethernet/intel/i40e/i40e_type.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_type.h | 1 + 3 files changed, 44 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +42 -7
@@ -693,10 +693,10 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,/* early check for status command and debug msgs */ upd_cmd =i40e_nvmupd_validate_command (hw, cmd, perrno); -i40e_debug (hw,I40E_DEBUG_NVM ,"%s state %d nvm_release_on_hold %d cmd 0x%08x config 0x%08x offset 0x%08x data_size 0x%08x\n" , +i40e_debug (hw,I40E_DEBUG_NVM ,"%s state %d nvm_release_on_hold %d opc 0x%04x cmd 0x%08x config 0x%08x offset 0x%08x data_size 0x%08x\n" , i40e_nvm_update_state_str[upd_cmd], hw->nvmupd_state, - hw->nvm_release_on_done, + hw->nvm_release_on_done, hw->nvm_wait_opcode, cmd->command, cmd->config, cmd->offset, cmd->data_size);if (upd_cmd ==I40E_NVMUPD_INVALID ) {
@@ -710,7 +710,18 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,* going into the state machine */ if (upd_cmd ==I40E_NVMUPD_STATUS ) { +if (!cmd->data_size) { + *perrno = -EFAULT ; +return I40E_ERR_BUF_TOO_SHORT ; + } + bytes[0 ] = hw->nvmupd_state; + +if (cmd->data_size >=4 ) { + bytes[1 ] =0 ; + *((u16 *)&bytes[2 ]) = hw->nvm_wait_opcode; + } +return 0 ; }
@@ -729,6 +740,14 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,case I40E_NVMUPD_STATE_INIT_WAIT :case I40E_NVMUPD_STATE_WRITE_WAIT : +/* if we need to stop waiting for an event, clear +* the wait info and return before doing anything else +*/ +if (cmd->offset ==0xffff ) { +i40e_nvmupd_check_wait_event (hw, hw->nvm_wait_opcode); +return 0 ; + } + status =I40E_ERR_NOT_READY ; *perrno = -EBUSY ;break ;
@@ -800,6 +819,7 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,i40e_release_nvm (hw); }else { hw->nvm_release_on_done = true; + hw->nvm_wait_opcode = i40e_aqc_opc_nvm_erase; hw->nvmupd_state =I40E_NVMUPD_STATE_INIT_WAIT ; } }
@@ -816,6 +836,7 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,i40e_release_nvm (hw); }else { hw->nvm_release_on_done = true; + hw->nvm_wait_opcode = i40e_aqc_opc_nvm_update; hw->nvmupd_state =I40E_NVMUPD_STATE_INIT_WAIT ; } }
@@ -828,10 +849,12 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw, hw->aq.asq_last_status); }else { status =i40e_nvmupd_nvm_write (hw, cmd, bytes, perrno); -if (status) +if (status) {i40e_release_nvm (hw); -else + }else { + hw->nvm_wait_opcode = i40e_aqc_opc_nvm_update; hw->nvmupd_state =I40E_NVMUPD_STATE_WRITE_WAIT ; + } }break ;
@@ -850,6 +873,7 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,i40e_release_nvm (hw); }else { hw->nvm_release_on_done = true; + hw->nvm_wait_opcode = i40e_aqc_opc_nvm_update; hw->nvmupd_state =I40E_NVMUPD_STATE_INIT_WAIT ; } }
@@ -940,8 +964,10 @@ retry:switch (upd_cmd) {case I40E_NVMUPD_WRITE_CON : status =i40e_nvmupd_nvm_write (hw, cmd, bytes, perrno); -if (!status) +if (!status) { + hw->nvm_wait_opcode = i40e_aqc_opc_nvm_update; hw->nvmupd_state =I40E_NVMUPD_STATE_WRITE_WAIT ; + }break ;case I40E_NVMUPD_WRITE_LCB :
@@ -954,6 +980,7 @@ retry: hw->nvmupd_state =I40E_NVMUPD_STATE_INIT ; }else { hw->nvm_release_on_done = true; + hw->nvm_wait_opcode = i40e_aqc_opc_nvm_update; hw->nvmupd_state =I40E_NVMUPD_STATE_INIT_WAIT ; }break ;
@@ -967,6 +994,7 @@ retry: -EIO ; hw->nvmupd_state =I40E_NVMUPD_STATE_INIT ; }else { + hw->nvm_wait_opcode = i40e_aqc_opc_nvm_update; hw->nvmupd_state =I40E_NVMUPD_STATE_WRITE_WAIT ; }break ;
@@ -981,6 +1009,7 @@ retry: hw->nvmupd_state =I40E_NVMUPD_STATE_INIT ; }else { hw->nvm_release_on_done = true; + hw->nvm_wait_opcode = i40e_aqc_opc_nvm_update; hw->nvmupd_state =I40E_NVMUPD_STATE_INIT_WAIT ; }break ;
@@ -1036,14 +1065,14 @@ retry:**/ void i40e_nvmupd_check_wait_event (struct i40e_hw *hw,u16 opcode) { -if (opcode == i40e_aqc_opc_nvm_erase || - opcode == i40e_aqc_opc_nvm_update) { +if (opcode == hw->nvm_wait_opcode) {i40e_debug (hw,I40E_DEBUG_NVM ,"NVMUPD: clearing wait on opcode 0x%04x\n" , opcode);if (hw->nvm_release_on_done) {i40e_release_nvm (hw); hw->nvm_release_on_done = false; } + hw->nvm_wait_opcode =0 ;switch (hw->nvmupd_state) {case I40E_NVMUPD_STATE_INIT_WAIT :
@@ -1220,6 +1249,12 @@ static i40e_status i40e_nvmupd_exec_aq(struct i40e_hw *hw, *perrno =i40e_aq_rc_to_posix (status, hw->aq.asq_last_status); } +/* should we wait for a followup event? */ +if (cmd->offset) { + hw->nvm_wait_opcode = cmd->offset; + hw->nvmupd_state =I40E_NVMUPD_STATE_INIT_WAIT ; + } +return status; }
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -0
@@ -550,6 +550,7 @@ struct i40e_hw {struct i40e_aq_desc nvm_wb_desc;struct i40e_virt_mem nvm_buff;bool nvm_release_on_done; +u16 nvm_wait_opcode;/* HMC info */ struct i40e_hmc_info hmc;/* HMC info struct */
drivers/net/ethernet/intel/i40evf/i40e_type.h +1 -0
@@ -523,6 +523,7 @@ struct i40e_hw {struct i40e_aq_desc nvm_wb_desc;struct i40e_virt_mem nvm_buff;bool nvm_release_on_done; +u16 nvm_wait_opcode;/* HMC info */ struct i40e_hmc_info hmc;/* HMC info struct */
Signature · 1 line
2.4.3
PATCH 5/13 i40evf: Allow PF driver to configure RSS
In reply to Harshitha RamamurthyFrom: Mitch Williams <[email protected]>
If the PF driver reports proper support, allow the PF driver to configure RSS on the behalf of the VF driver. This will allow for RSS support on future hardware without changes to the VF driver.
Unfortunately, the old RSS code still needs to stay as the driver needs to be compatible with PF drivers that don't support this interface. But this change still simplifies the data structures a bunch and makes this code simpler to read and maintain.
---
Testing Hints : Use ethtool to change RSS params and make sure they stick and work correctly.
drivers/net/ethernet/intel/i40evf/i40evf.h | 30 +- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 121 ++++---- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 308 +++++++-------------- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 119 ++++++++ 4 files changed, 294 insertions(+), 284 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +23 -7
@@ -67,8 +67,6 @@ struct i40e_vsi {u16 rx_itr_setting;u16 tx_itr_setting;u16 qs_handle; -u8 *rss_hkey_user;/* User configured hash keys */ -u8 *rss_lut_user;/* User configured lookup table entries */ };/* How many Rx Buffers do we bundle into one write to the hardware ? */
@@ -239,8 +237,13 @@ struct i40evf_adapter {#define I40EVF_FLAG_AQ_CONFIGURE_QUEUES BIT(6)#define I40EVF_FLAG_AQ_MAP_VECTORS BIT(7)#define I40EVF_FLAG_AQ_HANDLE_RESET BIT(8) -#define I40EVF_FLAG_AQ_CONFIGURE_RSS BIT(9) +#define I40EVF_FLAG_AQ_CONFIGURE_RSS BIT(9)/* direct AQ config */ #define I40EVF_FLAG_AQ_GET_CONFIG BIT(10) +/* Newer style, RSS done by the PF so we can ignore hardware vagaries. */ +#define I40EVF_FLAG_AQ_GET_HENA BIT(11) +#define I40EVF_FLAG_AQ_SET_HENA BIT(12) +#define I40EVF_FLAG_AQ_SET_RSS_KEY BIT(13) +#define I40EVF_FLAG_AQ_SET_RSS_LUT BIT(14)/* OS defined structs */ struct net_device *netdev;
@@ -260,8 +263,14 @@ struct i40evf_adapter { (_a)->vf_res->vf_offload_flags & \ I40E_VIRTCHNL_VF_OFFLOAD_IWARP : \ 0) +/* RSS by the PF should be preferred over RSS via other methods. */ +#define RSS_PF (_a) ((_a)->vf_res->vf_offload_flags & \ + I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF)#define RSS_AQ (_a) ((_a)->vf_res->vf_offload_flags & \ I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ) +#define RSS_REG (_a) (!((_a)->vf_res->vf_offload_flags & \ + (I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ | \ + I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF)))#define VLAN_ALLOWED (_a) ((_a)->vf_res->vf_offload_flags & \ I40E_VIRTCHNL_VF_OFFLOAD_VLAN)struct i40e_virtchnl_vf_resource *vf_res;/* incl. all VSIs */
@@ -273,6 +282,12 @@ struct i40evf_adapter {struct i40e_eth_stats current_stats;struct i40e_vsi vsi;u32 aq_wait_count; +/* RSS stuff */ +u64 hena; +u16 rss_key_size; +u16 rss_lut_size; +u8 *rss_key; +u8 *rss_lut; };
@@ -316,11 +331,12 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter);void i40evf_set_promiscuous (struct i40evf_adapter *adapter,int flags);void i40evf_request_stats (struct i40evf_adapter *adapter);void i40evf_request_reset (struct i40evf_adapter *adapter); +void i40evf_get_hena (struct i40evf_adapter *adapter); +void i40evf_set_hena (struct i40evf_adapter *adapter); +void i40evf_set_rss_key (struct i40evf_adapter *adapter); +void i40evf_set_rss_lut (struct i40evf_adapter *adapter);void i40evf_virtchnl_completion (struct i40evf_adapter *adapter,enum i40e_virtchnl_ops v_opcode,i40e_status v_retval,u8 *msg,u16 msglen); -int i40evf_config_rss (struct i40e_vsi *vsi,const u8 *seed,u8 *lut, -u16 lut_size); -int i40evf_get_rss (struct i40e_vsi *vsi,const u8 *seed,u8 *lut, -u16 lut_size); +int i40evf_config_rss (struct i40evf_adapter *adapter);#endif /* _I40EVF_H_ */
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +54 -67
254 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_main.c +98 -210
422 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +119 -0
131 lines not on this page · raw message
Signature · 1 line
2.4.3
Bowers
PATCH 5/13 i40evf: Allow PF driver to configure RSS
Quoted 25 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 05/13] i40evf: Allow PF driver to configure RSSFrom: Mitch Williams <[email protected]>
If the PF driver reports proper support, allow the PF driver to configure RSS on the behalf of the VF driver. This will allow for RSS support on future hardware without changes to the VF driver.
Unfortunately, the old RSS code still needs to stay as the driver needs to be compatible with PF drivers that don't support this interface. But this change still simplifies the data structures a bunch and makes this code simpler to read and maintain.
Signed-off-by Mitch Williams <[email protected]>Change-ID I0375aad40788ecdc0cb24d5cfeccf07804e69771---
Testing Hints : Use ethtool to change RSS params and make sure they stick and work correctly.
Quoted 6 lines
drivers/net/ethernet/intel/i40evf/i40evf.h | 30 +- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 121 ++++---- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 308 +++++++------------- - .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 119 ++++++++ 4 files changed, 294 insertions(+), 284 deletions(-)
RSS settings can be changed and stick via ethtool
PATCH 6/13 i40e: Allow user to change input set mask for flow director
In reply to Harshitha RamamurthyFrom: Kiran Patil <[email protected]>
This patch implements feature, which allows user to change input set mask for flow director using side-band channel. This patch adds definition of FLOW_TYPE_MASK into the header file. With this patch, user can now specify less than 4 tuple(src ip, dsp ip, src port, dst port) for flow type tcp4/udp4.
---
Testing Hints :
e.g. Using ethtoool, side-band filters are programmed such as:
ethtool -N p5p2 flow-type tcp4 src-ip 192.168.0.2 \
dst-ip 192.168.0.1 action 40
ethtool -N p5p2 flow-type tcp4 src-ip 192.168.0.2 action 41 ethtool -N p5p2 flow-type tcp4 dst-ip 192.168.0.1 action 42 ethtool -N p5p2 flow-type tcp4 dst-port 5001 action 43
What to look for to see if side-band filter is matched or not:
Look into port stats (using ethtool -S <ethx> | grep fdir) and specifically look for 'fdir_sb_match'. This counter should be incremented whenever filter is matched.
drivers/net/ethernet/intel/i40e/i40e.h | 6 ++ drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 116 +++++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +- 3 files changed, 123 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e.h +6 -0
@@ -240,6 +240,12 @@ struct i40e_fdir_filter {u32 fd_id; }; +#ifndef FLOW_TYPE_MASK +#define FLOW_TYPE_MASK 0xFF +#else +#error FLOW_TYPE_MASK already defined elsewhere +#endif +#define I40E_ETH_P_LLDP 0x88cc#define I40E_DCB_PRIO_TYPE_STRICT 0
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +116 -0
128 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_txrx.c +1 -1
@@ -412,7 +412,7 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi,struct i40e_pf *pf = vsi->back;int ret; -switch (input->flow_type & ~FLOW_EXT ) { +switch (input->flow_type &FLOW_TYPE_MASK ) {case TCP_V4_FLOW : ret =i40e_add_del_fdir_tcpv4 (vsi, input, add);break ;
Signature · 1 line
2.4.3
Bowers
PATCH 6/13 i40e: Allow user to change input set mask for flow director
Quoted 31 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 06/13] i40e: Allow user to change input set mask for flow directorFrom: Kiran Patil <[email protected]>
This patch implements feature, which allows user to change input set mask for flow director using side-band channel.
This patch adds definition ofFLOW_TYPE_MASKinto the header file. With this patch, user can now specify less than 4tuple(src ip, dsp ip, src port, dst port)for flow type tcp4/udp4.Signed-off-by Kiran Patil <[email protected]>Change-Id I90052508f8c172c0da5a4b78b949704b4a59ea78---
Testing Hints :
e.g. Using ethtoool, side-band filters are programmed such as:
ethtool -N p5p2 flow-type tcp4 src-ip 192.168.0.2 \
dst-ip 192.168.0.1 action 40
ethtool -N p5p2 flow-type tcp4 src-ip 192.168.0.2 action 41 ethtool -N p5p2 flow-type tcp4 dst-ip 192.168.0.1 action 42 ethtool -N p5p2 flow-type tcp4 dst-port 5001 action 43
What to look for to see if side-band filter is matched or not:
Look into port stats (using ethtool -S <ethx> | grep fdir) and specifically look for 'fdir_sb_match'. This counter should be incremented whenever filter is matched.
Quoted 5 lines
drivers/net/ethernet/intel/i40e/i40e.h | 6 ++ drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 116 +++++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +- 3 files changed, 123 insertions(+), 1 deletion(-)
Flow director filters work and counters propely increment
PATCH 7/13 i40e: Add device capability which defines if update is available.
In reply to Harshitha RamamurthyFrom: Michal Kosiarz <[email protected]>
Add device capability which defines if update is available and security check is needed during update process.
--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 1 + drivers/net/ethernet/intel/i40e/i40e_common.c | 6 ++++++ drivers/net/ethernet/intel/i40e/i40e_type.h | 5 +++++ drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_type.h | 5 +++++ 5 files changed, 18 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +1 -0
@@ -429,6 +429,7 @@ struct i40e_aqc_list_capabilities_element_resp {#define I40E_AQ_CAP_ID_SDP 0x0062#define I40E_AQ_CAP_ID_MDIO 0x0063#define I40E_AQ_CAP_ID_WSR_PROT 0x0064 +#define I40E_AQ_CAP_ID_NVM_MGMT 0x0080#define I40E_AQ_CAP_ID_FLEX10 0x00F1#define I40E_AQ_CAP_ID_CEM 0x00F2
drivers/net/ethernet/intel/i40e/i40e_common.c +6 -0
@@ -3138,6 +3138,12 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, p->wr_csr_prot = (u64 )number; p->wr_csr_prot |= (u64 )logical_id <<32 ;break ; +case I40E_AQ_CAP_ID_NVM_MGMT : +if (number &I40E_NVM_MGMT_SEC_REV_DISABLED ) + p->sec_rev_disabled = true; +if (number &I40E_NVM_MGMT_UPDATE_DISABLED ) + p->update_disabled = true; +break ;default :break ; }
drivers/net/ethernet/intel/i40e/i40e_type.h +5 -0
@@ -275,6 +275,11 @@ struct i40e_hw_capabilities {#define I40E_FLEX10_STATUS_DCC_ERROR 0x1#define I40E_FLEX10_STATUS_VC_MODE 0x2 +bool sec_rev_disabled; +bool update_disabled; +#define I40E_NVM_MGMT_SEC_REV_DISABLED 0x1 +#define I40E_NVM_MGMT_UPDATE_DISABLED 0x2 +bool mgmt_cem;bool ieee_1588;bool iwarp;
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +1 -0
@@ -426,6 +426,7 @@ struct i40e_aqc_list_capabilities_element_resp {#define I40E_AQ_CAP_ID_SDP 0x0062#define I40E_AQ_CAP_ID_MDIO 0x0063#define I40E_AQ_CAP_ID_WSR_PROT 0x0064 +#define I40E_AQ_CAP_ID_NVM_MGMT 0x0080#define I40E_AQ_CAP_ID_FLEX10 0x00F1#define I40E_AQ_CAP_ID_CEM 0x00F2
drivers/net/ethernet/intel/i40evf/i40e_type.h +5 -0
@@ -258,6 +258,11 @@ struct i40e_hw_capabilities {#define I40E_FLEX10_STATUS_DCC_ERROR 0x1#define I40E_FLEX10_STATUS_VC_MODE 0x2 +bool sec_rev_disabled; +bool update_disabled; +#define I40E_NVM_MGMT_SEC_REV_DISABLED 0x1 +#define I40E_NVM_MGMT_UPDATE_DISABLED 0x2 +bool mgmt_cem;bool ieee_1588;bool iwarp;
Signature · 1 line
2.4.3
Bowers
PATCH 7/13 i40e: Add device capability which defines if update is available.
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Kosiarz, Michal <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S33 07/13] i40e: Add device capability which defines if update is available.From: Michal Kosiarz <[email protected]>
Add device capability which defines if update is available and security check is needed during update process.
Signed-off-by Michal Kosiarz <[email protected]>Change-ID I380787c878275e1df18b39198df3ee3666342282
Quoted 7 lines
--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 1 + drivers/net/ethernet/intel/i40e/i40e_common.c | 6 ++++++ drivers/net/ethernet/intel/i40e/i40e_type.h | 5 +++++ drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_type.h | 5 +++++ 5 files changed, 18 insertions(+)
nvmupdate works as expected
PATCH 8/13 i40e: Add DeviceID for X722 QSFP+
In reply to Harshitha RamamurthyFrom: Kamil Krawczyk <[email protected]>
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 1 + drivers/net/ethernet/intel/i40e/i40e_devids.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_common.c | 1 + drivers/net/ethernet/intel/i40evf/i40e_devids.h | 1 + 4 files changed, 4 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_common.c +1 -0
@@ -61,6 +61,7 @@ static i40e_status i40e_set_mac_type(struct i40e_hw *hw)case I40E_DEV_ID_1G_BASE_T_X722 :case I40E_DEV_ID_10G_BASE_T_X722 :case I40E_DEV_ID_SFP_I_X722 : +case I40E_DEV_ID_QSFP_I_X722 : hw->mac.type =I40E_MAC_X722 ;break ;default :
drivers/net/ethernet/intel/i40e/i40e_devids.h +1 -0
@@ -45,6 +45,7 @@#define I40E_DEV_ID_1G_BASE_T_X722 0x37D1#define I40E_DEV_ID_10G_BASE_T_X722 0x37D2#define I40E_DEV_ID_SFP_I_X722 0x37D3 +#define I40E_DEV_ID_QSFP_I_X722 0x37D4#define i40e_is_40G_device (d) ((d) == I40E_DEV_ID_QSFP_A || \ (d) == I40E_DEV_ID_QSFP_B || \
drivers/net/ethernet/intel/i40evf/i40e_common.c +1 -0
@@ -59,6 +59,7 @@ i40e_status i40e_set_mac_type(struct i40e_hw *hw)case I40E_DEV_ID_1G_BASE_T_X722 :case I40E_DEV_ID_10G_BASE_T_X722 :case I40E_DEV_ID_SFP_I_X722 : +case I40E_DEV_ID_QSFP_I_X722 : hw->mac.type =I40E_MAC_X722 ;break ;case I40E_DEV_ID_X722_VF :
drivers/net/ethernet/intel/i40evf/i40e_devids.h +1 -0
@@ -45,6 +45,7 @@#define I40E_DEV_ID_1G_BASE_T_X722 0x37D1#define I40E_DEV_ID_10G_BASE_T_X722 0x37D2#define I40E_DEV_ID_SFP_I_X722 0x37D3 +#define I40E_DEV_ID_QSFP_I_X722 0x37D4#define I40E_DEV_ID_X722_VF 0x37CD#define I40E_DEV_ID_X722_VF_HV 0x37D9
Signature · 1 line
2.4.3
Bowers
PATCH 8/13 i40e: Add DeviceID for X722 QSFP+
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Krawczyk, Kamil <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S33 08/13] i40e: Add DeviceID for X722 QSFP+From: Kamil Krawczyk <[email protected]>
Quoted 8 lines
Signed-off-by Kamil Krawczyk <[email protected]>Change-ID I1370fbc7774e815ac1ad56561e97488e829592fc--- drivers/net/ethernet/intel/i40e/i40e_common.c | 1 + drivers/net/ethernet/intel/i40e/i40e_devids.h | 1 + drivers/net/ethernet/intel/i40evf/i40e_common.c | 1 + drivers/net/ethernet/intel/i40evf/i40e_devids.h | 1 + 4 files changed, 4 insertions(+)
Code changes applied, driver compiles correctly, hardware not available until WW24+
PATCH 9/13 i40e: Remove zero check
In reply to Harshitha RamamurthyFrom: Greg Rose <[email protected]>
A mirror rule ID may be zero so do not return invalid parameter when the user passes in a zero value for a rule ID.
---
Testing Hints : Ensure code compiles correctly.
drivers/net/ethernet/intel/i40e/i40e_common.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +1 -4
@@ -2668,10 +2668,7 @@ i40e_status i40e_aq_delete_mirrorrule(struct i40e_hw *hw, u16 sw_seid, u16 *rules_used, u16 *rules_free) {/* Rule ID has to be valid except rule_type: INGRESS VLAN mirroring */ -if (rule_type !=I40E_AQC_MIRROR_RULE_TYPE_VLAN ) { -if (!rule_id) -return I40E_ERR_PARAM ; - }else { +if (rule_type ==I40E_AQC_MIRROR_RULE_TYPE_VLAN ) {/* count and mr_list shall be valid for rule_type INGRESS VLAN * mirroring. For other rule_type, count and rule_type should * not matter.
Signature · 1 line
2.4.3
Bowers
PATCH 9/13 i40e: Remove zero check
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 09/13] i40e: Remove zero checkFrom: Greg Rose <[email protected]>
A mirror rule ID may be zero so do not return invalid parameter when the user passes in a zero value for a rule ID.
Quoted 7 lines
Signed-off-by Greg Rose <[email protected]>Change-ID I261b8c24725ce2c6ed32f859da81093dfcbe2970---
Testing Hints : Ensure code compiles correctly.drivers/net/ethernet/intel/i40e/i40e_common.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Driver compiles correctly
PATCH 10/13 i40e/i40evf: Only offload vlan tag if enabled
In reply to Harshitha RamamurthyFrom: Jesse Brandeburg <[email protected]>
The driver was offloading the vlan tag into the skb any time there was a vlan tag and the hardware stripping was enabled. Just check to make sure it's enabled before put_tag.
---
Testing Hints : Make sure ethtool control
over RX vlan tag insertion/removal still works.
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 ++- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -1
@@ -1370,7 +1370,8 @@ static void i40e_receive_skb(struct i40e_ring *rx_ring, {struct i40e_q_vector *q_vector = rx_ring->q_vector; -if (vlan_tag &VLAN_VID_MASK ) +if ((rx_ring->netdev->features &NETIF_F_HW_VLAN_CTAG_RX ) && + (vlan_tag &VLAN_VID_MASK ))__vlan_hwaccel_put_tag (skb,htons (ETH_P_8021Q ), vlan_tag);napi_gro_receive (&q_vector->napi, skb);
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +2 -1
@@ -842,7 +842,8 @@ static void i40e_receive_skb(struct i40e_ring *rx_ring, {struct i40e_q_vector *q_vector = rx_ring->q_vector; -if (vlan_tag &VLAN_VID_MASK ) +if ((rx_ring->netdev->features &NETIF_F_HW_VLAN_CTAG_RX ) && + (vlan_tag &VLAN_VID_MASK ))__vlan_hwaccel_put_tag (skb,htons (ETH_P_8021Q ), vlan_tag);napi_gro_receive (&q_vector->napi, skb);
Signature · 1 line
2.4.3
Bowers
PATCH 10/13 i40e/i40evf: Only offload vlan tag if enabled
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 10/13] i40e/i40evf: Only offload vlan tag if enabledFrom: Jesse Brandeburg <[email protected]>
The driver was offloading the vlan tag into the skb any time there was a vlan tag and the hardware stripping was enabled. Just check to make sure it's enabled before
put_tag.Signed-off-by Jesse Brandeburg <[email protected]>Change-Id Ife95290c06edd9a616393b38679923938b382241
Quoted 7 lines
---
Testing Hints : Make sure ethtool control over RX vlan tag insertion/removal still works.drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 ++- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
VLAN offloading can be enabled and disabled with ethtool and works correctly.
PATCH 11/13 i40e: Add promiscuous on VLAN support
In reply to Harshitha RamamurthyFrom: Greg Rose <[email protected]>
NFV use cases require the ability to steer packets to VSIs by VLAN tag alone while being in promiscuous mode for multicast and unicast MAC addresses. These two new functions support that ability.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 70 ++++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 8 +++ 2 files changed, 78 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_common.c +70 -0
@@ -2039,6 +2039,76 @@ i40e_status i40e_aq_set_vsi_multicast_promiscuous(struct i40e_hw *hw, }/** +* i40e_aq_set_vsi_mc_promisc_on_vlan +* @hw: pointer to the hw struct +* @seid: vsi number +* @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN +* @vid: The VLAN tag filter - capture any multicast packet with this VLAN tag +* @cmd_details: pointer to command details structure or NULL +**/ +enum i40e_status_code i40e_aq_set_vsi_mc_promisc_on_vlan (struct i40e_hw *hw, +u16 seid,bool enable, +u16 vid, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_set_vsi_promiscuous_modes *cmd = + (struct i40e_aqc_set_vsi_promiscuous_modes *)&desc.params.raw; +enum i40e_status_code status; +u16 flags =0 ; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_set_vsi_promiscuous_modes); + +if (enable) + flags |=I40E_AQC_SET_VSI_PROMISC_MULTICAST ; + + cmd->promiscuous_flags =cpu_to_le16 (flags); + cmd->valid_flags =cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_MULTICAST ); + cmd->seid =cpu_to_le16 (seid); + cmd->vlan_tag =cpu_to_le16 (vid |I40E_AQC_SET_VSI_VLAN_VALID ); + + status =i40e_asq_send_command (hw, &desc,NULL ,0 , cmd_details); + +return status; +} + +/** +* i40e_aq_set_vsi_uc_promisc_on_vlan +* @hw: pointer to the hw struct +* @seid: vsi number +* @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN +* @vid: The VLAN tag filter - capture any unicast packet with this VLAN tag +* @cmd_details: pointer to command details structure or NULL +**/ +enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan (struct i40e_hw *hw, +u16 seid,bool enable, +u16 vid, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_set_vsi_promiscuous_modes *cmd = + (struct i40e_aqc_set_vsi_promiscuous_modes *)&desc.params.raw; +enum i40e_status_code status; +u16 flags =0 ; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_set_vsi_promiscuous_modes); + +if (enable) + flags |=I40E_AQC_SET_VSI_PROMISC_UNICAST ; + + cmd->promiscuous_flags =cpu_to_le16 (flags); + cmd->valid_flags =cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_UNICAST ); + cmd->seid =cpu_to_le16 (seid); + cmd->vlan_tag =cpu_to_le16 (vid |I40E_AQC_SET_VSI_VLAN_VALID ); + + status =i40e_asq_send_command (hw, &desc,NULL ,0 , cmd_details); + +return status; +} + +/** * i40e_aq_set_vsi_broadcast * @hw: pointer to the hw struct * @seid: vsi number
drivers/net/ethernet/intel/i40e/i40e_prototype.h +8 -0
@@ -133,6 +133,14 @@ i40e_status i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, u16 vsi_id, bool set, struct i40e_asq_cmd_details *cmd_details);i40e_status i40e_aq_set_vsi_multicast_promiscuous (struct i40e_hw *hw,u16 vsi_id,bool set,struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_set_vsi_mc_promisc_on_vlan (struct i40e_hw *hw, +u16 seid,bool enable, +u16 vid, +struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan (struct i40e_hw *hw, +u16 seid,bool enable, +u16 vid, +struct i40e_asq_cmd_details *cmd_details);i40e_status i40e_aq_set_vsi_vlan_promisc (struct i40e_hw *hw,u16 seid,bool enable,struct i40e_asq_cmd_details *cmd_details);
Signature · 1 line
2.4.3
Bowers
PATCH 11/13 i40e: Add promiscuous on VLAN support
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 11/13] i40e: Add promiscuous on VLAN supportFrom: Greg Rose <[email protected]>
NFV use cases require the ability to steer packets to VSIs by VLAN tag alone while being in promiscuous mode for multicast and unicast MAC addresses. These two new functions support that ability.
Quoted 6 lines
Signed-off-by Greg Rose <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_common.c | 70 ++++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_prototype.h | 8 +++ 2 files changed, 78 insertions(+)
Promiscuous mode, packet steering works with VLAN traffic correctly
PATCH 12/13 i40e: Add VF promiscuous mode driver support
In reply to Harshitha RamamurthyFrom: Anjali Singhai Jain <[email protected]>
Add infrastructure for Network Function Virtualization VLAN tagged packet steering feature.
---
Testing Hints : Test the feature with
Ip link set dev veth0 promisc on (do this from the VF for the VF) Also test with adding vlan on VF plus port vlan for VF.
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 153 ++++++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 + 2 files changed, 149 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +147 -6
@@ -1427,6 +1427,25 @@ static void i40e_vc_reset_vf_msg(struct i40e_vf *vf) }/** +* i40e_getnum_vf_vsi_vlan_filters +* @vsi: pointer to the vsi +* +* called to get the number of vlans offloaded on this vf +**/ +static inline int i40e_getnum_vf_vsi_vlan_filters (struct i40e_vsi *vsi) +{ +struct i40e_mac_filter *f; +int num_vlans =0 ; + +list_for_each_entry (f, &vsi->mac_filter_list, list) { +if (f->vlan >=0 && f->vlan <=I40E_MAX_VLANID ) + num_vlans++; + } + +return num_vlans; +} + +/** * i40e_vc_config_promiscuous_mode_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer
@@ -1442,22 +1461,122 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, (struct i40e_virtchnl_promisc_info *)msg;struct i40e_pf *pf = vf->pf;struct i40e_hw *hw = &pf->hw; -struct i40e_vsi *vsi; +struct i40e_mac_filter *f; +i40e_status aq_ret =0 ;bool allmulti = false; -i40e_status aq_ret; +struct i40e_vsi *vsi; +bool alluni = false; +int aq_err =0 ; vsi =i40e_find_vsi_from_id (pf, info->vsi_id);if (!test_bit (I40E_VF_STAT_ACTIVE , &vf->vf_states) || !test_bit (I40E_VIRTCHNL_VF_CAP_PRIVILEGE , &vf->vf_caps) || - !i40e_vc_isvalid_vsi_id (vf, info->vsi_id) || - (vsi->type !=I40E_VSI_FCOE )) { + !i40e_vc_isvalid_vsi_id (vf, info->vsi_id)) { +dev_err (&pf->pdev->dev, +"VF %d doesn't meet requirements to enter promiscuous mode\n" , + vf->vf_id); aq_ret =I40E_ERR_PARAM ; goto error_param; } +/* Multicast promiscuous handling*/ if (info->flags &I40E_FLAG_VF_MULTICAST_PROMISC ) allmulti = true; - aq_ret =i40e_aq_set_vsi_multicast_promiscuous (hw, vsi->seid, - allmulti,NULL ); + +if (vf->port_vlan_id) { + aq_ret =i40e_aq_set_vsi_mc_promisc_on_vlan (hw, vsi->seid, + allmulti, + vf->port_vlan_id, +NULL ); + }else if (i40e_getnum_vf_vsi_vlan_filters (vsi)) { +list_for_each_entry (f, &vsi->mac_filter_list, list) { +if (f->vlan >=0 && f->vlan <=I40E_MAX_VLANID ) + aq_ret =i40e_aq_set_vsi_mc_promisc_on_vlan + (hw, + vsi->seid, + allmulti, + f->vlan, +NULL ); + aq_err = pf->hw.aq.asq_last_status; +if (aq_ret) { +dev_err (&pf->pdev->dev, +"Could not add VLAN %d to multicast promiscuous domain err %s aq_err %s\n" , + f->vlan, +i40e_stat_str (&pf->hw, aq_ret), +i40e_aq_str (&pf->hw, aq_err)); +break ; + } + } + }else { + aq_ret =i40e_aq_set_vsi_multicast_promiscuous (hw, vsi->seid, + allmulti,NULL ); + aq_err = pf->hw.aq.asq_last_status; +if (aq_ret) { +dev_err (&pf->pdev->dev, +"VF %d failed to set multicast promiscuous mode err %s aq_err %s\n" , + vf->vf_id, +i40e_stat_str (&pf->hw, aq_ret), +i40e_aq_str (&pf->hw, aq_err)); + goto error_param_int; + } + } + +if (!aq_ret) { +dev_info (&pf->pdev->dev, +"VF %d successfully set multicast promiscuous mode\n" , + vf->vf_id); +if (allmulti) +set_bit (I40E_VF_STAT_MC_PROMISC , &vf->vf_states); +else +clear_bit (I40E_VF_STAT_MC_PROMISC , &vf->vf_states); + } + +if (info->flags &I40E_FLAG_VF_UNICAST_PROMISC ) + alluni = true; +if (vf->port_vlan_id) { + aq_ret =i40e_aq_set_vsi_uc_promisc_on_vlan (hw, vsi->seid, + alluni, + vf->port_vlan_id, +NULL ); + }else if (i40e_getnum_vf_vsi_vlan_filters (vsi)) { +list_for_each_entry (f, &vsi->mac_filter_list, list) { + aq_ret =0 ; +if (f->vlan >=0 && f->vlan <=I40E_MAX_VLANID ) + aq_ret = +i40e_aq_set_vsi_uc_promisc_on_vlan (hw, + vsi->seid, + alluni, + f->vlan, +NULL ); + aq_err = pf->hw.aq.asq_last_status; +if (aq_ret) +dev_err (&pf->pdev->dev, +"Could not add VLAN %d to Unicast promiscuous domain err %s aq_err %s\n" , + f->vlan, +i40e_stat_str (&pf->hw, aq_ret), +i40e_aq_str (&pf->hw, aq_err)); + } + }else { + aq_ret =i40e_aq_set_vsi_unicast_promiscuous (hw, vsi->seid, + allmulti,NULL ); + aq_err = pf->hw.aq.asq_last_status; +if (aq_ret) +dev_err (&pf->pdev->dev, +"VF %d failed to set unicast promiscuous mode %8.8x err %s aq_err %s\n" , + vf->vf_id, info->flags, +i40e_stat_str (&pf->hw, aq_ret), +i40e_aq_str (&pf->hw, aq_err)); + } + +error_param_int: +if (!aq_ret) { +dev_info (&pf->pdev->dev, +"VF %d successfully set unicast promiscuous mode\n" , + vf->vf_id); +if (alluni) +set_bit (I40E_VF_STAT_UC_PROMISC , &vf->vf_states); +else +clear_bit (I40E_VF_STAT_UC_PROMISC , &vf->vf_states); + } error_param:/* send the response to the VF */
@@ -1919,6 +2038,17 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)/* add new VLAN filter */ int ret =i40e_vsi_add_vlan (vsi, vfl->vlan_id[i]); +if (test_bit (I40E_VF_STAT_UC_PROMISC , &vf->vf_states)) +i40e_aq_set_vsi_uc_promisc_on_vlan (&pf->hw, vsi->seid, + true, + vfl->vlan_id[i], +NULL ); +if (test_bit (I40E_VF_STAT_MC_PROMISC , &vf->vf_states)) +i40e_aq_set_vsi_mc_promisc_on_vlan (&pf->hw, vsi->seid, + true, + vfl->vlan_id[i], +NULL ); +if (ret) dev_err(&pf->pdev->dev, "Unable to add VLAN filter %d for VF %d, error %d\n",
@@ -1971,6 +2101,17 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)for (i =0 ; i < vfl->num_elements; i++) {int ret =i40e_vsi_kill_vlan (vsi, vfl->vlan_id[i]); +if (test_bit (I40E_VF_STAT_UC_PROMISC , &vf->vf_states)) +i40e_aq_set_vsi_uc_promisc_on_vlan (&pf->hw, vsi->seid, + false, + vfl->vlan_id[i], +NULL ); +if (test_bit (I40E_VF_STAT_MC_PROMISC , &vf->vf_states)) +i40e_aq_set_vsi_mc_promisc_on_vlan (&pf->hw, vsi->seid, + false, + vfl->vlan_id[i], +NULL ); +if (ret) dev_err(&pf->pdev->dev, "Unable to delete VLAN filter %d for VF %d, error %d\n",
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +2 -0
@@ -61,6 +61,8 @@ enum i40e_vf_states {I40E_VF_STAT_IWARPENA ,I40E_VF_STAT_FCOEENA ,I40E_VF_STAT_DISABLED , +I40E_VF_STAT_MC_PROMISC , + I40E_VF_STAT_UC_PROMISC, };/* VF capabilities */
Signature · 1 line
2.4.3
Bowers
PATCH 12/13 i40e: Add VF promiscuous mode driver support
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 12/13] i40e: Add VF promiscuous mode driver supportFrom: Anjali Singhai Jain <[email protected]>
Add infrastructure for Network Function Virtualization VLAN tagged packet steering feature.
Signed-off-by Anjali Singhai Jain <[email protected]>Signed-off-by Greg Rose <[email protected]>Change-Id I9b873d8fcc253858e6baba65ac68ec5b9363944e---
Testing Hints : Test the feature with
Ip link set dev veth0 promisc on (do this from the VF for the VF) Also test with adding vlan on VF plus port vlan for VF.
Quoted 4 lines
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 153 ++++++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 + 2 files changed, 149 insertions(+), 6 deletions(-)
Promiscuous mode can be enabled on VF driver
PATCH 13/13 i40evf: Add driver support for promiscuous mode
In reply to Harshitha RamamurthyFrom: Anjali Singhai Jain <[email protected]>
Add necessary Linux Ethernet driver support for promiscuous mode operation. Add a flag so the VF knows it is in promiscuous mode and two state flags to discreetly track multicast and unicast promiscuous states.
---
Testing Hints : Test using
ip link set dev eXX promisc on/off
on the vf
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 14 +++++++------- drivers/net/ethernet/intel/i40evf/i40evf.h | 3 +++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 19 +++++++++++++++++++ drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 11 +++++++++++ 4 files changed, 40 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +7 -7
@@ -1489,13 +1489,13 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, NULL); }else if (i40e_getnum_vf_vsi_vlan_filters (vsi)) {list_for_each_entry (f, &vsi->mac_filter_list, list) { -if (f->vlan >=0 && f->vlan <=I40E_MAX_VLANID ) - aq_ret =i40e_aq_set_vsi_mc_promisc_on_vlan - (hw, - vsi->seid, - allmulti, - f->vlan, -NULL ); +if (f->vlan <0 || f->vlan >I40E_MAX_VLANID ) +continue ; + aq_ret =i40e_aq_set_vsi_mc_promisc_on_vlan (hw, + vsi->seid, + allmulti, + f->vlan, +NULL ); aq_err = pf->hw.aq.asq_last_status;if (aq_ret) { dev_err(&pf->pdev->dev,
drivers/net/ethernet/intel/i40evf/i40evf.h +3 -0
@@ -220,6 +220,7 @@ struct i40evf_adapter {#define I40EVF_FLAG_WB_ON_ITR_CAPABLE BIT(11)#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(12)#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(13) +#define I40EVF_FLAG_PROMISC_ON BIT(15)/* duplicates for common code */ #define I40E_FLAG_FDIR_ATR_ENABLED 0#define I40E_FLAG_DCB_ENABLED 0
@@ -244,6 +245,8 @@ struct i40evf_adapter {#define I40EVF_FLAG_AQ_SET_HENA BIT(12)#define I40EVF_FLAG_AQ_SET_RSS_KEY BIT(13)#define I40EVF_FLAG_AQ_SET_RSS_LUT BIT(14) +#define I40EVF_FLAG_AQ_REQUEST_PROMISC BIT(15) +#define I40EVF_FLAG_AQ_RELEASE_PROMISC BIT(16)/* OS defined structs */ struct net_device *netdev;
drivers/net/ethernet/intel/i40evf/i40evf_main.c +19 -0
@@ -943,6 +943,14 @@ static void i40evf_set_rx_mode(struct net_device *netdev) bottom_of_search_loop:continue ; } + +if (netdev->flags &IFF_PROMISC && + !(adapter->flags &I40EVF_FLAG_PROMISC_ON )) + adapter->aq_required |=I40EVF_FLAG_AQ_REQUEST_PROMISC ; +else if (!(netdev->flags &IFF_PROMISC ) && + adapter->flags &I40EVF_FLAG_PROMISC_ON ) + adapter->aq_required |=I40EVF_FLAG_AQ_RELEASE_PROMISC ; +clear_bit (__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); }
@@ -1622,6 +1630,17 @@ static void i40evf_watchdog_task(struct work_struct *work) goto watchdog_done; } +if (adapter->aq_required &I40EVF_FLAG_AQ_REQUEST_PROMISC ) { +i40evf_set_promiscuous (adapter,I40E_FLAG_VF_UNICAST_PROMISC | +I40E_FLAG_VF_MULTICAST_PROMISC ); + goto watchdog_done; + } + +if (adapter->aq_required &I40EVF_FLAG_AQ_RELEASE_PROMISC ) { +i40evf_set_promiscuous (adapter,0 ); + goto watchdog_done; + } +if (adapter->state == __I40EVF_RUNNING)i40evf_request_stats (adapter); watchdog_done:
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +11 -0
@@ -652,6 +652,17 @@ void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags) adapter->current_op);return ; } + +if (flags) { + adapter->flags |=I40EVF_FLAG_PROMISC_ON ; + adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_PROMISC ; +dev_info (&adapter->pdev->dev,"Entering promiscuous mode\n" ); + }else { + adapter->flags &= ~I40EVF_FLAG_PROMISC_ON ; + adapter->aq_required &= ~I40EVF_FLAG_AQ_RELEASE_PROMISC ; +dev_info (&adapter->pdev->dev,"Leaving promiscuous mode\n" ); + } + adapter->current_op =I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE ; vpi.vsi_id = adapter->vsi_res->vsi_id; vpi.flags = flags;
Signature · 1 line
2.4.3
Bowers
PATCH 13/13 i40evf: Add driver support for promiscuous mode
Quoted 23 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Harshitha Ramamurthy
Sent: Tuesday, April 12, 2016 8:31 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S33 13/13] i40evf: Add driver support for promiscuous modeFrom: Anjali Singhai Jain <[email protected]>
Add necessary Linux Ethernet driver support for promiscuous mode operation. Add a flag so the VF knows it is in promiscuous mode and two state flags to discreetly track multicast and unicast promiscuous states.
Signed-off-by Anjali Singhai Jain <[email protected]>Signed-off-by Greg Rose <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Change-Id Ib2f2dc7a7582304fec90fc917ebb7ded21ba1de4---
Testing Hints : Test using
ip link set dev eXX promisc on/off
on the vf
Quoted 6 lines
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 14 +++++++------- drivers/net/ethernet/intel/i40evf/i40evf.h | 3 +++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 19 +++++++++++++++++++ drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 11 +++++++++++ 4 files changed, 40 insertions(+), 7 deletions(-)
Promiscuous mode can be enabled on VF driver