From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Anjali Singhai Jain <anjali.singhai@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 03/14] i40e: Add support to program FDir SB rules for VF from PF through ethtool
Date: Tue, 14 Apr 2015 21:51:40 -0700 [thread overview]
Message-ID: <1429073511-27664-4-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1429073511-27664-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Anjali Singhai Jain <anjali.singhai@intel.com>
With this patch we can now add Flow director Sideband rules for a VF from
it's PF. Here is an example on how it can be done when VF id = 5 and
queue = 2:
"ethtool -N ethx flow-type udp4 src-ip x.x.x.x dst-ip y.y.y.y src-port p1 dst-port p2 action 2 user-def 5"
User-def specifies VF id and action specifies queue.
Change-ID: Ib37d6dff3823a4d85caffde638473891c38c2b89
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Jim Young <james.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index c848b18..7d60587 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -1914,6 +1914,16 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,
else
fsp->ring_cookie = rule->q_index;
+ if (rule->dest_vsi != pf->vsi[pf->lan_vsi]->id) {
+ struct i40e_vsi *vsi;
+
+ vsi = i40e_find_vsi_from_id(pf, rule->dest_vsi);
+ if (vsi && vsi->type == I40E_VSI_SRIOV) {
+ fsp->h_ext.data[1] = htonl(vsi->vf_id);
+ fsp->m_ext.data[1] = htonl(0x1);
+ }
+ }
+
return 0;
}
@@ -2207,6 +2217,7 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
struct i40e_fdir_filter *input;
struct i40e_pf *pf;
int ret = -EINVAL;
+ u16 vf_id;
if (!vsi)
return -EINVAL;
@@ -2267,7 +2278,22 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src;
input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst;
+ if (ntohl(fsp->m_ext.data[1])) {
+ if (ntohl(fsp->h_ext.data[1]) >= pf->num_alloc_vfs) {
+ netif_info(pf, drv, vsi->netdev, "Invalid VF id\n");
+ goto free_input;
+ }
+ vf_id = ntohl(fsp->h_ext.data[1]);
+ /* Find vsi id from vf id and override dest vsi */
+ input->dest_vsi = pf->vf[vf_id].lan_vsi_id;
+ if (input->q_index >= pf->vf[vf_id].num_queue_pairs) {
+ netif_info(pf, drv, vsi->netdev, "Invalid queue id\n");
+ goto free_input;
+ }
+ }
+
ret = i40e_add_del_fdir(vsi, input, true);
+free_input:
if (ret)
kfree(input);
else
--
1.9.3
next prev parent reply other threads:[~2015-04-15 4:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 4:51 [net-next 00/14][pull request] Intel Wired LAN Driver Updates 2015-04-14 Jeff Kirsher
2015-04-15 4:51 ` [net-next 01/14] i40e: stop VF rings Jeff Kirsher
2015-04-15 4:51 ` [net-next 02/14] i40evf: fix bad indentation Jeff Kirsher
2015-04-15 4:51 ` Jeff Kirsher [this message]
2015-04-15 8:58 ` [net-next 03/14] i40e: Add support to program FDir SB rules for VF from PF through ethtool Or Gerlitz
2015-04-16 1:42 ` Jeff Kirsher
2015-04-15 4:51 ` [net-next 04/14] i40evf: remove aq_pending Jeff Kirsher
2015-04-15 4:51 ` [net-next 05/14] i40e: notify VFs of link state Jeff Kirsher
2015-04-15 4:51 ` [net-next 06/14] i40e: move VF notification routines up Jeff Kirsher
2015-04-15 4:51 ` [net-next 07/14] i40e: For VF reset (VFR and VFLR) add some more delay Jeff Kirsher
2015-04-15 4:51 ` [net-next 08/14] i40e: print FCoE capability reported by the device function Jeff Kirsher
2015-04-15 4:51 ` [net-next 09/14] i40e: enable user dump of internal hardware state Jeff Kirsher
2015-04-15 4:51 ` [net-next 10/14] i40e/i40evf: Save WR_CSR_PROT field from DEV/FUNC capabilities Jeff Kirsher
2015-04-15 4:51 ` [net-next 11/14] i40e: handle possible memory allocation failure Jeff Kirsher
2015-04-15 11:27 ` Sergei Shtylyov
2015-04-15 4:51 ` [net-next 12/14] i40e: get rid of unused locals Jeff Kirsher
2015-04-15 4:51 ` [net-next 13/14] i40e: Use new 40G speeds Jeff Kirsher
2015-04-15 4:51 ` [net-next 14/14] i40e: Bump version to 1.3.2 Jeff Kirsher
2015-04-15 21:45 ` [net-next 00/14][pull request] Intel Wired LAN Driver Updates 2015-04-14 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=1429073511-27664-4-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=anjali.singhai@intel.com \
--cc=davem@davemloft.net \
--cc=jogreene@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--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).