i40e: VLAN field for flow director
Subsystems (2)
PATCH v4 2/2 i40e: VLAN field for flow director
From: Przemyslaw Patynowski <[email protected]>
Allow user to specify VLAN field and add it to flow director. Show VLAN field in "ethtool -n ethx" command.
Handle VLAN type and tag field provided by ethtool command. Refactored filter addition, by replacing static arrays with runtime dummy packet creation, which allows specifying VLAN field.
Previously, VLAN field was omitted.
v2: Fixed kernel test robot warnings
Quoted 2 lines
Quoted 2 lines
drivers/net/ethernet/intel/i40e/i40e_txrx.c:547:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
Signed-off-by Przemyslaw Patynowski <[email protected]>
Reported-by kernel test robot <[email protected]>
--- drivers/net/ethernet/intel/i40e/i40e.h | 2 + .../net/ethernet/intel/i40e/i40e_ethtool.c | 30 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 547 ++++++++---------- drivers/net/ethernet/intel/i40e/i40e_type.h | 2 + 4 files changed, 289 insertions(+), 292 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +2 -0
@@ -219,6 +219,8 @@ struct i40e_fdir_filter {__be16 dst_port;__be32 sctp_v_tag; +__be16 vlan_etype; +__be16 vlan_tag;/* Flexible data to match within the packet payload */ __be16 flex_word;u16 flex_offset;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +29 -1
@@ -3325,6 +3325,14 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,else fsp->ring_cookie = rule->q_index; +if (rule->vlan_tag) { + fsp->h_ext.vlan_etype = rule->vlan_etype; + fsp->m_ext.vlan_etype =htons (0xFFFF ); + fsp->h_ext.vlan_tci = rule->vlan_tag; + fsp->m_ext.vlan_tci =htons (0xFFFF ); + fsp->flow_type |=FLOW_EXT ; + } +if (rule->dest_vsi != pf->vsi[pf->lan_vsi]->id) {struct i40e_vsi *vsi;
@@ -4357,6 +4365,19 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,return -EOPNOTSUPP ; } +if (fsp->flow_type &FLOW_EXT ) { +/* Allow only 802.1Q and no etype defined, as +* later it's modified to 0x8100 +*/ +if (fsp->h_ext.vlan_etype !=htons (ETH_P_8021Q ) && + fsp->h_ext.vlan_etype !=0 ) +return -EOPNOTSUPP ; +if (fsp->m_ext.vlan_tci ==htons (0xFFFF )) + new_mask |=I40E_VLAN_SRC_MASK ; +else + new_mask &= ~I40E_VLAN_SRC_MASK ; + } +/* First, clear all flexible filter entries */ new_mask &= ~I40E_FLEX_INPUT_MASK ;
@@ -4536,7 +4557,9 @@ static bool i40e_match_fdir_filter(struct i40e_fdir_filter *a, a->dst_port != b->dst_port || a->src_port != b->src_port || a->flow_type != b->flow_type || - a->ipl4_proto != b->ipl4_proto) + a->ipl4_proto != b->ipl4_proto || + a->vlan_tag != b->vlan_tag || + a->vlan_etype != b->vlan_etype) return false;return true;
@@ -4695,6 +4718,11 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, input->src_ip = fsp->h_u.tcp_ip4_spec.ip4dst; input->flow_type = fsp->flow_type & ~FLOW_EXT ; + input->vlan_etype = fsp->h_ext.vlan_etype; +if (!fsp->m_ext.vlan_etype && fsp->h_ext.vlan_tci) + input->vlan_etype =cpu_to_be16 (ETH_P_8021Q ); +if (fsp->m_ext.vlan_tci && input->vlan_etype) + input->vlan_tag = fsp->h_ext.vlan_tci; if (input->flow_type == IPV6_USER_FLOW || input->flow_type == UDP_V6_FLOW || input->flow_type == TCP_V6_FLOW ||
drivers/net/ethernet/intel/i40e/i40e_txrx.c +256 -291
675 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_type.h +2 -0
@@ -1420,6 +1420,8 @@ struct i40e_lldp_variables {#define I40E_L4_DST_MASK (0x1ULL << I40E_L4_DST_SHIFT)#define I40E_VERIFY_TAG_SHIFT 31#define I40E_VERIFY_TAG_MASK (0x3ULL << I40E_VERIFY_TAG_SHIFT) +#define I40E_VLAN_SRC_SHIFT 55 +#define I40E_VLAN_SRC_MASK (0x1ULL << I40E_VLAN_SRC_SHIFT)#define I40E_FLEX_50_SHIFT 13#define I40E_FLEX_50_MASK (0x1ULL << I40E_FLEX_50_SHIFT)
Signature · 7 lines
2.17.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN. Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie 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.