ethtool: add multiple queue support to {get,set}_ringparams
Subsystems (2)
RFC PATCH 1/1 ethtool: add multiple queue support to {get,set}_ringparams
With network devices and hence device drivers supporting multiple Tx and Rx rings, currently there is no way for ethtool to specify which Tx/Rx ring the user wants to get/set. This patch enhances the get/set ring params option by allowing the user to specify the Tx/Rx ring id of interest. Please review.
Current Usage:
ethtool -g <interface name>
ethtool -G <interface name> [new parameters to set]
New Usage:
ethtool -g <interface name> [ RING-ID ]
ethtool -G <interface name> [ RING-ID ] [new parameters to set]
Signed-off-by Ajit Khaparde <[email protected]>
--- ethtool-copy.h | 1 + ethtool.8 | 8 ++++++++ ethtool.c | 19 +++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-)
ethtool-copy.h +1 -0
@@ -199,6 +199,7 @@ struct ethtool_coalesce {/* for configuring RX/TX ring parameters */ struct ethtool_ringparam {__u32 cmd;/* ETHTOOL_{G,S}RINGPARAM */ +__u32 ring_id;/* Read only attributes. These indicate the maximum number * of pending RX/TX ring entries the driver will allow the
ethtool.8 +8 -0
@@ -116,9 +116,11 @@ ethtool \- Display or change ethernet card settings .B ethtool \-g|\-\-show\-ring .I ethX +.RI [ N ] .B ethtool \-G|\-\-set\-ring .I ethX +.RI [ N ] .RB [ rx .IR N ] .RB [ rx-mini
@@ -287,9 +289,15 @@ Changes the coalescing settings of the specified ethernet device. .B \-g \-\-show\-ring Queries the specified ethernet device for rx/tx ring parameter information. .TP +.B N +The tx/rx ring id. +.TP .B \-G \-\-set\-ring Changes the rx/tx ring parameters of the specified ethernet device. .TP +.B N +The tx/rx ring id. +.TP .BI rx \ N Changes the number of ring entries for the Rx ring. .TP
ethtool.c +17 -2
@@ -156,8 +156,10 @@ static struct option {" [tx-usecs-high N]\n" " [tx-frames-high N]\n" " [sample-interval N]\n" }, - { "-g", "--show-ring", MODE_GRING, "Query RX/TX ring parameters" }, + { "-g", "--show-ring", MODE_GRING, "Query RX/TX ring parameters", + " [ RING ID ]\n" }, { "-G", "--set-ring", MODE_SRING, "Set RX/TX ring parameters", +" [ RING ID ]\n" " [ rx N ]\n" " [ rx-mini N ]\n" " [ rx-jumbo N ]\n"
@@ -265,6 +267,7 @@ static int pause_rx_wanted = -1;static int pause_tx_wanted =-1 ;static struct ethtool_ringparam ering; +static int ring_id =0 ;static int gring_changed =0 ;static int ring_rx_wanted =-1 ;static int ring_rx_mini_wanted =-1 ;
@@ -605,6 +608,10 @@ static void parse_cmdline(int argc, char **argp) flash =1 ;break ; } +if (mode ==MODE_SRING ) { + ring_id =get_int (argp[i],10 ); +break ; + }/* fallthrough */ default :if (mode ==MODE_GREGS ) {
@@ -639,6 +646,10 @@ static void parse_cmdline(int argc, char **argp) i = argc;break ; } +if (mode ==MODE_GRING ) { + ring_id =get_int (argp[i],10 ); +break ; + }if (mode ==MODE_SRING ) { parse_generic_cmdline(argc, argp, i, &gring_changed,
@@ -1761,6 +1772,7 @@ static int do_sring(int fd, struct ifreq *ifr)int err, changed =0 ; ering.cmd =ETHTOOL_GRINGPARAM ; + ering.ring_id = ring_id; ifr->ifr_data = (caddr_t)&ering; err =send_ioctl (fd, ifr);if (err) {
@@ -1776,6 +1788,7 @@ static int do_sring(int fd, struct ifreq *ifr) } ering.cmd =ETHTOOL_SRINGPARAM ; + ering.ring_id = ring_id; ifr->ifr_data = (caddr_t)&ering; err =send_ioctl (fd, ifr);if (err) {
@@ -1790,9 +1803,11 @@ static int do_gring(int fd, struct ifreq *ifr) {int err; -fprintf (stdout,"Ring parameters for %s:\n" , devname); +fprintf (stdout,"Ring parameters for ring id %d for %s:\n" , + ring_id, devname); ering.cmd =ETHTOOL_GRINGPARAM ; + ering.ring_id = ring_id; ifr->ifr_data = (caddr_t)&ering; err =send_ioctl (fd, ifr);if (err ==0 ) {
Signature · 1 line
1.6.3.3