All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups
@ 2017-02-06 22:38 Jacob Keller
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 01/11] i40e: send correct port number to AdminQ when enabling UDP tunnels Jacob Keller
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

This series is PART1 of 2 parts, containing some initial fixups for the
ethtool ntuple filter API. The first part should be relatively
self-contained and each fix should stand on its own. It is textually
necessary for this series to land before PART2 can be applied.

Jacob Keller (11):
  i40e: send correct port number to AdminQ when enabling UDP tunnels
  i40e: don't use arrays for (src|dst)_ip
  i40e: rework exit flow of i40e_add_fdir_ethtool
  i40e: return immediately when failing to add fdir filter
  i40e: exit ATR mode only when adding TCP/IPv4 filter succeeds
  i40e: remove redundant check for fd_tcp_rule when restoring filters
  i40e: reset fd_tcp_rule count when restoring filters
  i40e: don't re-enable ATR when flushing filters if SB has TCP4/IPv4
    rules
  i40e: add counters for UDP/IPv4 and IPv4 filters
  i40e: explicitly fail on extended MAC field for ethtool_rx_flow_spec
  i40e: always remove old filter when adding new FDir filter

 drivers/net/ethernet/intel/i40e/i40e.h         | 16 +++--
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 59 ++++++++----------
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 43 +++++++------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 84 ++++++++++++++------------
 4 files changed, 105 insertions(+), 97 deletions(-)

-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 01/11] i40e: send correct port number to AdminQ when enabling UDP tunnels
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-17 19:06   ` Bowers, AndrewX
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 02/11] i40e: don't use arrays for (src|dst)_ip Jacob Keller
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

The firmware expects the port numbers for offloaded UDP tunnels in
Little Endian format. We accidentally sent the value in Big Endian
format which obviously will cause the wrong port number to be put into
the UDP tunnels list. This results in VxLAN and Geneve tunnel Rx
offloads being essentially disabled, unless the port number happens to
be identical after byte swapping. Note that i40e_aq_add_udp_tunnel()
will byteswap the parameter from host order into Little Endian so we
don't need worry about passing strictly a __le16 value to the command.

This patch essentially reverts b3f5c7bc88ba ("i40e: Fix for extra byte
swap in tunnel setup", 2016-08-24), but in a way that makes the result
much more clear to the reader.

Fixes: b3f5c7bc88ba ("i40e: Fix for extra byte swap in tunnel setup", 2016-08-24)
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h      |  3 ++-
 drivers/net/ethernet/intel/i40e/i40e_main.c | 17 ++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 43c041d82fe4..8bb6c5c88fce 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -248,7 +248,8 @@ struct i40e_tc_configuration {
 };
 
 struct i40e_udp_port_config {
-	__be16 index;
+	/* AdminQ command interface expects port number in Host byte order */
+	u16 index;
 	u8 type;
 };
 
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index d8a10a10da86..8414973cebef 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7494,7 +7494,7 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = &pf->hw;
 	i40e_status ret;
-	__be16 port;
+	u16 port;
 	int i;
 
 	if (!(pf->flags & I40E_FLAG_UDP_FILTER_SYNC))
@@ -7518,7 +7518,7 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)
 					"%s %s port %d, index %d failed, err %s aq_err %s\n",
 					pf->udp_ports[i].type ? "vxlan" : "geneve",
 					port ? "add" : "delete",
-					ntohs(port), i,
+					port, i,
 					i40e_stat_str(&pf->hw, ret),
 					i40e_aq_str(&pf->hw,
 						    pf->hw.aq.asq_last_status));
@@ -9201,7 +9201,7 @@ static int i40e_set_features(struct net_device *netdev,
  *
  * Returns the index number or I40E_MAX_PF_UDP_OFFLOAD_PORTS if port not found
  **/
-static u8 i40e_get_udp_port_idx(struct i40e_pf *pf, __be16 port)
+static u8 i40e_get_udp_port_idx(struct i40e_pf *pf, u16 port)
 {
 	u8 i;
 
@@ -9224,7 +9224,7 @@ static void i40e_udp_tunnel_add(struct net_device *netdev,
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
-	__be16 port = ti->port;
+	u16 port = ntohs(ti->port);
 	u8 next_idx;
 	u8 idx;
 
@@ -9232,8 +9232,7 @@ static void i40e_udp_tunnel_add(struct net_device *netdev,
 
 	/* Check if port already exists */
 	if (idx < I40E_MAX_PF_UDP_OFFLOAD_PORTS) {
-		netdev_info(netdev, "port %d already offloaded\n",
-			    ntohs(port));
+		netdev_info(netdev, "port %d already offloaded\n", port);
 		return;
 	}
 
@@ -9242,7 +9241,7 @@ static void i40e_udp_tunnel_add(struct net_device *netdev,
 
 	if (next_idx == I40E_MAX_PF_UDP_OFFLOAD_PORTS) {
 		netdev_info(netdev, "maximum number of offloaded UDP ports reached, not adding port %d\n",
-			    ntohs(port));
+			    port);
 		return;
 	}
 
@@ -9276,7 +9275,7 @@ static void i40e_udp_tunnel_del(struct net_device *netdev,
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
-	__be16 port = ti->port;
+	u16 port = ntohs(ti->port);
 	u8 idx;
 
 	idx = i40e_get_udp_port_idx(pf, port);
@@ -9308,7 +9307,7 @@ static void i40e_udp_tunnel_del(struct net_device *netdev,
 	return;
 not_found:
 	netdev_warn(netdev, "UDP port %d was not found, not deleting\n",
-		    ntohs(port));
+		    port);
 }
 
 static int i40e_get_phys_port_id(struct net_device *netdev,
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 02/11] i40e: don't use arrays for (src|dst)_ip
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 01/11] i40e: send correct port number to AdminQ when enabling UDP tunnels Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-06 17:42   ` Bowers, AndrewX
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 03/11] i40e: rework exit flow of i40e_add_fdir_ethtool Jacob Keller
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

The code originally included src_ip and dst_ip with enough space to
support ipv6 filters. However, no actual support for ipv6 filters has
been implemented. Thus, remove the arrays and just use __be32 values.
Should ipv6 support be added in the future, we can replace these with
a union that has sizes for both values.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Change-Id: I1bc04032244a80eb6ebc8a4e6c723a4a665c1dd5
---
 drivers/net/ethernet/intel/i40e/i40e.h         |  4 ++--
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++++++------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 12 ++++++------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 8bb6c5c88fce..e4ac2b782d80 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -212,8 +212,8 @@ struct i40e_fdir_filter {
 	u8 flow_type;
 	u8 ip4_proto;
 	/* TX packet view of src and dst */
-	__be32 dst_ip[4];
-	__be32 src_ip[4];
+	__be32 dst_ip;
+	__be32 src_ip;
 	__be16 src_port;
 	__be16 dst_port;
 	__be32 sctp_v_tag;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 4d08f1997f69..9ba3f18f2e8b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2368,8 +2368,8 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,
 	 */
 	fsp->h_u.tcp_ip4_spec.psrc = rule->dst_port;
 	fsp->h_u.tcp_ip4_spec.pdst = rule->src_port;
-	fsp->h_u.tcp_ip4_spec.ip4src = rule->dst_ip[0];
-	fsp->h_u.tcp_ip4_spec.ip4dst = rule->src_ip[0];
+	fsp->h_u.tcp_ip4_spec.ip4src = rule->dst_ip;
+	fsp->h_u.tcp_ip4_spec.ip4dst = rule->src_ip;
 
 	if (rule->dest_ctl == I40E_FILTER_PROGRAM_DESC_DEST_DROP_PACKET)
 		fsp->ring_cookie = RX_CLS_FLOW_DISC;
@@ -2592,8 +2592,8 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
 static bool i40e_match_fdir_input_set(struct i40e_fdir_filter *rule,
 				      struct i40e_fdir_filter *input)
 {
-	if ((rule->dst_ip[0] != input->dst_ip[0]) ||
-	    (rule->src_ip[0] != input->src_ip[0]) ||
+	if ((rule->dst_ip != input->dst_ip) ||
+	    (rule->src_ip != input->src_ip) ||
 	    (rule->dst_port != input->dst_port) ||
 	    (rule->src_port != input->src_port))
 		return false;
@@ -2769,8 +2769,8 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
 	 */
 	input->dst_port = fsp->h_u.tcp_ip4_spec.psrc;
 	input->src_port = fsp->h_u.tcp_ip4_spec.pdst;
-	input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src;
-	input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst;
+	input->dst_ip = fsp->h_u.tcp_ip4_spec.ip4src;
+	input->src_ip = fsp->h_u.tcp_ip4_spec.ip4dst;
 
 	if (ntohl(fsp->m_ext.data[1])) {
 		vf_id = ntohl(fsp->h_ext.data[1]);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 329c8d8e64b1..3b0c9364763e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -220,9 +220,9 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi,
 	udp = (struct udphdr *)(raw_packet + IP_HEADER_OFFSET
 	      + sizeof(struct iphdr));
 
-	ip->daddr = fd_data->dst_ip[0];
+	ip->daddr = fd_data->dst_ip;
 	udp->dest = fd_data->dst_port;
-	ip->saddr = fd_data->src_ip[0];
+	ip->saddr = fd_data->src_ip;
 	udp->source = fd_data->src_port;
 
 	fd_data->pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
@@ -282,9 +282,9 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
 	tcp = (struct tcphdr *)(raw_packet + IP_HEADER_OFFSET
 	      + sizeof(struct iphdr));
 
-	ip->daddr = fd_data->dst_ip[0];
+	ip->daddr = fd_data->dst_ip;
 	tcp->dest = fd_data->dst_port;
-	ip->saddr = fd_data->src_ip[0];
+	ip->saddr = fd_data->src_ip;
 	tcp->source = fd_data->src_port;
 
 	if (add) {
@@ -360,8 +360,8 @@ static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi,
 		memcpy(raw_packet, packet, I40E_IP_DUMMY_PACKET_LEN);
 		ip = (struct iphdr *)(raw_packet + IP_HEADER_OFFSET);
 
-		ip->saddr = fd_data->src_ip[0];
-		ip->daddr = fd_data->dst_ip[0];
+		ip->saddr = fd_data->src_ip;
+		ip->daddr = fd_data->dst_ip;
 		ip->protocol = 0;
 
 		fd_data->pctype = i;
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 03/11] i40e: rework exit flow of i40e_add_fdir_ethtool
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 01/11] i40e: send correct port number to AdminQ when enabling UDP tunnels Jacob Keller
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 02/11] i40e: don't use arrays for (src|dst)_ip Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-06 17:43   ` Bowers, AndrewX
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 04/11] i40e: return immediately when failing to add fdir filter Jacob Keller
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

Refactor the exit flow of the i40e_add_fdir_ethtool function. Move the
input_label to the end of the function, removing the dependency on
having a non-zero return value. Add a comment explaining why it is ok
not to free the fdir data structure, because the structure is now stored
in the fdir_filter_list.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Change-Id: I723342181d59cd0c9f3b31140c37961ba37bb242
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 9ba3f18f2e8b..cfe4db974c8e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2790,12 +2790,19 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
 	}
 
 	ret = i40e_add_del_fdir(vsi, input, true);
-free_input:
 	if (ret)
-		kfree(input);
-	else
-		i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL);
+		goto free_input;
 
+	/* Add the input filter to the fdir_input_list, possibly replacing
+	 * a previous filter. Do not free the input structure after adding it
+	 * to the list as this would cause a use-after-free bug.
+	 */
+	i40e_update_ethtool_fdir_entry(vsi, input, fsp->location, NULL);
+
+	return 0;
+
+free_input:
+	kfree(input);
 	return ret;
 }
 
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 04/11] i40e: return immediately when failing to add fdir filter
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
                   ` (2 preceding siblings ...)
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 03/11] i40e: rework exit flow of i40e_add_fdir_ethtool Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-06 17:44   ` Bowers, AndrewX
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 05/11] i40e: exit ATR mode only when adding TCP/IPv4 filter succeeds Jacob Keller
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

Instead of setting err=true and checking this to determine when to free
the raw_packet near the end of the function, simply kfree and return
immediately. The resulting code is a bit cleaner and has one less
variable. This also resolves a subtle bug in the ipv4 case which could
fail to add the first filter and then never free the memory, resulting
in a small memory leak.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Dayanand, Avinash <avinash.dayanand@intel.com>
Reviewed-by: Brady, Alan <alan.brady@intel.com>
Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
Change-ID: I7583aac033481dc794b4acaa14445059c8930ff1
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 33 ++++++++++++-----------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 3b0c9364763e..8924ee6e7773 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -204,7 +204,6 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi,
 	struct i40e_pf *pf = vsi->back;
 	struct udphdr *udp;
 	struct iphdr *ip;
-	bool err = false;
 	u8 *raw_packet;
 	int ret;
 	static char packet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0,
@@ -231,7 +230,9 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi,
 		dev_info(&pf->pdev->dev,
 			 "PCTYPE:%d, Filter command send failed for fd_id:%d (ret = %d)\n",
 			 fd_data->pctype, fd_data->fd_id, ret);
-		err = true;
+		/* Free the packet buffer since it wasn't added to the ring */
+		kfree(raw_packet);
+		return -EOPNOTSUPP;
 	} else if (I40E_DEBUG_FD & pf->hw.debug_mask) {
 		if (add)
 			dev_info(&pf->pdev->dev,
@@ -242,10 +243,8 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi,
 				 "Filter deleted for PCTYPE %d loc = %d\n",
 				 fd_data->pctype, fd_data->fd_id);
 	}
-	if (err)
-		kfree(raw_packet);
 
-	return err ? -EOPNOTSUPP : 0;
+	return 0;
 }
 
 #define I40E_TCPIP_DUMMY_PACKET_LEN 54
@@ -264,7 +263,6 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
 	struct i40e_pf *pf = vsi->back;
 	struct tcphdr *tcp;
 	struct iphdr *ip;
-	bool err = false;
 	u8 *raw_packet;
 	int ret;
 	/* Dummy packet */
@@ -306,12 +304,13 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
 
 	fd_data->pctype = I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
 	ret = i40e_program_fdir_filter(fd_data, raw_packet, pf, add);
-
 	if (ret) {
 		dev_info(&pf->pdev->dev,
 			 "PCTYPE:%d, Filter command send failed for fd_id:%d (ret = %d)\n",
 			 fd_data->pctype, fd_data->fd_id, ret);
-		err = true;
+		/* Free the packet buffer since it wasn't added to the ring */
+		kfree(raw_packet);
+		return -EOPNOTSUPP;
 	} else if (I40E_DEBUG_FD & pf->hw.debug_mask) {
 		if (add)
 			dev_info(&pf->pdev->dev, "Filter OK for PCTYPE %d loc = %d)\n",
@@ -322,10 +321,7 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
 				 fd_data->pctype, fd_data->fd_id);
 	}
 
-	if (err)
-		kfree(raw_packet);
-
-	return err ? -EOPNOTSUPP : 0;
+	return 0;
 }
 
 #define I40E_IP_DUMMY_PACKET_LEN 34
@@ -344,7 +340,6 @@ static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi,
 {
 	struct i40e_pf *pf = vsi->back;
 	struct iphdr *ip;
-	bool err = false;
 	u8 *raw_packet;
 	int ret;
 	int i;
@@ -366,12 +361,15 @@ static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi,
 
 		fd_data->pctype = i;
 		ret = i40e_program_fdir_filter(fd_data, raw_packet, pf, add);
-
 		if (ret) {
 			dev_info(&pf->pdev->dev,
 				 "PCTYPE:%d, Filter command send failed for fd_id:%d (ret = %d)\n",
 				 fd_data->pctype, fd_data->fd_id, ret);
-			err = true;
+			/* The packet buffer wasn't added to the ring so we
+			 * need to free it now.
+			 */
+			kfree(raw_packet);
+			return -EOPNOTSUPP;
 		} else if (I40E_DEBUG_FD & pf->hw.debug_mask) {
 			if (add)
 				dev_info(&pf->pdev->dev,
@@ -384,10 +382,7 @@ static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi,
 		}
 	}
 
-	if (err)
-		kfree(raw_packet);
-
-	return err ? -EOPNOTSUPP : 0;
+	return 0;
 }
 
 /**
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 05/11] i40e: exit ATR mode only when adding TCP/IPv4 filter succeeds
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
                   ` (3 preceding siblings ...)
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 04/11] i40e: return immediately when failing to add fdir filter Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-17 19:07   ` Bowers, AndrewX
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 06/11] i40e: remove redundant check for fd_tcp_rule when restoring filters Jacob Keller
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

Move ATR exit check after we have sent the TCP/IPv4 filter to the ring
successfully. This avoids an issue where we potentially update the
filter count without actually succeeding in adding the filter. Now, we
only increment the fd_tcp_rule after we've succeeded. Additionally, we
will re-enable ATR mode only after deletion of the filter is actually
posted to the FDIR ring.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
Change-ID: If5c1dea422081cc5e2de65618b01b4c3bf6bd586
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 34 ++++++++++++++---------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 8924ee6e7773..5756139636ff 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -285,23 +285,6 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
 	ip->saddr = fd_data->src_ip;
 	tcp->source = fd_data->src_port;
 
-	if (add) {
-		pf->fd_tcp_rule++;
-		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
-		    I40E_DEBUG_FD & pf->hw.debug_mask)
-			dev_info(&pf->pdev->dev, "Forcing ATR off, sideband rules for TCP/IPv4 flow being applied\n");
-		pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED;
-	} else {
-		pf->fd_tcp_rule = (pf->fd_tcp_rule > 0) ?
-				  (pf->fd_tcp_rule - 1) : 0;
-		if (pf->fd_tcp_rule == 0) {
-			if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
-			    I40E_DEBUG_FD & pf->hw.debug_mask)
-				dev_info(&pf->pdev->dev, "ATR re-enabled due to no sideband TCP/IPv4 rules\n");
-			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
-		}
-	}
-
 	fd_data->pctype = I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
 	ret = i40e_program_fdir_filter(fd_data, raw_packet, pf, add);
 	if (ret) {
@@ -321,6 +304,23 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
 				 fd_data->pctype, fd_data->fd_id);
 	}
 
+	if (add) {
+		pf->fd_tcp_rule++;
+		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
+		    I40E_DEBUG_FD & pf->hw.debug_mask)
+			dev_info(&pf->pdev->dev, "Forcing ATR off, sideband rules for TCP/IPv4 flow being applied\n");
+		pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED;
+	} else {
+		pf->fd_tcp_rule = (pf->fd_tcp_rule > 0) ?
+				  (pf->fd_tcp_rule - 1) : 0;
+		if (pf->fd_tcp_rule == 0) {
+			if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
+			    I40E_DEBUG_FD & pf->hw.debug_mask)
+				dev_info(&pf->pdev->dev, "ATR re-enabled due to no sideband TCP/IPv4 rules\n");
+			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
+		}
+	}
+
 	return 0;
 }
 
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 06/11] i40e: remove redundant check for fd_tcp_rule when restoring filters
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
                   ` (4 preceding siblings ...)
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 05/11] i40e: exit ATR mode only when adding TCP/IPv4 filter succeeds Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-17 19:08   ` Bowers, AndrewX
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 07/11] i40e: reset fd_tcp_rule count " Jacob Keller
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

i40e_fdir_filter_restore re-adds all existing filters, which already
checks when adding a TCPv4 filter to disable ATR. We don't need to make
the check twice, so remove this redundant code.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Change-ID: Ia0b0690e23523915199d601494557def135c9d7f
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 8414973cebef..a079c5bf1744 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5608,12 +5608,6 @@ static int i40e_up_complete(struct i40e_vsi *vsi)
 	if (vsi->type == I40E_VSI_FDIR) {
 		/* reset fd counters */
 		pf->fd_add_err = pf->fd_atr_cnt = 0;
-		if (pf->fd_tcp_rule > 0) {
-			pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED;
-			if (I40E_DEBUG_FD & pf->hw.debug_mask)
-				dev_info(&pf->pdev->dev, "Forcing ATR off, sideband rules for TCP/IPv4 exist\n");
-			pf->fd_tcp_rule = 0;
-		}
 		i40e_fdir_filter_restore(vsi);
 	}
 
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 07/11] i40e: reset fd_tcp_rule count when restoring filters
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
                   ` (5 preceding siblings ...)
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 06/11] i40e: remove redundant check for fd_tcp_rule when restoring filters Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-17 19:09   ` Bowers, AndrewX
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 08/11] i40e: don't re-enable ATR when flushing filters if SB has TCP4/IPv4 rules Jacob Keller
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 09/11] i40e: add counters for UDP/IPv4 and IPv4 filters Jacob Keller
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

Since we're about to reprogram the filters, we need to ensure that the
fd_tcp_rule count is correctly reset to 0. Otherwise, we will keep
a stale count that does not accurately reflect the number of programmed
TCPv4 filters.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index a079c5bf1744..14a79e5f6857 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -3320,6 +3320,9 @@ static void i40e_fdir_filter_restore(struct i40e_vsi *vsi)
 	if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED))
 		return;
 
+	/* Reset FDir counters as we're replaying all existing filters */
+	pf->fd_tcp_rule = 0;
+
 	hlist_for_each_entry_safe(filter, node,
 				  &pf->fdir_filter_list, fdir_node) {
 		i40e_add_del_fdir(vsi, filter, true);
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 08/11] i40e: don't re-enable ATR when flushing filters if SB has TCP4/IPv4 rules
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
                   ` (6 preceding siblings ...)
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 07/11] i40e: reset fd_tcp_rule count " Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-17 19:10   ` Bowers, AndrewX
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 09/11] i40e: add counters for UDP/IPv4 and IPv4 filters Jacob Keller
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

When flushing and replaying FDIR filters, it is possible we would
disable ATR, and then re-enable it even though we should have kept
it disabled due to existing TCP/IPv4 filters. Fix this by checking
whether we have TCP4/IPv4 filters before re-enabling.

Alternatively, we could instead restore ATR and then replay filters,
however, this would cause us to rapidly enable and then disable ATR in
some cases.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Dayanand, Avinash <avinash.dayanand@intel.com>
Reviewed-by: Brady, Alan <alan.brady@intel.com>
Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
Change-ID: I076e4cc1e4409bce7f98f3c213295433a4ff43d8
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 14a79e5f6857..e06c7b785fd8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6369,7 +6369,7 @@ static void i40e_fdir_flush_and_replay(struct i40e_pf *pf)
 	} else {
 		/* replay sideband filters */
 		i40e_fdir_filter_restore(pf->vsi[pf->lan_vsi]);
-		if (!disable_atr)
+		if (!disable_atr && !pf->fd_tcp_rule)
 			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
 		clear_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state);
 		if (I40E_DEBUG_FD & pf->hw.debug_mask)
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 09/11] i40e: add counters for UDP/IPv4 and IPv4 filters
  2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
                   ` (7 preceding siblings ...)
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 08/11] i40e: don't re-enable ATR when flushing filters if SB has TCP4/IPv4 rules Jacob Keller
@ 2017-02-06 22:38 ` Jacob Keller
  2017-03-17 19:10   ` Bowers, AndrewX
  8 siblings, 1 reply; 19+ messages in thread
From: Jacob Keller @ 2017-02-06 22:38 UTC (permalink / raw)
  To: intel-wired-lan

In preparation for adding code to properly check the mask values, we
will need to know the number of active filters for each type. Add
counters for each filter type. Rename the already existing fd_tcp_rule
to fd_tcp4_filter_cnt to match the style of other names. To avoid style
warnings, avoid assigning multiple parameters at once, and fix up one
other case where we did so previously.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h      |  9 ++++++++-
 drivers/net/ethernet/intel/i40e/i40e_main.c | 19 +++++++++++++------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 17 +++++++++++++----
 3 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index e4ac2b782d80..9957eca8f71d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -290,7 +290,14 @@ struct i40e_pf {
 	u32 fd_flush_cnt;
 	u32 fd_add_err;
 	u32 fd_atr_cnt;
-	u32 fd_tcp_rule;
+
+	/* Book-keeping of side-band filter count per flow-type.
+	 * This is used to detect and handle input set changes for
+	 * respective flow-type.
+	 */
+	u16 fd_tcp4_filter_cnt;
+	u16 fd_udp4_filter_cnt;
+	u16 fd_ip4_filter_cnt;
 
 	struct i40e_udp_port_config udp_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
 	u16 pending_udp_bitmap;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index e06c7b785fd8..c188559fc4ed 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -3321,7 +3321,9 @@ static void i40e_fdir_filter_restore(struct i40e_vsi *vsi)
 		return;
 
 	/* Reset FDir counters as we're replaying all existing filters */
-	pf->fd_tcp_rule = 0;
+	pf->fd_tcp4_filter_cnt = 0;
+	pf->fd_udp4_filter_cnt = 0;
+	pf->fd_ip4_filter_cnt = 0;
 
 	hlist_for_each_entry_safe(filter, node,
 				  &pf->fdir_filter_list, fdir_node) {
@@ -5610,7 +5612,8 @@ static int i40e_up_complete(struct i40e_vsi *vsi)
 	/* replay FDIR SB filters */
 	if (vsi->type == I40E_VSI_FDIR) {
 		/* reset fd counters */
-		pf->fd_add_err = pf->fd_atr_cnt = 0;
+		pf->fd_add_err = 0;
+		pf->fd_atr_cnt = 0;
 		i40e_fdir_filter_restore(vsi);
 	}
 
@@ -5892,7 +5895,11 @@ static void i40e_fdir_filter_exit(struct i40e_pf *pf)
 		hlist_del(&filter->fdir_node);
 		kfree(filter);
 	}
+
 	pf->fdir_pf_active_filters = 0;
+	pf->fd_tcp4_filter_cnt = 0;
+	pf->fd_udp4_filter_cnt = 0;
+	pf->fd_ip4_filter_cnt = 0;
 }
 
 /**
@@ -6297,7 +6304,7 @@ void i40e_fdir_check_and_reenable(struct i40e_pf *pf)
 	if (fcnt_prog < (fcnt_avail - I40E_FDIR_BUFFER_HEAD_ROOM * 2)) {
 		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
 		    (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED) &&
-		    (pf->fd_tcp_rule == 0)) {
+		    (pf->fd_tcp4_filter_cnt == 0)) {
 			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
 			if (I40E_DEBUG_FD & pf->hw.debug_mask)
 				dev_info(&pf->pdev->dev, "ATR is being enabled since we have space in the table and there are no conflicting ntuple rules\n");
@@ -6369,7 +6376,7 @@ static void i40e_fdir_flush_and_replay(struct i40e_pf *pf)
 	} else {
 		/* replay sideband filters */
 		i40e_fdir_filter_restore(pf->vsi[pf->lan_vsi]);
-		if (!disable_atr && !pf->fd_tcp_rule)
+		if (!disable_atr && !pf->fd_tcp4_filter_cnt)
 			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
 		clear_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state);
 		if (I40E_DEBUG_FD & pf->hw.debug_mask)
@@ -9124,8 +9131,8 @@ bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features)
 		pf->flags &= ~I40E_FLAG_FD_SB_ENABLED;
 		pf->auto_disable_flags &= ~I40E_FLAG_FD_SB_ENABLED;
 		/* reset fd counters */
-		pf->fd_add_err = pf->fd_atr_cnt = pf->fd_tcp_rule = 0;
-		pf->fdir_pf_active_filters = 0;
+		pf->fd_add_err = 0;
+		pf->fd_atr_cnt = 0;
 		/* if ATR was auto disabled it can be re-enabled. */
 		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
 		    (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED)) {
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 5756139636ff..55ac87c1e40b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -244,6 +244,11 @@ static int i40e_add_del_fdir_udpv4(struct i40e_vsi *vsi,
 				 fd_data->pctype, fd_data->fd_id);
 	}
 
+	if (add)
+		pf->fd_udp4_filter_cnt++;
+	else
+		pf->fd_udp4_filter_cnt--;
+
 	return 0;
 }
 
@@ -305,15 +310,14 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
 	}
 
 	if (add) {
-		pf->fd_tcp_rule++;
+		pf->fd_tcp4_filter_cnt++;
 		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
 		    I40E_DEBUG_FD & pf->hw.debug_mask)
 			dev_info(&pf->pdev->dev, "Forcing ATR off, sideband rules for TCP/IPv4 flow being applied\n");
 		pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED;
 	} else {
-		pf->fd_tcp_rule = (pf->fd_tcp_rule > 0) ?
-				  (pf->fd_tcp_rule - 1) : 0;
-		if (pf->fd_tcp_rule == 0) {
+		pf->fd_tcp4_filter_cnt--;
+		if (pf->fd_tcp4_filter_cnt == 0) {
 			if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
 			    I40E_DEBUG_FD & pf->hw.debug_mask)
 				dev_info(&pf->pdev->dev, "ATR re-enabled due to no sideband TCP/IPv4 rules\n");
@@ -382,6 +386,11 @@ static int i40e_add_del_fdir_ipv4(struct i40e_vsi *vsi,
 		}
 	}
 
+	if (add)
+		pf->fd_ip4_filter_cnt++;
+	else
+		pf->fd_ip4_filter_cnt--;
+
 	return 0;
 }
 
-- 
2.12.0.rc0.151.g8a5726c42288


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 02/11] i40e: don't use arrays for (src|dst)_ip
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 02/11] i40e: don't use arrays for (src|dst)_ip Jacob Keller
@ 2017-03-06 17:42   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-06 17:42 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 02/11] i40e: don't use arrays for
> (src|dst)_ip
> 
> The code originally included src_ip and dst_ip with enough space to support
> ipv6 filters. However, no actual support for ipv6 filters has been
> implemented. Thus, remove the arrays and just use __be32 values.
> Should ipv6 support be added in the future, we can replace these with a
> union that has sizes for both values.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Change-Id: I1bc04032244a80eb6ebc8a4e6c723a4a665c1dd5
> ---
>  drivers/net/ethernet/intel/i40e/i40e.h         |  4 ++--
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 12 ++++++------
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 12 ++++++------
>  3 files changed, 14 insertions(+), 14 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 03/11] i40e: rework exit flow of i40e_add_fdir_ethtool
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 03/11] i40e: rework exit flow of i40e_add_fdir_ethtool Jacob Keller
@ 2017-03-06 17:43   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-06 17:43 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 03/11] i40e: rework exit flow of
> i40e_add_fdir_ethtool
> 
> Refactor the exit flow of the i40e_add_fdir_ethtool function. Move the
> input_label to the end of the function, removing the dependency on having
> a non-zero return value. Add a comment explaining why it is ok not to free
> the fdir data structure, because the structure is now stored in the
> fdir_filter_list.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Change-Id: I723342181d59cd0c9f3b31140c37961ba37bb242
> ---
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 04/11] i40e: return immediately when failing to add fdir filter
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 04/11] i40e: return immediately when failing to add fdir filter Jacob Keller
@ 2017-03-06 17:44   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-06 17:44 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 04/11] i40e: return immediately
> when failing to add fdir filter
> 
> Instead of setting err=true and checking this to determine when to free the
> raw_packet near the end of the function, simply kfree and return
> immediately. The resulting code is a bit cleaner and has one less variable. This
> also resolves a subtle bug in the ipv4 case which could fail to add the first
> filter and then never free the memory, resulting in a small memory leak.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Dayanand, Avinash <avinash.dayanand@intel.com>
> Reviewed-by: Brady, Alan <alan.brady@intel.com>
> Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
> Change-ID: I7583aac033481dc794b4acaa14445059c8930ff1
> ---
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 33 ++++++++++++--------------
> ---
>  1 file changed, 14 insertions(+), 19 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 01/11] i40e: send correct port number to AdminQ when enabling UDP tunnels
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 01/11] i40e: send correct port number to AdminQ when enabling UDP tunnels Jacob Keller
@ 2017-03-17 19:06   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-17 19:06 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 01/11] i40e: send correct port
> number to AdminQ when enabling UDP tunnels
> 
> The firmware expects the port numbers for offloaded UDP tunnels in Little
> Endian format. We accidentally sent the value in Big Endian format which
> obviously will cause the wrong port number to be put into the UDP tunnels
> list. This results in VxLAN and Geneve tunnel Rx offloads being essentially
> disabled, unless the port number happens to be identical after byte
> swapping. Note that i40e_aq_add_udp_tunnel() will byteswap the
> parameter from host order into Little Endian so we don't need worry about
> passing strictly a __le16 value to the command.
> 
> This patch essentially reverts b3f5c7bc88ba ("i40e: Fix for extra byte swap in
> tunnel setup", 2016-08-24), but in a way that makes the result much more
> clear to the reader.
> 
> Fixes: b3f5c7bc88ba ("i40e: Fix for extra byte swap in tunnel setup", 2016-08-
> 24)
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e.h      |  3 ++-
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 17 ++++++++---------
>  2 files changed, 10 insertions(+), 10 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 05/11] i40e: exit ATR mode only when adding TCP/IPv4 filter succeeds
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 05/11] i40e: exit ATR mode only when adding TCP/IPv4 filter succeeds Jacob Keller
@ 2017-03-17 19:07   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-17 19:07 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 05/11] i40e: exit ATR mode only
> when adding TCP/IPv4 filter succeeds
> 
> Move ATR exit check after we have sent the TCP/IPv4 filter to the ring
> successfully. This avoids an issue where we potentially update the filter
> count without actually succeeding in adding the filter. Now, we only
> increment the fd_tcp_rule after we've succeeded. Additionally, we will re-
> enable ATR mode only after deletion of the filter is actually posted to the
> FDIR ring.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
> Change-ID: If5c1dea422081cc5e2de65618b01b4c3bf6bd586
> ---
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 34 ++++++++++++++-----------
> ----
>  1 file changed, 17 insertions(+), 17 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 06/11] i40e: remove redundant check for fd_tcp_rule when restoring filters
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 06/11] i40e: remove redundant check for fd_tcp_rule when restoring filters Jacob Keller
@ 2017-03-17 19:08   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-17 19:08 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 06/11] i40e: remove redundant
> check for fd_tcp_rule when restoring filters
> 
> i40e_fdir_filter_restore re-adds all existing filters, which already checks
> when adding a TCPv4 filter to disable ATR. We don't need to make the check
> twice, so remove this redundant code.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Change-ID: Ia0b0690e23523915199d601494557def135c9d7f
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ------
>  1 file changed, 6 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 07/11] i40e: reset fd_tcp_rule count when restoring filters
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 07/11] i40e: reset fd_tcp_rule count " Jacob Keller
@ 2017-03-17 19:09   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-17 19:09 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 07/11] i40e: reset fd_tcp_rule count
> when restoring filters
> 
> Since we're about to reprogram the filters, we need to ensure that the
> fd_tcp_rule count is correctly reset to 0. Otherwise, we will keep a stale
> count that does not accurately reflect the number of programmed
> TCPv4 filters.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++
>  1 file changed, 3 insertions(+)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 08/11] i40e: don't re-enable ATR when flushing filters if SB has TCP4/IPv4 rules
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 08/11] i40e: don't re-enable ATR when flushing filters if SB has TCP4/IPv4 rules Jacob Keller
@ 2017-03-17 19:10   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-17 19:10 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 08/11] i40e: don't re-enable ATR
> when flushing filters if SB has TCP4/IPv4 rules
> 
> When flushing and replaying FDIR filters, it is possible we would disable ATR,
> and then re-enable it even though we should have kept it disabled due to
> existing TCP/IPv4 filters. Fix this by checking whether we have TCP4/IPv4
> filters before re-enabling.
> 
> Alternatively, we could instead restore ATR and then replay filters, however,
> this would cause us to rapidly enable and then disable ATR in some cases.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Dayanand, Avinash <avinash.dayanand@intel.com>
> Reviewed-by: Brady, Alan <alan.brady@intel.com>
> Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
> Change-ID: I076e4cc1e4409bce7f98f3c213295433a4ff43d8
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Intel-wired-lan] [PART1 PATCH 09/11] i40e: add counters for UDP/IPv4 and IPv4 filters
  2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 09/11] i40e: add counters for UDP/IPv4 and IPv4 filters Jacob Keller
@ 2017-03-17 19:10   ` Bowers, AndrewX
  0 siblings, 0 replies; 19+ messages in thread
From: Bowers, AndrewX @ 2017-03-17 19:10 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Jacob Keller
> Sent: Monday, February 6, 2017 2:39 PM
> To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
> Subject: [Intel-wired-lan] [PART1 PATCH 09/11] i40e: add counters for
> UDP/IPv4 and IPv4 filters
> 
> In preparation for adding code to properly check the mask values, we will
> need to know the number of active filters for each type. Add counters for
> each filter type. Rename the already existing fd_tcp_rule to
> fd_tcp4_filter_cnt to match the style of other names. To avoid style
> warnings, avoid assigning multiple parameters at once, and fix up one other
> case where we did so previously.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e.h      |  9 ++++++++-
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 19 +++++++++++++------
> drivers/net/ethernet/intel/i40e/i40e_txrx.c | 17 +++++++++++++----
>  3 files changed, 34 insertions(+), 11 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-03-17 19:10 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 22:38 [Intel-wired-lan] [PART1 PATCH 00/11] ethtool flow director fixups Jacob Keller
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 01/11] i40e: send correct port number to AdminQ when enabling UDP tunnels Jacob Keller
2017-03-17 19:06   ` Bowers, AndrewX
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 02/11] i40e: don't use arrays for (src|dst)_ip Jacob Keller
2017-03-06 17:42   ` Bowers, AndrewX
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 03/11] i40e: rework exit flow of i40e_add_fdir_ethtool Jacob Keller
2017-03-06 17:43   ` Bowers, AndrewX
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 04/11] i40e: return immediately when failing to add fdir filter Jacob Keller
2017-03-06 17:44   ` Bowers, AndrewX
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 05/11] i40e: exit ATR mode only when adding TCP/IPv4 filter succeeds Jacob Keller
2017-03-17 19:07   ` Bowers, AndrewX
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 06/11] i40e: remove redundant check for fd_tcp_rule when restoring filters Jacob Keller
2017-03-17 19:08   ` Bowers, AndrewX
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 07/11] i40e: reset fd_tcp_rule count " Jacob Keller
2017-03-17 19:09   ` Bowers, AndrewX
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 08/11] i40e: don't re-enable ATR when flushing filters if SB has TCP4/IPv4 rules Jacob Keller
2017-03-17 19:10   ` Bowers, AndrewX
2017-02-06 22:38 ` [Intel-wired-lan] [PART1 PATCH 09/11] i40e: add counters for UDP/IPv4 and IPv4 filters Jacob Keller
2017-03-17 19:10   ` Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.