Re: [PATCH] ethtool: Add support for setting multiple rx/tx queues

2007-08-02 Thread Kok, Auke

Auke Kok wrote:

Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

@@ -496,6 +516,14 @@ static void parse_cmdline(int argc, char **argp)
i = argc;
break;
}
+   if (mode == MODE_SQUEUE) {
+   parse_generic_cmdline(argc, argp, i,
+   gqueue_changed,
+   cmdline_ring,


Nick pointed out the obvious typo here... I'll wait for some (more) comments 
before reposting.


Auke
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ethtool: Add support for setting multiple rx/tx queues

2007-07-31 Thread Auke Kok
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 ethtool-copy.h |   23 +
 ethtool.8  |   23 +
 ethtool.c  |  103 
 3 files changed, 149 insertions(+), 0 deletions(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index ab9d688..aefd580 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -196,6 +196,23 @@ struct ethtool_ringparam {
__u32   tx_pending;
 };
 
+/* for configuring RX/TX queue count */
+struct ethtool_queueparam {
+   __u32   cmd;/* ETHTOOL_{G,S}QUEUEPARAM */
+
+   /* Read only attributes.  These indicate the maximum number
+* of RX/TX queues the driver will allow the user to set.
+*/
+   __u32   rx_max;
+   __u32   tx_max;
+
+   /* Values changeable by the user.  The valid values are
+* in the range 1 to the *_max counterpart above.
+*/
+   __u32   rx;
+   __u32   tx;
+};
+
 /* for configuring link flow control parameters */
 struct ethtool_pauseparam {
__u32   cmd;/* ETHTOOL_{G,S}PAUSEPARAM */
@@ -295,6 +312,8 @@ int ethtool_op_set_lro(struct net_device *dev, u32 data);
  * set_coalesce: Set interrupt coalescing parameters
  * get_ringparam: Report ring sizes
  * set_ringparam: Set ring sizes
+ * get_queueparam: Report ring sizes
+ * set_queueparam: Set ring sizes
  * get_pauseparam: Report pause parameters
  * set_pauseparam: Set pause paramters
  * get_rx_csum: Report whether receive checksums are turned on or off
@@ -356,6 +375,8 @@ struct ethtool_ops {
int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
void(*get_ringparam)(struct net_device *, struct ethtool_ringparam 
*);
int (*set_ringparam)(struct net_device *, struct ethtool_ringparam 
*);
+   void(*get_queueparam)(struct net_device *, struct 
ethtool_queueparam *);
+   int (*set_queueparam)(struct net_device *, struct 
ethtool_queueparam *);
void(*get_pauseparam)(struct net_device *, struct 
ethtool_pauseparam*);
int (*set_pauseparam)(struct net_device *, struct 
ethtool_pauseparam*);
u32 (*get_rx_csum)(struct net_device *);
@@ -422,6 +443,8 @@ struct ethtool_ops {
 #define ETHTOOL_SGSO   0x0024 /* Set GSO enable (ethtool_value) */
 #define ETHTOOL_GLRO   0x0025 /* Get LRO enable (ethtool_value) */
 #define ETHTOOL_SLRO   0x0026 /* Set LRO enable (ethtool_value) */
+#define ETHTOOL_GQUEUEPARAM0x0027 /* Get queue parameters */
+#define ETHTOOL_SQUEUEPARAM0x0028 /* Set queue parameters. */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/ethtool.8 b/ethtool.8
index 89abf08..3f2e0c0 100644
--- a/ethtool.8
+++ b/ethtool.8
@@ -120,6 +120,17 @@ ethtool \- Display or change ethernet card settings
 .RB [ tx
 .IR N ]
 
+
+.B ethtool \-q|\-\-show\-queue
+.I ethX
+
+.B ethtool \-Q|\-\-set\-queue
+.I ethX
+.RB [ rx
+.IR N ]
+.RB [ tx
+.IR N ]
+
 .B ethtool \-i|\-\-driver
 .I ethX
 
@@ -243,6 +254,18 @@ Changes the number of ring entries for the Rx Jumbo ring.
 .BI tx \ N
 Changes the number of ring entries for the Tx ring.
 .TP
+.B \-q \-\-show\-queue
+Queries the specified ethernet device for rx/tx queue parameter information.
+.TP
+.B \-Q \-\-set\-queue
+Changes the rx/tx queue parameters of the specified ethernet device.
+.TP
+.BI rx \ N
+Changes the number of Rx queues.
+.TP
+.BI tx \ N
+Changes the number of Tx queues.
+.TP
 .B \-i \-\-driver
 Queries the specified ethernet device for associated driver information.
 .TP
diff --git a/ethtool.c b/ethtool.c
index 4c9844a..227349f 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -64,6 +64,8 @@ static int do_gpause(int fd, struct ifreq *ifr);
 static int do_spause(int fd, struct ifreq *ifr);
 static int do_gring(int fd, struct ifreq *ifr);
 static int do_sring(int fd, struct ifreq *ifr);
+static int do_gqueue(int fd, struct ifreq *ifr);
+static int do_squeue(int fd, struct ifreq *ifr);
 static int do_gcoalesce(int fd, struct ifreq *ifr);
 static int do_scoalesce(int fd, struct ifreq *ifr);
 static int do_goffload(int fd, struct ifreq *ifr);
@@ -87,6 +89,8 @@ static enum {
MODE_SCOALESCE,
MODE_GRING,
MODE_SRING,
+   MODE_GQUEUE,
+   MODE_SQUEUE,
MODE_GOFFLOAD,
MODE_SOFFLOAD,
MODE_GSTATS,
@@ -144,6 +148,10 @@ static struct option {
   [ rx-mini N ]\n
   [ rx-jumbo N ]\n
   [ tx N ]\n },
+{ -q, --show-queue, MODE_GQUEUE, Query RX/TX queue parameters },
+{ -Q, --set-queue, MODE_SQUEUE, Set RX/TX queue parameters,
+  [ rx N ]\n
+  [ tx N ]\n },
 { -k, --show-offload, MODE_GOFFLOAD, Get protocol offload 
information },
 { -K, --offload, MODE_SOFFLOAD, Set protocol offload,
   [ rx on|off ]\n
@@ -216,6