netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Anjali Singhai Jain <anjali.singhai@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 05/15] i40e: Change the notion of src and dst for FD_SB in ethtool
Date: Wed, 11 Jun 2014 09:33:14 -0700	[thread overview]
Message-ID: <1402504404-8954-6-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1402504404-8954-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Anjali Singhai Jain <anjali.singhai@intel.com>

In XL710 devices we program FD filter's fields from Tx perspective of the flow.
However the user interface exposed in ethtool should be compliant with the
previous generation of drivers where a filter src and dst field are from
the RX perspective. This patch changes the ethtool interface in this regard
to match the other drivers.

Change-ID: Iec6ccddd87357c4fb53ccf33aa0fae699faf70cf
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h         |  1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 23 +++++++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 2af28fd..fc1bd10 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -159,6 +159,7 @@ struct i40e_fdir_filter {
 	/* filter ipnut set */
 	u8 flow_type;
 	u8 ip4_proto;
+	/* TX packet view of src and dst */
 	__be32 dst_ip[4];
 	__be32 src_ip[4];
 	__be16 src_port;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index b16c251..c771863 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -1249,10 +1249,13 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,
 		fsp->m_u.usr_ip4_spec.proto = 0;
 	}
 
-	fsp->h_u.tcp_ip4_spec.psrc = rule->src_port;
-	fsp->h_u.tcp_ip4_spec.pdst = rule->dst_port;
-	fsp->h_u.tcp_ip4_spec.ip4src = rule->src_ip[0];
-	fsp->h_u.tcp_ip4_spec.ip4dst = rule->dst_ip[0];
+	/* Reverse the src and dest notion, since the HW views them from
+	 * Tx perspective where as the user expects it from Rx filter view.
+	 */
+	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->ring_cookie = rule->q_index;
 
 	return 0;
@@ -1581,10 +1584,14 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
 	input->cnt_index = 0;
 	input->flow_type = fsp->flow_type;
 	input->ip4_proto = fsp->h_u.usr_ip4_spec.proto;
-	input->src_port = fsp->h_u.tcp_ip4_spec.psrc;
-	input->dst_port = fsp->h_u.tcp_ip4_spec.pdst;
-	input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src;
-	input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst;
+
+	/* Reverse the src and dest notion, since the HW expects them to be from
+	 * Tx perspective where as the input from user is from Rx filter view.
+	 */
+	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;
 
 	ret = i40e_add_del_fdir(vsi, input, true);
 	if (ret)
-- 
1.9.3

  parent reply	other threads:[~2014-06-11 16:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 16:33 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2014-06-11 Jeff Kirsher
2014-06-11 16:33 ` [net-next 01/15] igb: unhide invariant returns Jeff Kirsher
2014-06-11 16:33 ` [net-next 02/15] igb: separate hardware setting from the set_ts_config ioctl Jeff Kirsher
2014-06-11 16:33 ` [net-next 03/15] i40e/i40evf: set headwb Tx context flags and use them Jeff Kirsher
2014-06-11 16:33 ` [net-next 04/15] i40e/i40evf: AdminQ API update for new FW Jeff Kirsher
2014-06-11 16:33 ` Jeff Kirsher [this message]
2014-06-11 16:33 ` [net-next 06/15] i40evf: don't go further down Jeff Kirsher
2014-06-11 16:33 ` [net-next 07/15] i40e: Separate out DCB capability and enabled flags Jeff Kirsher
2014-06-12  8:22   ` Or Gerlitz
2014-06-12 16:59     ` Parikh, Neerav
2014-06-11 16:33 ` [net-next 08/15] i40e: Do not accept tagged packets by default Jeff Kirsher
2014-06-11 16:33 ` [net-next 09/15] i40e/i40evf: User ether_addr_copy instead of memcpy Jeff Kirsher
2014-06-11 16:33 ` [net-next 10/15] i40evf: check admin queue error bits Jeff Kirsher
2014-06-11 16:33 ` [net-next 11/15] i40e/i40evf: remove FTYPE Jeff Kirsher
2014-06-11 16:33 ` [net-next 12/15] i40e/i40evf: Add Flow director stats to PF stats Jeff Kirsher
2014-06-11 16:33 ` [net-next 13/15] i40e: Fix a bug in ethtool for FD drop packet filter action Jeff Kirsher
2014-06-11 16:33 ` [net-next 14/15] i40e: use stored base_queue value Jeff Kirsher
2014-06-11 16:33 ` [net-next 15/15] i40e/i40evf: Bump i40e to version 0.4.10 and i40evf to 0.9.34 Jeff Kirsher
2014-06-11 19:25 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2014-06-11 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402504404-8954-6-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=anjali.singhai@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).