]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
i40e: Change the notion of src and dst for FD_SB in ethtool
authorAnjali Singhai Jain <anjali.singhai@intel.com>
Thu, 22 May 2014 06:31:41 +0000 (06:31 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 11 Jun 2014 15:48:07 +0000 (08:48 -0700)
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
drivers/net/ethernet/intel/i40e/i40e_ethtool.c

index 2af28fd37bff4c8003774d467b5e83e54ce9b084..fc1bd1094397e3ff7c8df1d997cb35a5f954c9f6 100644 (file)
@@ -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;
index b16c25111552ebb1a9cac9a8c20f80a4f0ca2e65..c7718631ed02af87527d23331b0b0a3ee995ff4c 100644 (file)
@@ -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)