netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [ethtool PATCH 1/2] ethtool: Correctly pull n-tuple string length for get_rx_ntuple
@ 2010-02-26 11:55 Jeff Kirsher
  2010-02-26 11:56 ` [ethtool PATCH 2/2] ethtool: Update manpage with n-tuple information Jeff Kirsher
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Kirsher @ 2010-02-26 11:55 UTC (permalink / raw)
  To: jeff; +Cc: netdev, gospo, Peter P Waskiewicz Jr, Jeff Kirsher

From: Peter Waskiewicz <peter.p.waskiewicz.jr@intel.com>

This patch fixes inconsistencies with the kernel header files, while
correctly gets the variable length string counts for the get_rx_ntuple
return value.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 ethtool-copy.h |    3 +--
 ethtool.c      |   13 +++++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 8681f5e..7d4e80a 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -63,6 +63,7 @@ struct ethtool_drvinfo {
 	char	reserved2[12];
 	__u32	n_priv_flags;	/* number of flags valid in ETHTOOL_GPFLAGS */
 	__u32	n_stats;	/* number of u64's from ETHTOOL_GSTATS */
+	__u32	n_ntuples;	/* number of n-tuple filters from GSTRINGS */
 	__u32	testinfo_len;
 	__u32	eedump_len;	/* Size of data from ETHTOOL_GEEPROM (bytes) */
 	__u32	regdump_len;	/* Size of data from ETHTOOL_GREGS (bytes) */
@@ -389,8 +390,6 @@ struct ethtool_rx_ntuple_flow_spec {
 #define ETHTOOL_RXNTUPLE_ACTION_DROP -1
 };
 
-#define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024
-#define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14
 struct ethtool_rx_ntuple {
 	__u32					cmd;
 	struct ethtool_rx_ntuple_flow_spec	fs;
diff --git a/ethtool.c b/ethtool.c
index fc9e419..4f39263 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2657,11 +2657,20 @@ static int do_srxntuple(int fd, struct ifreq *ifr)
 
 static int do_grxntuple(int fd, struct ifreq *ifr)
 {
+	struct ethtool_drvinfo drvinfo;
 	struct ethtool_gstrings *strings;
 	int sz_str, n_strings, err, i;
 
-	n_strings = ETHTOOL_MAX_NTUPLE_LIST_ENTRY *
-	            ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY;
+	drvinfo.cmd = ETHTOOL_GDRVINFO;
+	ifr->ifr_data = (caddr_t)&drvinfo;
+	err = send_ioctl(fd, ifr);
+
+	if (err < 0) {
+		perror("Cannot get driver information");
+		return 71;
+	}
+
+	n_strings = drvinfo.n_ntuples;
 	sz_str = n_strings * ETH_GSTRING_LEN;
 
 	strings = calloc(1, sz_str + sizeof(struct ethtool_gstrings));


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [ethtool PATCH 2/2] ethtool: Update manpage with n-tuple information
  2010-02-26 11:55 [ethtool PATCH 1/2] ethtool: Correctly pull n-tuple string length for get_rx_ntuple Jeff Kirsher
@ 2010-02-26 11:56 ` Jeff Kirsher
  2010-02-26 13:51   ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Kirsher @ 2010-02-26 11:56 UTC (permalink / raw)
  To: jeff; +Cc: netdev, gospo, Peter P Waskiewicz Jr, Jeff Kirsher

From: Peter Waskiewicz <peter.p.waskiewicz.jr@intel.com>

Add n-tuple information to the ethtool manpage.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 ethtool.8 |  102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 0 deletions(-)

diff --git a/ethtool.8 b/ethtool.8
index b45d171..eb6430b 100644
--- a/ethtool.8
+++ b/ethtool.8
@@ -214,6 +214,40 @@ ethtool \- Display or change ethernet card settings
 .I ethX
 .RI FILE
 .RI [ N ]
+
+.B ethtool \-u|\-\-show\-ntuple
+.I ethX
+
+.B ethtool \-U|\-\-config\-ntuple
+.I ethX
+.RB [ flow-type
+.RB tcp4|udp4|sctp4 ]
+.RB [ src-ip
+.IR addr ]
+.RB [ src-ip-mask
+.IR mask ]
+.RB [ dst-ip
+.IR addr ]
+.RB [ dst-ip-mask
+.IR mask ]
+.RB [ src-port
+.IR port ]
+.RB [ src-port-mask
+.IR mask ]
+.RB [ dst-port
+.IR port ]
+.RB [ dst-port-mask
+.IR mask ]
+.RB [ vlan
+.IR VLAN-tag ]
+.RB [ vlan-mask
+.IR mask ]
+.RB [ user-def
+.IR data ]
+.RB [ user-def-mask
+.IR mask ]
+.RB [ action
+.IR queue\ or\ drop ]
 .SH DESCRIPTION
 .BI ethtool
 is used for querying settings of an ethernet device and changing them.
@@ -517,6 +551,74 @@ A number to identify flash region where the image should be flashed.
 Default region is 0 which denotes all regions in the flash.
 .PD
 .RE
+.TP
+.B \-u \-\-show-ntuple
+Get Rx ntuple filters and actions, then display them to the user.
+.PD
+.RE
+.TP
+.B \-U \-\-config-ntuple
+Configure Rx ntuple filters and actions
+.TP
+.B flow-type tcp4|udp4|sctp4
+.RS
+.PD 0
+.TP 3
+.BR "tcp4" "    TCP over IPv4"
+.TP 3
+.BR "udp4" "    UDP over IPv4"
+.TP 3
+.BR "sctp4" "   SCTP over IPv4"
+.PD
+.RE
+.TP
+.BI src-ip \ addr
+Includes the source IP address, specified in hex.
+.TP
+.BI src-ip-mask \ mask
+Specify a mask for the source IP address, specified in hex.
+.TP
+.BI dst-ip \ addr
+Includes the destination IP address, specified in hex.
+.TP
+.BI dst-ip-mask \ mask
+Specify a mask for the destination IP address, specified in hex.
+.TP
+.BI src-port \ port
+Includes the source port, specified in decimal.
+.TP
+.BI src-port-mask \ mask
+Specify a mask for the source port, specified in hex.
+.TP
+.BI dst-port \ port
+Includes the destination port, specified in decimal.
+.TP
+.BI dst-port-mask \ mask
+Specify a mask for the destination port, specified in hex.
+.TP
+.BI vlan \ VLAN-tag
+Includes the VLAN tag, specified in hex.
+.TP
+.BI vlan-mask \ mask
+Specify a mask for the VLAN tag, specified in hex.
+.TP
+.BI user-def \ data
+Includes 64-bits of user-specific data, specified in hex.
+.TP
+.BI user-def-mask \ mask
+Specify a mask for the user-specific data, specified in hex.
+.TP
+.BI action \ N
+Specifies either the Rx queue to send packets to, or to drop
+the matched flow.
+.RS
+.PD 0
+.TP 3
+.BR "-1" "             Drop the matched flow"
+.TP 3
+.BR "0 or higher" "    Rx queue to route the flow"
+.PD
+.RE
 .SH BUGS
 Not supported (in part or whole) on all ethernet drivers.
 .SH AUTHOR


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [ethtool PATCH 2/2] ethtool: Update manpage with n-tuple information
  2010-02-26 11:56 ` [ethtool PATCH 2/2] ethtool: Update manpage with n-tuple information Jeff Kirsher
@ 2010-02-26 13:51   ` Jeff Garzik
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2010-02-26 13:51 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: netdev, gospo, Peter P Waskiewicz Jr

On 02/26/2010 06:56 AM, Jeff Kirsher wrote:
> From: Peter Waskiewicz<peter.p.waskiewicz.jr@intel.com>
>
> Add n-tuple information to the ethtool manpage.
>
> Signed-off-by: Peter P Waskiewicz Jr<peter.p.waskiewicz.jr@intel.com>
> Signed-off-by: Jeff Kirsher<jeffrey.t.kirsher@intel.com>
> ---
>
>   ethtool.8 |  102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 files changed, 102 insertions(+), 0 deletions(-)

applied



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-26 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-26 11:55 [ethtool PATCH 1/2] ethtool: Correctly pull n-tuple string length for get_rx_ntuple Jeff Kirsher
2010-02-26 11:56 ` [ethtool PATCH 2/2] ethtool: Update manpage with n-tuple information Jeff Kirsher
2010-02-26 13:51   ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).