* [ethtool 1/3] ethtool: correct display of VF when showing vf/queue filters
2018-02-26 18:49 [ethtool 0/3][pull request] Ethtool Updates 2018-02-26 Jeff Kirsher
@ 2018-02-26 18:49 ` Jeff Kirsher
2018-02-27 19:31 ` [ethtool, " John W. Linville
2018-02-26 18:49 ` [ethtool 2/3] ethtool: show VF and queue in the help for -N Jeff Kirsher
2018-02-26 18:49 ` [ethtool 3/3] ethtool: correct VF index values for the ring_cookie parameter Jeff Kirsher
2 siblings, 1 reply; 7+ messages in thread
From: Jeff Kirsher @ 2018-02-26 18:49 UTC (permalink / raw)
To: linville; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
From: Jacob Keller <jacob.e.keller@intel.com>
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.
Fixes: 36ee712b0fbc ("ethtool: support queue and VF fields for rxclass filters", 2017-03-23)
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>
---
rxclass.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rxclass.c b/rxclass.c
index ebc3e1a..144c8e5 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -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");
}
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [ethtool, 1/3] ethtool: correct display of VF when showing vf/queue filters
2018-02-26 18:49 ` [ethtool 1/3] ethtool: correct display of VF when showing vf/queue filters Jeff Kirsher
@ 2018-02-27 19:31 ` John W. Linville
0 siblings, 0 replies; 7+ messages in thread
From: John W. Linville @ 2018-02-27 19:31 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: linville, Jacob Keller, netdev, nhorman, sassmann, jogreene
On Mon, Feb 26, 2018 at 10:49:54AM -0800, Jeff Kirsher wrote:
> From: Jacob Keller <jacob.e.keller@intel.com>
>
> 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.
>
> Fixes: 36ee712b0fbc ("ethtool: support queue and VF fields for rxclass filters", 2017-03-23)
> 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>
LGTM -- queued for ethtool-4.16...
Thanks!
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ethtool 2/3] ethtool: show VF and queue in the help for -N
2018-02-26 18:49 [ethtool 0/3][pull request] Ethtool Updates 2018-02-26 Jeff Kirsher
2018-02-26 18:49 ` [ethtool 1/3] ethtool: correct display of VF when showing vf/queue filters Jeff Kirsher
@ 2018-02-26 18:49 ` Jeff Kirsher
2018-02-27 19:31 ` [ethtool,2/3] " John W. Linville
2018-02-26 18:49 ` [ethtool 3/3] ethtool: correct VF index values for the ring_cookie parameter Jeff Kirsher
2 siblings, 1 reply; 7+ messages in thread
From: Jeff Kirsher @ 2018-02-26 18:49 UTC (permalink / raw)
To: linville; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
From: Jacob Keller <jacob.e.keller@intel.com>
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 <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ethtool.c b/ethtool.c
index 79c076e..c870a2b 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5046,7 +5046,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,
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [ethtool,2/3] ethtool: show VF and queue in the help for -N
2018-02-26 18:49 ` [ethtool 2/3] ethtool: show VF and queue in the help for -N Jeff Kirsher
@ 2018-02-27 19:31 ` John W. Linville
0 siblings, 0 replies; 7+ messages in thread
From: John W. Linville @ 2018-02-27 19:31 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: linville, Jacob Keller, netdev, nhorman, sassmann, jogreene
On Mon, Feb 26, 2018 at 10:49:55AM -0800, Jeff Kirsher wrote:
> From: Jacob Keller <jacob.e.keller@intel.com>
>
> 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 <jacob.e.keller@intel.com>
> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
LGTM -- queued for ethtool-4.16...
Thanks!
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ethtool 3/3] ethtool: correct VF index values for the ring_cookie parameter
2018-02-26 18:49 [ethtool 0/3][pull request] Ethtool Updates 2018-02-26 Jeff Kirsher
2018-02-26 18:49 ` [ethtool 1/3] ethtool: correct display of VF when showing vf/queue filters Jeff Kirsher
2018-02-26 18:49 ` [ethtool 2/3] ethtool: show VF and queue in the help for -N Jeff Kirsher
@ 2018-02-26 18:49 ` Jeff Kirsher
2018-02-27 19:32 ` [ethtool, " John W. Linville
2 siblings, 1 reply; 7+ messages in thread
From: Jeff Kirsher @ 2018-02-26 18:49 UTC (permalink / raw)
To: linville; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
From: Jacob Keller <jacob.e.keller@intel.com>
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>
---
ethtool.8.in | 3 +--
rxclass.c | 14 +++++++++++++-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/ethtool.8.in b/ethtool.8.in
index 11e0edb..690e55e 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -869,8 +869,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.
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;
--
2.14.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [ethtool, 3/3] ethtool: correct VF index values for the ring_cookie parameter
2018-02-26 18:49 ` [ethtool 3/3] ethtool: correct VF index values for the ring_cookie parameter Jeff Kirsher
@ 2018-02-27 19:32 ` John W. Linville
0 siblings, 0 replies; 7+ messages in thread
From: John W. Linville @ 2018-02-27 19:32 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: linville, Jacob Keller, netdev, nhorman, sassmann, jogreene
On Mon, Feb 26, 2018 at 10:49:56AM -0800, Jeff Kirsher wrote:
> From: Jacob Keller <jacob.e.keller@intel.com>
>
> 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>
LGTM -- queued for ethtool-4.16...
Thanks!
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 7+ messages in thread