Commit a9219b33 authored by Przemyslaw Patynowski's avatar Przemyslaw Patynowski Committed by Tony Nguyen
Browse files

i40e: VLAN field for flow director



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.

Signed-off-by: default avatarPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent efca91e8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -223,6 +223,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;
+29 −1
Original line number Diff line number Diff line
@@ -3318,6 +3318,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;

@@ -4350,6 +4358,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;

@@ -4529,7 +4550,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;
@@ -4688,6 +4711,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 ||
+256 −291

File changed.

Preview size limit exceeded, changes collapsed.

+2 −0
Original line number Diff line number Diff line
@@ -1421,6 +1421,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)