diff options
author | Anjali Singhai Jain <anjali.singhai@intel.com> | 2015-04-07 19:45:31 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-04-14 20:13:42 -0400 |
commit | e7c8c60bc5d48994a67e4b1c7bfb01d6979dbc54 (patch) | |
tree | 25320d42ea760ea80a9021ea25542f9b1608d6d9 /drivers/net/ethernet/intel/i40e | |
parent | 2619ef475f7607f1cf1c434d4adca2593a59a6e6 (diff) |
i40e: Add support to program FDir SB rules for VF from PF through ethtool
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>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index c848b1862512..7d60587850d9 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, | |||
1914 | else | 1914 | else |
1915 | fsp->ring_cookie = rule->q_index; | 1915 | fsp->ring_cookie = rule->q_index; |
1916 | 1916 | ||
1917 | if (rule->dest_vsi != pf->vsi[pf->lan_vsi]->id) { | ||
1918 | struct i40e_vsi *vsi; | ||
1919 | |||
1920 | vsi = i40e_find_vsi_from_id(pf, rule->dest_vsi); | ||
1921 | if (vsi && vsi->type == I40E_VSI_SRIOV) { | ||
1922 | fsp->h_ext.data[1] = htonl(vsi->vf_id); | ||
1923 | fsp->m_ext.data[1] = htonl(0x1); | ||
1924 | } | ||
1925 | } | ||
1926 | |||
1917 | return 0; | 1927 | return 0; |
1918 | } | 1928 | } |
1919 | 1929 | ||
@@ -2207,6 +2217,7 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, | |||
2207 | struct i40e_fdir_filter *input; | 2217 | struct i40e_fdir_filter *input; |
2208 | struct i40e_pf *pf; | 2218 | struct i40e_pf *pf; |
2209 | int ret = -EINVAL; | 2219 | int ret = -EINVAL; |
2220 | u16 vf_id; | ||
2210 | 2221 | ||
2211 | if (!vsi) | 2222 | if (!vsi) |
2212 | return -EINVAL; | 2223 | return -EINVAL; |
@@ -2267,7 +2278,22 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, | |||
2267 | input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; | 2278 | input->dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; |
2268 | input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; | 2279 | input->src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; |
2269 | 2280 | ||
2281 | if (ntohl(fsp->m_ext.data[1])) { | ||
2282 | if (ntohl(fsp->h_ext.data[1]) >= pf->num_alloc_vfs) { | ||
2283 | netif_info(pf, drv, vsi->netdev, "Invalid VF id\n"); | ||
2284 | goto free_input; | ||
2285 | } | ||
2286 | vf_id = ntohl(fsp->h_ext.data[1]); | ||
2287 | /* Find vsi id from vf id and override dest vsi */ | ||
2288 | input->dest_vsi = pf->vf[vf_id].lan_vsi_id; | ||
2289 | if (input->q_index >= pf->vf[vf_id].num_queue_pairs) { | ||
2290 | netif_info(pf, drv, vsi->netdev, "Invalid queue id\n"); | ||
2291 | goto free_input; | ||
2292 | } | ||
2293 | } | ||
2294 | |||
2270 | ret = i40e_add_del_fdir(vsi, input, true); | 2295 | ret = i40e_add_del_fdir(vsi, input, true); |
2296 | free_input: | ||
2271 | if (ret) | 2297 | if (ret) |
2272 | kfree(input); | 2298 | kfree(input); |
2273 | else | 2299 | else |