aboutsummaryrefslogtreecommitdiffstats
path: root/rxclass.c
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2018-02-26 10:49:56 -0800
committerJohn W. Linville <linville@tuxdriver.com>2018-02-27 14:19:33 -0500
commitd7b70e5d1757e46b7e3d91f8632f406bb3891f6e (patch)
treeae127797f72e4fade352d8b9110a663069c87529 /rxclass.c
parentc837bea71d37b1327c2e8099da07c8e342456c30 (diff)
downloadethtool-d7b70e5d1757e46b7e3d91f8632f406bb3891f6e.tar.gz
ethtool: correct VF index values for the ring_cookie parameter
Instead of relying on the input being offset by 1, instead adjust the "vf" input value by 1 so that it correctly targets the VF the user expects. Additionally, update the displayed output to show the correct VF number. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'rxclass.c')
-rw-r--r--rxclass.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/rxclass.c b/rxclass.c
index 144c8e5..e05031b 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -251,9 +251,14 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp)
u64 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);
u64 queue = ethtool_get_flow_spec_ring(fsp->ring_cookie);
+ /* A value of zero indicates that this rule targeted the main
+ * function. A positive value indicates which virtual function
+ * was targeted, so we'll subtract 1 in order to show the
+ * correct VF index
+ */
if (vf)
fprintf(stdout, "\tAction: Direct to VF %llu queue %llu\n",
- vf, queue);
+ vf - 1, queue);
else
fprintf(stdout, "\tAction: Direct to queue %llu\n",
queue);
@@ -1047,6 +1052,13 @@ static int rxclass_get_val(char *str, unsigned char *p, u32 *flags,
err = rxclass_get_ulong(str, &val, 8);
if (err)
return -1;
+
+ /* The ring_cookie uses 0 to indicate the rule targets the
+ * main function, so add 1 to the value in order to target the
+ * correct virtual function.
+ */
+ val++;
+
*(u64 *)&p[opt->offset] &= ~ETHTOOL_RX_FLOW_SPEC_RING_VF;
*(u64 *)&p[opt->offset] = (u64)val << ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
break;