ethtool: correct display of VF when showing vf/queue filters
PATCH 1/3 ethtool: correct display of VF when showing vf/queue filters
The original code that implemented this accidentally had an inverted check, so it would never show the VF number properly.
Fix this code to correctly display the VF number when we have one.
--- rxclass.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
rxclass.c +3 -3
@@ -252,11 +252,11 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp)u64 queue =ethtool_get_flow_spec_ring (fsp->ring_cookie);if (vf) -fprintf (stdout,"\tAction: Direct to queue %llu\n" , - queue); -else fprintf (stdout,"\tAction: Direct to VF %llu queue %llu\n" , vf, queue); +else +fprintf (stdout,"\tAction: Direct to queue %llu\n" , + queue); }else {fprintf (stdout,"\tAction: Drop\n" ); }
Signature · 1 line
2.15.0
PATCH 2/3 ethtool: show vf and queue in the help for -N
Show that you can use vf and queue instead of action in the help output, and not only in the manual page.
--- ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ethtool.c +1 -1
@@ -4856,7 +4856,7 @@ static const struct option {" [ vlan %x [m %x] ]\n" " [ user-def %x [m %x] ]\n" " [ dst-mac %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] ]\n" -" [ action %d ]\n" +" [ action %d ] | [ vf %d queue %d ]\n" " [ loc %d]] |\n" " delete %d\n" }, { "-T|--show-time-stamping", 1, do_tsinfo,
Signature · 1 line
2.15.0
Bowers
PATCH 2/3 ethtool: show vf and queue in the help for -N
Quoted 8 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jacob Keller
Sent: Friday, November 10, 2017 10:56 AM
To: Intel Wired LAN <[email protected]>
Subject: [Intel-wired-lan] [PATCH 2/3] ethtool: show vf and queue in the help for -N
Quoted 7 lines
Show that you can use vf and queue instead of action in the help output, and not only in the manual page.
Signed-off-by Jacob Keller <[email protected]>--- ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 3/3 ethtool: correct VF index values for the ring_cookie parameter
In reply to Jacob KellerInstead 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.
---
This is the way the VF parameter should have worked from the beginning, but unfortunately I did not code it as such. It may be considered a functional change (since we already supported the vf parameter with the offset not handled properly). I would consider this a bug fix, but it might be considered a behavior change....
ethtool.8.in | 3 +-- rxclass.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)
ethtool.8.in +1 -2
@@ -839,8 +839,7 @@ lB l. .TE .TP .BI vf \ N -Specifies the Virtual Function the filter applies to. A value of 0 indicates -the PF, and thus the VF index is offset by 1. Not compatible with action. +Specifies the Virtual Function the filter applies to. Not compatible with action. .TP .BI queue \ N Specifies the Rx queue to send packets to. Not compatible with action.
rxclass.c +13 -1
@@ -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 ;
Signature · 1 line
2.15.0
Bowers
PATCH 3/3 ethtool: correct VF index values for the ring_cookie parameter
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jacob Keller
Sent: Friday, November 10, 2017 10:56 AM
To: Intel Wired LAN <[email protected]>
Subject: [Intel-wired-lan] [PATCH 3/3] ethtool: correct VF index values for thering_cookieparameterInstead 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 <[email protected]>---
This is the way the VF parameter should have worked from the beginning, but unfortunately I did not code it as such. It may be considered a functional change (since we already supported the vf parameter with the offset not handled properly). I would consider this a bug fix, but it might be considered a behavior change....
Quoted 3 lines
ethtool.8.in | 3 +-- rxclass.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)
Bowers
PATCH 1/3 ethtool: correct display of VF when showing vf/queue filters
In reply to Jacob KellerQuoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jacob Keller
Sent: Friday, November 10, 2017 10:56 AM
To: Intel Wired LAN <[email protected]>
Subject: [Intel-wired-lan] [PATCH 1/3] ethtool: correct display of VF when showing vf/queue filtersThe original code that implemented this accidentally had an inverted check, so it would never show the VF number properly.
Quoted 8 lines
Fix this code to correctly display the VF number when we have one.
Fixes 36ee712b0fbc ("ethtool: support queue and VF fields for rxclassfilters", 2017-03-23)
Signed-off-by Jacob Keller <[email protected]>--- rxclass.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)