* [RFC] ethtool: remove phys_id from ethtool_ops
From: Stephen Hemminger @ 2011-04-09 0:08 UTC (permalink / raw)
To: Ben Hutchings, David Miller; +Cc: netdev
Hold this patch until after the Intel and Qlogic driver
changes are merged into net-next. Patches have been submitted
but still waiting for vendor.
After that all the upstream kernel drivers now use phys_id,
and the old ethtool_ops interface (phys_id) can be removed.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/include/linux/ethtool.h 2011-04-08 16:59:55.691452941 -0700
+++ b/include/linux/ethtool.h 2011-04-08 17:00:26.135748450 -0700
@@ -767,12 +767,6 @@ bool ethtool_invalid_flags(struct net_de
* the indicator accordingly. Finally, it is called with the argument
* %ETHTOOL_ID_INACTIVE and must deactivate the indicator. Returns a
* negative error code or zero.
- * @phys_id: Deprecated in favour of @set_phys_id.
- * Identify the physical device, e.g. by flashing an LED
- * attached to it until interrupted by a signal or the given time
- * (in seconds) elapses. If the given time is zero, use a default
- * time limit. Returns a negative error code or zero. Being
- * interrupted by a signal is not an error.
* @get_ethtool_stats: Return extended statistics about the device.
* This is only useful if the device maintains statistics not
* included in &struct rtnl_link_stats64.
@@ -858,7 +852,6 @@ struct ethtool_ops {
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
void (*get_strings)(struct net_device *, u32 stringset, u8 *);
int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
- int (*phys_id)(struct net_device *, u32);
void (*get_ethtool_stats)(struct net_device *,
struct ethtool_stats *, u64 *);
int (*begin)(struct net_device *);
--- a/net/core/ethtool.c 2011-04-08 17:00:33.259817585 -0700
+++ b/net/core/ethtool.c 2011-04-08 17:01:01.620092913 -0700
@@ -1623,7 +1623,7 @@ static int ethtool_phys_id(struct net_de
static bool busy;
int rc;
- if (!dev->ethtool_ops->set_phys_id && !dev->ethtool_ops->phys_id)
+ if (!dev->ethtool_ops->set_phys_id)
return -EOPNOTSUPP;
if (busy)
@@ -1632,10 +1632,6 @@ static int ethtool_phys_id(struct net_de
if (copy_from_user(&id, useraddr, sizeof(id)))
return -EFAULT;
- if (!dev->ethtool_ops->set_phys_id)
- /* Do it the old way */
- return dev->ethtool_ops->phys_id(dev, id.data);
-
rc = dev->ethtool_ops->set_phys_id(dev, ETHTOOL_ID_ACTIVE);
if (rc && rc != -EINVAL)
return rc;
^ permalink raw reply
* [PATCH net-next-2.6 2/2] niu: Recognise original ethtool class code for AH/ESP flow hashing
From: Ben Hutchings @ 2011-04-08 23:49 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Alexander Duyck, Santwona Behera, Jeff Kirsher
When the RX network flow classification interface was originally
defined for reporting and controlling of flow hashing, AH and ESP were
not given distinct flow class codes (apparently because the Sun
Neptune hardware treats them very similarly).
For flow steering, they must be distinguished, so new and separate
flow class codes were added for AH and ESP. But for backward-
compatibility, flow hash operations should continue to support the
original class codes.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/niu.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 681a42c..dedca01 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -7022,6 +7022,7 @@ static int niu_ethflow_to_class(int flow_type, u64 *class)
case UDP_V4_FLOW:
*class = CLASS_CODE_UDP_IPV4;
break;
+ case AH_ESP_V4_FLOW:
case AH_V4_FLOW:
case ESP_V4_FLOW:
*class = CLASS_CODE_AH_ESP_IPV4;
@@ -7035,6 +7036,7 @@ static int niu_ethflow_to_class(int flow_type, u64 *class)
case UDP_V6_FLOW:
*class = CLASS_CODE_UDP_IPV6;
break;
+ case AH_ESP_V6_FLOW:
case AH_V6_FLOW:
case ESP_V6_FLOW:
*class = CLASS_CODE_AH_ESP_IPV6;
--
1.7.4
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related
* [PATCH net-next-2.6 1/2] gianfar: Clean up implementation of RX network flow classification
From: Ben Hutchings @ 2011-04-08 23:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev, ppc-dev
This code was cribbed from niu, so gfar_set_hash_opts() begins by
converting the ethtool flow class code into a class code for Sun
Neptune hardware, then does the same thing again for the hardware it's
really dealing with. It may also return -1 (-EPERM) for some
unhandled ethtool flow class codes.
Remove the useless code and definitions, and fix the error code.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
This isn't even compile-tested, since it can only be built for some
PowerPC SoCs. Could someone on ppc-dev check that this won't break the
driver?
Ben.
drivers/net/gianfar.h | 17 -------------
drivers/net/gianfar_ethtool.c | 52 +----------------------------------------
2 files changed, 1 insertions(+), 68 deletions(-)
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index ec5d595..57ee3b0 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -382,23 +382,6 @@ extern const char gfar_driver_version[];
#define BD_LFLAG(flags) ((flags) << 16)
#define BD_LENGTH_MASK 0x0000ffff
-#define CLASS_CODE_UNRECOG 0x00
-#define CLASS_CODE_DUMMY1 0x01
-#define CLASS_CODE_ETHERTYPE1 0x02
-#define CLASS_CODE_ETHERTYPE2 0x03
-#define CLASS_CODE_USER_PROG1 0x04
-#define CLASS_CODE_USER_PROG2 0x05
-#define CLASS_CODE_USER_PROG3 0x06
-#define CLASS_CODE_USER_PROG4 0x07
-#define CLASS_CODE_TCP_IPV4 0x08
-#define CLASS_CODE_UDP_IPV4 0x09
-#define CLASS_CODE_AH_ESP_IPV4 0x0a
-#define CLASS_CODE_SCTP_IPV4 0x0b
-#define CLASS_CODE_TCP_IPV6 0x0c
-#define CLASS_CODE_UDP_IPV6 0x0d
-#define CLASS_CODE_AH_ESP_IPV6 0x0e
-#define CLASS_CODE_SCTP_IPV6 0x0f
-
#define FPR_FILER_MASK 0xFFFFFFFF
#define MAX_FILER_IDX 0xFF
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 3bc8e27..0840590 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -645,42 +645,6 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
}
#endif
-static int gfar_ethflow_to_class(int flow_type, u64 *class)
-{
- switch (flow_type) {
- case TCP_V4_FLOW:
- *class = CLASS_CODE_TCP_IPV4;
- break;
- case UDP_V4_FLOW:
- *class = CLASS_CODE_UDP_IPV4;
- break;
- case AH_V4_FLOW:
- case ESP_V4_FLOW:
- *class = CLASS_CODE_AH_ESP_IPV4;
- break;
- case SCTP_V4_FLOW:
- *class = CLASS_CODE_SCTP_IPV4;
- break;
- case TCP_V6_FLOW:
- *class = CLASS_CODE_TCP_IPV6;
- break;
- case UDP_V6_FLOW:
- *class = CLASS_CODE_UDP_IPV6;
- break;
- case AH_V6_FLOW:
- case ESP_V6_FLOW:
- *class = CLASS_CODE_AH_ESP_IPV6;
- break;
- case SCTP_V6_FLOW:
- *class = CLASS_CODE_SCTP_IPV6;
- break;
- default:
- return 0;
- }
-
- return 1;
-}
-
static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow)
{
u32 fcr = 0x0, fpr = FPR_FILER_MASK;
@@ -778,11 +742,6 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
case UDP_V6_FLOW:
cmp_rqfpr = RQFPR_IPV6 |RQFPR_UDP;
break;
- case IPV4_FLOW:
- cmp_rqfpr = RQFPR_IPV4;
- case IPV6_FLOW:
- cmp_rqfpr = RQFPR_IPV6;
- break;
default:
printk(KERN_ERR "Right now this class is not supported\n");
return 0;
@@ -848,18 +807,9 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u
static int gfar_set_hash_opts(struct gfar_private *priv, struct ethtool_rxnfc *cmd)
{
- u64 class;
-
- if (!gfar_ethflow_to_class(cmd->flow_type, &class))
- return -EINVAL;
-
- if (class < CLASS_CODE_USER_PROG1 ||
- class > CLASS_CODE_SCTP_IPV6)
- return -EINVAL;
-
/* write the filer rules here */
if (!gfar_ethflow_to_filer_table(priv, cmd->data, cmd->flow_type))
- return -1;
+ return -EINVAL;
return 0;
}
--
1.7.4
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related
* Re: [ethtool PATCH 2/2] Add support for ESP as a separate protocol from AH
From: Ben Hutchings @ 2011-04-08 23:10 UTC (permalink / raw)
To: Alexander Duyck; +Cc: jeffrey.t.kirsher, netdev
In-Reply-To: <20110408221239.26893.36898.stgit@gitlad.jf.intel.com>
On Fri, 2011-04-08 at 15:12 -0700, Alexander Duyck wrote:
> This change is meant to split out ESP from AH. Currently they are present
> as both a combined value, and two separate values. In order to try and
> support eventually splitting the two out into separate values this change
> makes it so that ESP can be called out separately in ethtool.
[...]
The split between AH and ESP flows is one of several backward-
incompatible changes that Santwona made to RXNFC when adding flow
steering (originally it just dealt with hashing).
1. cxgb4, sfc and earlier versions of niu recognise AH_ESP_V{4,6}_FLOW
class codes for reporting of flow hashing. niu also allowed it to be
controlled.
2. Later versions of niu recognise the separate AH and ESP flow class
codes. gianfar also recognises them, but silently ignores any attempt
to control them!
We should make niu accept AH_ESP_V{4,6}_FLOW again for reporting and
control of flow hashing. ethtool should use class codes
{AH,ESP}_V{4,6}_FLOW for flow steering, but not for flow hashing.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [PATCH] IPV4:Removed the unnecessary loops and made /proc/net/snmp ouput more readable
From: Sasikanth V @ 2011-04-08 22:51 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, James Morris, Patrick McHardy
Cc: netdev, Sasikanth V
Signed-off-by: Sasikanth V <sasikanth.v19@gmail.com>
---
net/ipv4/proc.c | 75 ++++++++++++++++++++----------------------------------
1 files changed, 28 insertions(+), 47 deletions(-)
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index b14ec7d..b4eda92 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -265,12 +265,9 @@ static void icmpmsg_put_line(struct seq_file *seq, unsigned long *vals,
if (count) {
seq_printf(seq, "\nIcmpMsg:");
for (j = 0; j < count; ++j)
- seq_printf(seq, " %sType%u",
+ seq_printf(seq, " %sType%u\t%lu",
type[j] & 0x100 ? "Out" : "In",
- type[j] & 0xff);
- seq_printf(seq, "\nIcmpMsg:");
- for (j = 0; j < count; ++j)
- seq_printf(seq, " %lu", vals[j]);
+ type[j] & 0xff, vals[j]);
}
}
@@ -305,26 +302,26 @@ static void icmp_put(struct seq_file *seq)
int i;
struct net *net = seq->private;
- seq_puts(seq, "\nIcmp: InMsgs InErrors");
- for (i=0; icmpmibmap[i].name != NULL; i++)
- seq_printf(seq, " In%s", icmpmibmap[i].name);
- seq_printf(seq, " OutMsgs OutErrors");
- for (i=0; icmpmibmap[i].name != NULL; i++)
- seq_printf(seq, " Out%s", icmpmibmap[i].name);
- seq_printf(seq, "\nIcmp: %lu %lu",
+ seq_puts(seq, "Icmp:\n");
+ seq_printf(seq, "%-32s\t%lu\n%-32s\t%lu\n","InMsgs",
snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_INMSGS),
+ "InErrors",
snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_INERRORS));
+
for (i=0; icmpmibmap[i].name != NULL; i++)
- seq_printf(seq, " %lu",
- snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics,
- icmpmibmap[i].index));
- seq_printf(seq, " %lu %lu",
+ seq_printf(seq, "%s%-32s\t%lu\n", "In",icmpmibmap[i].name,
+ snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics,
+ icmpmibmap[i].index));
+
+ seq_printf(seq, "%-32s\t%lu\n%-32s\t%lu\n","OutMsgs",
snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_OUTMSGS),
+ "OutErrors",
snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_OUTERRORS));
+
for (i=0; icmpmibmap[i].name != NULL; i++)
- seq_printf(seq, " %lu",
- snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics,
- icmpmibmap[i].index | 0x100));
+ seq_printf(seq, "%s%-32s\t%lu\n", "Out", icmpmibmap[i].name,
+ snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics,
+ icmpmibmap[i].index | 0x100));
}
/*
@@ -335,18 +332,15 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
int i;
struct net *net = seq->private;
- seq_puts(seq, "Ip: Forwarding DefaultTTL");
-
- for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
- seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
-
- seq_printf(seq, "\nIp: %d %d",
- IPV4_DEVCONF_ALL(net, FORWARDING) ? 1 : 2,
+ seq_puts(seq, "Ip:\n");
+ seq_printf(seq, "%-32s\t%d\n%-32s\t%d\n", "Forwarding",
+ IPV4_DEVCONF_ALL(net, FORWARDING) ? 1 : 2,"DefaultTTL",
sysctl_ip_default_ttl);
BUILD_BUG_ON(offsetof(struct ipstats_mib, mibs) != 0);
+
for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
- seq_printf(seq, " %llu",
+ seq_printf(seq, "%-32s\t%llu\n", snmp4_ipstats_list[i].name,
snmp_fold_field64((void __percpu **)net->mib.ip_statistics,
snmp4_ipstats_list[i].entry,
offsetof(struct ipstats_mib, syncp)));
@@ -354,45 +348,32 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
icmp_put(seq); /* RFC 2011 compatibility */
icmpmsg_put(seq);
- seq_puts(seq, "\nTcp:");
- for (i = 0; snmp4_tcp_list[i].name != NULL; i++)
- seq_printf(seq, " %s", snmp4_tcp_list[i].name);
-
- seq_puts(seq, "\nTcp:");
+ seq_puts(seq, "Tcp:\n");
for (i = 0; snmp4_tcp_list[i].name != NULL; i++) {
/* MaxConn field is signed, RFC 2012 */
if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
- seq_printf(seq, " %ld",
+ seq_printf(seq, "%-32s\t%lu\n", snmp4_tcp_list[i].name,
snmp_fold_field((void __percpu **)net->mib.tcp_statistics,
snmp4_tcp_list[i].entry));
else
- seq_printf(seq, " %lu",
+ seq_printf(seq, "%-32s\t%lu\n", snmp4_tcp_list[i].name,
snmp_fold_field((void __percpu **)net->mib.tcp_statistics,
snmp4_tcp_list[i].entry));
}
- seq_puts(seq, "\nUdp:");
- for (i = 0; snmp4_udp_list[i].name != NULL; i++)
- seq_printf(seq, " %s", snmp4_udp_list[i].name);
-
- seq_puts(seq, "\nUdp:");
+ seq_puts(seq, "Udp:\n");
for (i = 0; snmp4_udp_list[i].name != NULL; i++)
- seq_printf(seq, " %lu",
+ seq_printf(seq, "%-32s\t%lu\n", snmp4_udp_list[i].name,
snmp_fold_field((void __percpu **)net->mib.udp_statistics,
snmp4_udp_list[i].entry));
/* the UDP and UDP-Lite MIBs are the same */
- seq_puts(seq, "\nUdpLite:");
- for (i = 0; snmp4_udp_list[i].name != NULL; i++)
- seq_printf(seq, " %s", snmp4_udp_list[i].name);
-
- seq_puts(seq, "\nUdpLite:");
+ seq_puts(seq, "UdpLite:\n");
for (i = 0; snmp4_udp_list[i].name != NULL; i++)
- seq_printf(seq, " %lu",
+ seq_printf(seq, "%-32s\t%lu\n", snmp4_udp_list[i].name,
snmp_fold_field((void __percpu **)net->mib.udplite_statistics,
snmp4_udp_list[i].entry));
- seq_putc(seq, '\n');
return 0;
}
--
1.7.3.4
^ permalink raw reply related
* Re: shutdown(2) does not fully shut down socket any more
From: Kees Cook @ 2011-04-08 22:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20110408.153130.226769035.davem@davemloft.net>
On Fri, Apr 08, 2011 at 03:31:30PM -0700, David Miller wrote:
> From: Kees Cook <kees.cook@canonical.com>
> Date: Fri, 8 Apr 2011 15:30:04 -0700
>
> > Ah! Thanks, I didn't noticed that; I saw no activity on the bugzilla entry,
> > so I thought it hadn't been seen yet.
>
> We bascially do not use kernel.org bugzilla for bug tracking, all
> work and discussions occur only here on the netdev list.
>
> So what Stephen Hemminger, Andrew Morton, and others do is simply
> forward the bug reports here to the list so we can work on them.
Makes sense, yeah. It'd be cool if the forwarder added a note to the bug
saying "this has been forwarded [here]". Then the reporter would know where
to go look for status updates.
But, regardless, it's being looked at. Thanks!
-Kees
--
Kees Cook
Ubuntu Security Team
^ permalink raw reply
* Re: [ethtool PATCH 1/2] ethtool: fix manpage so that it will display tables again
From: Ben Hutchings @ 2011-04-08 22:45 UTC (permalink / raw)
To: Alexander Duyck; +Cc: jeffrey.t.kirsher, netdev
In-Reply-To: <20110408221234.26893.58812.stgit@gitlad.jf.intel.com>
On Fri, 2011-04-08 at 15:12 -0700, Alexander Duyck wrote:
> The current ethtool manpage is not displaying tables. After trying to pass
> the manpage through tbl I repeatedly saw the error:
> tbl:ethtool.8.in:707: unrecognised format `x'
> tbl:ethtool.8.in:707: giving up on this table
>
> By dropping the 'x' the errors went away and when I built the manpage the
> tables reappeared so I am assuming this is the correct approach.
[...]
I think this must depend somewhat on the version of tbl. I must admit I
haven't yet tested with a range of versions.
In groff 1.20.1, the 'x' column flag requested an 'expanded' column
which will be as wide as possible (after allowing for the other column
contents) with its contents word-wrapped if necessary. Without this
flag, tbl wraps some columns poorly and complains about some tables
being too wide (though I don't think they are). Clearly that is less
bad than having it discard the tables altogether, so I will apply this.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [net-next-2.6 PATCH 2/2] ethtool: add ntuple flow specifier data to network flow classifier
From: Alexander Duyck @ 2011-04-08 22:35 UTC (permalink / raw)
To: Ben Hutchings
Cc: davem@davemloft.net, Kirsher, Jeffrey T, netdev@vger.kernel.org
In-Reply-To: <1302301284.2871.25.camel@bwh-desktop>
On 4/8/2011 3:21 PM, Ben Hutchings wrote:
> On Fri, 2011-04-08 at 15:07 -0700, Alexander Duyck wrote:
>> This change is meant to add an ntuple data extensions to the rx network flow
>> classification specifiers. The idea is to allow ntuple to be displayed via
>> the network flow classification interface.
>
> Thanks for carrying on with this.
>
> [...]
>> /**
>> * struct ethtool_rx_flow_spec - specification for RX flow filter
>> * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
>> * @h_u: Flow fields to match (dependent on @flow_type)
>> + * @h_ext: Additional fields to match
>> * @m_u: Masks for flow field bits to be ignored
>> + * @m_ext: Masks for additional field bits to be ignored.
>> + * Note, all additional fields must be ignored unless @flow_type
>> + * includes the %FLOW_EXT flag.
>> * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
>> * if packets should be discarded
>> * @location: Index of filter in hardware table
>> */
>> struct ethtool_rx_flow_spec {
>> __u32 flow_type;
>> - union {
>> - struct ethtool_tcpip4_spec tcp_ip4_spec;
>> - struct ethtool_tcpip4_spec udp_ip4_spec;
>> - struct ethtool_tcpip4_spec sctp_ip4_spec;
>> - struct ethtool_ah_espip4_spec ah_ip4_spec;
>> - struct ethtool_ah_espip4_spec esp_ip4_spec;
>> - struct ethtool_usrip4_spec usr_ip4_spec;
>> - struct ethhdr ether_spec;
>> - __u8 hdata[72];
>> - } h_u, m_u;
>> + union ethtool_flow_union h_u;
>> + struct ethtool_flow_ext h_ext;
>> + union ethtool_flow_union m_u;
>> + struct ethtool_flow_ext m_ext;
>> + __u32 flow_type_ext;
> [...]
>
> You can't add flow_type_ext here. I assume this is an oversight, since
> it isn't mentioned anywhere else.
>
> Ben.
>
Yeah, I forgot and left it in there. It will be removed and resubmitted.
Thanks,
Alex
^ permalink raw reply
* [net-next-2.6 PATCH] v2 ethtool: add ntuple flow specifier data to network flow classifier
From: Alexander Duyck @ 2011-04-08 22:34 UTC (permalink / raw)
To: davem, jeffrey.t.kirsher, bhutchings; +Cc: netdev
This change is meant to add an ntuple data extensions to the rx network flow
classification specifiers. The idea is to allow ntuple to be displayed via
the network flow classification interface.
The first patch had some left over stuff from the original flow extension
flags I had added. That bit is removed in this patch.
This work is based on input from Ben Hutchings.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
include/linux/ethtool.h | 51 +++++++++++++++++++++++++++++------------------
net/socket.c | 14 ++++++-------
2 files changed, 38 insertions(+), 27 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c04d131..68a7310 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -380,27 +380,42 @@ struct ethtool_usrip4_spec {
__u8 proto;
};
+union ethtool_flow_union {
+ struct ethtool_tcpip4_spec tcp_ip4_spec;
+ struct ethtool_tcpip4_spec udp_ip4_spec;
+ struct ethtool_tcpip4_spec sctp_ip4_spec;
+ struct ethtool_ah_espip4_spec ah_ip4_spec;
+ struct ethtool_ah_espip4_spec esp_ip4_spec;
+ struct ethtool_usrip4_spec usr_ip4_spec;
+ struct ethhdr ether_spec;
+ __u8 hdata[60];
+};
+
+struct ethtool_flow_ext {
+ __be16 vlan_etype;
+ __be16 vlan_tci;
+ __be32 data[2];
+};
+
/**
* struct ethtool_rx_flow_spec - specification for RX flow filter
* @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
* @h_u: Flow fields to match (dependent on @flow_type)
+ * @h_ext: Additional fields to match
* @m_u: Masks for flow field bits to be ignored
+ * @m_ext: Masks for additional field bits to be ignored.
+ * Note, all additional fields must be ignored unless @flow_type
+ * includes the %FLOW_EXT flag.
* @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
* if packets should be discarded
* @location: Index of filter in hardware table
*/
struct ethtool_rx_flow_spec {
__u32 flow_type;
- union {
- struct ethtool_tcpip4_spec tcp_ip4_spec;
- struct ethtool_tcpip4_spec udp_ip4_spec;
- struct ethtool_tcpip4_spec sctp_ip4_spec;
- struct ethtool_ah_espip4_spec ah_ip4_spec;
- struct ethtool_ah_espip4_spec esp_ip4_spec;
- struct ethtool_usrip4_spec usr_ip4_spec;
- struct ethhdr ether_spec;
- __u8 hdata[72];
- } h_u, m_u;
+ union ethtool_flow_union h_u;
+ struct ethtool_flow_ext h_ext;
+ union ethtool_flow_union m_u;
+ struct ethtool_flow_ext m_ext;
__u64 ring_cookie;
__u32 location;
};
@@ -458,16 +473,10 @@ struct ethtool_rxnfc {
struct compat_ethtool_rx_flow_spec {
u32 flow_type;
- union {
- struct ethtool_tcpip4_spec tcp_ip4_spec;
- struct ethtool_tcpip4_spec udp_ip4_spec;
- struct ethtool_tcpip4_spec sctp_ip4_spec;
- struct ethtool_ah_espip4_spec ah_ip4_spec;
- struct ethtool_ah_espip4_spec esp_ip4_spec;
- struct ethtool_usrip4_spec usr_ip4_spec;
- struct ethhdr ether_spec;
- u8 hdata[72];
- } h_u, m_u;
+ union ethtool_flow_union h_u;
+ struct ethtool_flow_ext h_ext;
+ union ethtool_flow_union m_u;
+ struct ethtool_flow_ext m_ext;
compat_u64 ring_cookie;
u32 location;
};
@@ -1072,6 +1081,8 @@ struct ethtool_ops {
#define IPV4_FLOW 0x10 /* hash only */
#define IPV6_FLOW 0x11 /* hash only */
#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
+/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
+#define FLOW_EXT 0x80000000
/* L3-L4 network traffic flow hash options */
#define RXH_L2DA (1 << 1)
diff --git a/net/socket.c b/net/socket.c
index 5212447..575c84f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2643,13 +2643,13 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
return -EFAULT;
if (convert_in) {
- /* We expect there to be holes between fs.m_u and
+ /* We expect there to be holes between fs.m_ext and
* fs.ring_cookie and at the end of fs, but nowhere else.
*/
- BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_u) +
- sizeof(compat_rxnfc->fs.m_u) !=
- offsetof(struct ethtool_rxnfc, fs.m_u) +
- sizeof(rxnfc->fs.m_u));
+ BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_ext) +
+ sizeof(compat_rxnfc->fs.m_ext) !=
+ offsetof(struct ethtool_rxnfc, fs.m_ext) +
+ sizeof(rxnfc->fs.m_ext));
BUILD_BUG_ON(
offsetof(struct compat_ethtool_rxnfc, fs.location) -
offsetof(struct compat_ethtool_rxnfc, fs.ring_cookie) !=
@@ -2657,7 +2657,7 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
offsetof(struct ethtool_rxnfc, fs.ring_cookie));
if (copy_in_user(rxnfc, compat_rxnfc,
- (void *)(&rxnfc->fs.m_u + 1) -
+ (void *)(&rxnfc->fs.m_ext + 1) -
(void *)rxnfc) ||
copy_in_user(&rxnfc->fs.ring_cookie,
&compat_rxnfc->fs.ring_cookie,
@@ -2674,7 +2674,7 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
if (convert_out) {
if (copy_in_user(compat_rxnfc, rxnfc,
- (const void *)(&rxnfc->fs.m_u + 1) -
+ (const void *)(&rxnfc->fs.m_ext + 1) -
(const void *)rxnfc) ||
copy_in_user(&compat_rxnfc->fs.ring_cookie,
&rxnfc->fs.ring_cookie,
^ permalink raw reply related
* Re: shutdown(2) does not fully shut down socket any more
From: David Miller @ 2011-04-08 22:31 UTC (permalink / raw)
To: kees.cook; +Cc: netdev
In-Reply-To: <20110408223004.GY4050@outflux.net>
From: Kees Cook <kees.cook@canonical.com>
Date: Fri, 8 Apr 2011 15:30:04 -0700
> Ah! Thanks, I didn't noticed that; I saw no activity on the bugzilla entry,
> so I thought it hadn't been seen yet.
We bascially do not use kernel.org bugzilla for bug tracking, all
work and discussions occur only here on the netdev list.
So what Stephen Hemminger, Andrew Morton, and others do is simply
forward the bug reports here to the list so we can work on them.
^ permalink raw reply
* Re: shutdown(2) does not fully shut down socket any more
From: Kees Cook @ 2011-04-08 22:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20110408.152427.193714809.davem@davemloft.net>
Hi David,
On Fri, Apr 08, 2011 at 03:24:27PM -0700, David Miller wrote:
> Eric Dumazet will be working on fixing this, see:
>
> http://marc.info/?l=linux-netdev&m=130176733401613&w=2
>
> And Stephem Hemminger already forward that bugzilla entry here
> at few days ago.
Ah! Thanks, I didn't noticed that; I saw no activity on the bugzilla entry,
so I thought it hadn't been seen yet.
-Kees
--
Kees Cook
Ubuntu Security Team
^ permalink raw reply
* Re: shutdown(2) does not fully shut down socket any more
From: David Miller @ 2011-04-08 22:24 UTC (permalink / raw)
To: kees.cook; +Cc: netdev
In-Reply-To: <20110408221046.GW4050@outflux.net>
From: Kees Cook <kees.cook@canonical.com>
Date: Fri, 8 Apr 2011 15:10:46 -0700
> Hey all,
>
> I've got a weird regression visible here:
> https://bugzilla.kernel.org/show_bug.cgi?id=32832
>
> Can other people reproduce this, and if so, what's going on? Seems like a
> kernel bug unless I'm misunderstanding something.
Eric Dumazet will be working on fixing this, see:
http://marc.info/?l=linux-netdev&m=130176733401613&w=2
And Stephem Hemminger already forward that bugzilla entry here
at few days ago.
^ permalink raw reply
* Re: [net-next-2.6 PATCH 2/2] ethtool: add ntuple flow specifier data to network flow classifier
From: Ben Hutchings @ 2011-04-08 22:21 UTC (permalink / raw)
To: Alexander Duyck; +Cc: davem, jeffrey.t.kirsher, netdev
In-Reply-To: <20110408220727.25468.53817.stgit@gitlad.jf.intel.com>
On Fri, 2011-04-08 at 15:07 -0700, Alexander Duyck wrote:
> This change is meant to add an ntuple data extensions to the rx network flow
> classification specifiers. The idea is to allow ntuple to be displayed via
> the network flow classification interface.
Thanks for carrying on with this.
[...]
> /**
> * struct ethtool_rx_flow_spec - specification for RX flow filter
> * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
> * @h_u: Flow fields to match (dependent on @flow_type)
> + * @h_ext: Additional fields to match
> * @m_u: Masks for flow field bits to be ignored
> + * @m_ext: Masks for additional field bits to be ignored.
> + * Note, all additional fields must be ignored unless @flow_type
> + * includes the %FLOW_EXT flag.
> * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
> * if packets should be discarded
> * @location: Index of filter in hardware table
> */
> struct ethtool_rx_flow_spec {
> __u32 flow_type;
> - union {
> - struct ethtool_tcpip4_spec tcp_ip4_spec;
> - struct ethtool_tcpip4_spec udp_ip4_spec;
> - struct ethtool_tcpip4_spec sctp_ip4_spec;
> - struct ethtool_ah_espip4_spec ah_ip4_spec;
> - struct ethtool_ah_espip4_spec esp_ip4_spec;
> - struct ethtool_usrip4_spec usr_ip4_spec;
> - struct ethhdr ether_spec;
> - __u8 hdata[72];
> - } h_u, m_u;
> + union ethtool_flow_union h_u;
> + struct ethtool_flow_ext h_ext;
> + union ethtool_flow_union m_u;
> + struct ethtool_flow_ext m_ext;
> + __u32 flow_type_ext;
[...]
You can't add flow_type_ext here. I assume this is an oversight, since
it isn't mentioned anywhere else.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [ethtool PATCH 2/2] Add support for ESP as a separate protocol from AH
From: Alexander Duyck @ 2011-04-08 22:12 UTC (permalink / raw)
To: jeffrey.t.kirsher, bhutchings; +Cc: netdev
In-Reply-To: <20110408221135.26893.50092.stgit@gitlad.jf.intel.com>
This change is meant to split out ESP from AH. Currently they are present
as both a combined value, and two separate values. In order to try and
support eventually splitting the two out into separate values this change
makes it so that ESP can be called out separately in ethtool.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
ethtool.8.in | 8 +++++---
ethtool.c | 21 ++++++++++++++++-----
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/ethtool.8.in b/ethtool.8.in
index 714486e..12a1d1d 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -52,7 +52,7 @@
.\"
.\" \(*FL - flow type values
.\"
-.ds FL \fBtcp4\fP|\fBudp4\fP|\fBah4\fP|\fBsctp4\fP|\fBtcp6\fP|\fBudp6\fP|\fBah6\fP|\fBsctp6\fP
+.ds FL \fBtcp4\fP|\fBudp4\fP|\fBah4\fP|\fBesp4\fP|\fBsctp4\fP|\fBtcp6\fP|\fBudp6\fP|\fBah6\fP|\fBesp6\fP|\fBsctp6\fP
.\"
.\" \(*HO - hash options
.\"
@@ -572,11 +572,13 @@ nokeep;
lB l.
tcp4 TCP over IPv4
udp4 UDP over IPv4
-ah4 IPSEC AH/ESP over IPv4
+ah4 IPSEC AH over IPv4
+esp4 IPSEC ESP over IPv4
sctp4 SCTP over IPv4
tcp6 TCP over IPv6
udp6 UDP over IPv6
-ah6 IPSEC AH/ESP over IPv6
+ah6 IPSEC AH over IPv6
+esp6 IPSEC ESP over IPv6
sctp6 SCTP over IPv6
.TE
.TP
diff --git a/ethtool.c b/ethtool.c
index 32df0ee..1ebf562 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -32,7 +32,6 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <stdio.h>
-#include <string.h>
#include <errno.h>
#include <net/if.h>
#include <sys/utsname.h>
@@ -233,15 +232,15 @@ static struct option {
{ "-S", "--statistics", MODE_GSTATS, "Show adapter statistics" },
{ "-n", "--show-nfc", MODE_GNFC, "Show Rx network flow classification "
"options",
- " [ rx-flow-hash tcp4|udp4|ah4|sctp4|"
- "tcp6|udp6|ah6|sctp6 ]\n" },
+ " [ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|"
+ "tcp6|udp6|ah6|esp6|sctp6 ]\n" },
{ "-f", "--flash", MODE_FLASHDEV, "FILENAME " "Flash firmware image "
"from the specified file to a region on the device",
" [ REGION-NUMBER-TO-FLASH ]\n" },
{ "-N", "--config-nfc", MODE_SNFC, "Configure Rx network flow "
"classification options",
- " [ rx-flow-hash tcp4|udp4|ah4|sctp4|"
- "tcp6|udp6|ah6|sctp6 m|v|t|s|d|f|n|r... ]\n" },
+ " [ rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|"
+ "tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... ]\n" },
{ "-x", "--show-rxfh-indir", MODE_GRXFHINDIR, "Show Rx flow hash "
"indirection" },
{ "-X", "--set-rxfh-indir", MODE_SRXFHINDIR, "Set Rx flow hash indirection",
@@ -785,6 +784,8 @@ static int rxflow_str_to_type(const char *str)
flow_type = UDP_V4_FLOW;
else if (!strcmp(str, "ah4"))
flow_type = AH_ESP_V4_FLOW;
+ else if (!strcmp(str, "esp4"))
+ flow_type = ESP_V4_FLOW;
else if (!strcmp(str, "sctp4"))
flow_type = SCTP_V4_FLOW;
else if (!strcmp(str, "tcp6"))
@@ -793,6 +794,8 @@ static int rxflow_str_to_type(const char *str)
flow_type = UDP_V6_FLOW;
else if (!strcmp(str, "ah6"))
flow_type = AH_ESP_V6_FLOW;
+ else if (!strcmp(str, "esp6"))
+ flow_type = ESP_V6_FLOW;
else if (!strcmp(str, "sctp6"))
flow_type = SCTP_V6_FLOW;
else if (!strcmp(str, "ether"))
@@ -1941,8 +1944,12 @@ static int dump_rxfhash(int fhash, u64 val)
fprintf(stdout, "SCTP over IPV4 flows");
break;
case AH_ESP_V4_FLOW:
+ case AH_V4_FLOW:
fprintf(stdout, "IPSEC AH over IPV4 flows");
break;
+ case ESP_V4_FLOW:
+ fprintf(stdout, "IPSEC ESP over IPV4 flows");
+ break;
case TCP_V6_FLOW:
fprintf(stdout, "TCP over IPV6 flows");
break;
@@ -1953,8 +1960,12 @@ static int dump_rxfhash(int fhash, u64 val)
fprintf(stdout, "SCTP over IPV6 flows");
break;
case AH_ESP_V6_FLOW:
+ case AH_V6_FLOW:
fprintf(stdout, "IPSEC AH over IPV6 flows");
break;
+ case ESP_V6_FLOW:
+ fprintf(stdout, "IPSEC ESP over IPV6 flows");
+ break;
default:
break;
}
^ permalink raw reply related
* [ethtool PATCH 1/2] ethtool: fix manpage so that it will display tables again
From: Alexander Duyck @ 2011-04-08 22:12 UTC (permalink / raw)
To: jeffrey.t.kirsher, bhutchings; +Cc: netdev
In-Reply-To: <20110408221135.26893.50092.stgit@gitlad.jf.intel.com>
The current ethtool manpage is not displaying tables. After trying to pass
the manpage through tbl I repeatedly saw the error:
tbl:ethtool.8.in:707: unrecognised format `x'
tbl:ethtool.8.in:707: giving up on this table
By dropping the 'x' the errors went away and when I built the manpage the
tables reappeared so I am assuming this is the correct approach.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
ethtool.8.in | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ethtool.8.in b/ethtool.8.in
index ed24d4c..714486e 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -540,7 +540,7 @@ names the type of message to enable or disable; \fIN\fR specifies the
new flags numerically. The defined type names and numbers are:
.TS
nokeep;
-lB l lx.
+lB l l.
drv 0x0001 General driver status
probe 0x0002 Hardware probing
link 0x0004 Link state
@@ -569,7 +569,7 @@ Retrieves the receive network flow classification configurations.
Retrieves the hash options for the specified network traffic type.
.TS
nokeep;
-lB lx.
+lB l.
tcp4 TCP over IPv4
udp4 UDP over IPv4
ah4 IPSEC AH/ESP over IPv4
@@ -587,7 +587,7 @@ Configures the receive network flow classification.
Configures the hash options for the specified network traffic type.
.TS
nokeep;
-lB lx.
+lB l.
m Hash on the Layer 2 destination address of the rx packet.
v Hash on the VLAN tag of the rx packet.
t Hash on the Layer 3 protocol field of the rx packet.
@@ -637,7 +637,7 @@ Configure Rx ntuple filters and actions
.B flow\-type tcp4|udp4|sctp4|ether
.TS
nokeep;
-lB lx.
+lB l.
tcp4 TCP over IPv4
udp4 UDP over IPv4
sctp4 SCTP over IPv4
@@ -704,7 +704,7 @@ Specify a mask for the user-specific data.
Specifies the Rx queue to send packets to, or some other action.
.TS
nokeep;
-lB lx.
+lB l.
-2 Clear the filter
-1 Drop the matched flow
0 or higher Rx queue to route the flow
^ permalink raw reply related
* [ethtool PATCH 0/2] Minor ethtool cleanups
From: Alexander Duyck @ 2011-04-08 22:12 UTC (permalink / raw)
To: jeffrey.t.kirsher, bhutchings; +Cc: netdev
These changes address a few minor issues I noticed in ethtool.
---
Alexander Duyck (2):
Add support for ESP as a separate protocol from AH
ethtool: fix manpage so that it will display tables again
ethtool.8.in | 18 ++++++++++--------
ethtool.c | 21 ++++++++++++++++-----
2 files changed, 26 insertions(+), 13 deletions(-)
--
^ permalink raw reply
* shutdown(2) does not fully shut down socket any more
From: Kees Cook @ 2011-04-08 22:10 UTC (permalink / raw)
To: netdev
Hey all,
I've got a weird regression visible here:
https://bugzilla.kernel.org/show_bug.cgi?id=32832
Can other people reproduce this, and if so, what's going on? Seems like a
kernel bug unless I'm misunderstanding something.
Thanks!
-Kees
--
Kees Cook
Ubuntu Security Team
^ permalink raw reply
* [net-next-2.6 PATCH 2/2] ethtool: add ntuple flow specifier data to network flow classifier
From: Alexander Duyck @ 2011-04-08 22:07 UTC (permalink / raw)
To: davem, jeffrey.t.kirsher, bhutchings; +Cc: netdev
In-Reply-To: <20110408220410.25468.49130.stgit@gitlad.jf.intel.com>
This change is meant to add an ntuple data extensions to the rx network flow
classification specifiers. The idea is to allow ntuple to be displayed via
the network flow classification interface.
This work is based on input from Ben Hutchings.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
include/linux/ethtool.h | 52 +++++++++++++++++++++++++++++------------------
net/socket.c | 14 ++++++-------
2 files changed, 39 insertions(+), 27 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c04d131..0423d9f 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -380,27 +380,43 @@ struct ethtool_usrip4_spec {
__u8 proto;
};
+union ethtool_flow_union {
+ struct ethtool_tcpip4_spec tcp_ip4_spec;
+ struct ethtool_tcpip4_spec udp_ip4_spec;
+ struct ethtool_tcpip4_spec sctp_ip4_spec;
+ struct ethtool_ah_espip4_spec ah_ip4_spec;
+ struct ethtool_ah_espip4_spec esp_ip4_spec;
+ struct ethtool_usrip4_spec usr_ip4_spec;
+ struct ethhdr ether_spec;
+ __u8 hdata[60];
+};
+
+struct ethtool_flow_ext {
+ __be16 vlan_etype;
+ __be16 vlan_tci;
+ __be32 data[2];
+};
+
/**
* struct ethtool_rx_flow_spec - specification for RX flow filter
* @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
* @h_u: Flow fields to match (dependent on @flow_type)
+ * @h_ext: Additional fields to match
* @m_u: Masks for flow field bits to be ignored
+ * @m_ext: Masks for additional field bits to be ignored.
+ * Note, all additional fields must be ignored unless @flow_type
+ * includes the %FLOW_EXT flag.
* @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
* if packets should be discarded
* @location: Index of filter in hardware table
*/
struct ethtool_rx_flow_spec {
__u32 flow_type;
- union {
- struct ethtool_tcpip4_spec tcp_ip4_spec;
- struct ethtool_tcpip4_spec udp_ip4_spec;
- struct ethtool_tcpip4_spec sctp_ip4_spec;
- struct ethtool_ah_espip4_spec ah_ip4_spec;
- struct ethtool_ah_espip4_spec esp_ip4_spec;
- struct ethtool_usrip4_spec usr_ip4_spec;
- struct ethhdr ether_spec;
- __u8 hdata[72];
- } h_u, m_u;
+ union ethtool_flow_union h_u;
+ struct ethtool_flow_ext h_ext;
+ union ethtool_flow_union m_u;
+ struct ethtool_flow_ext m_ext;
+ __u32 flow_type_ext;
__u64 ring_cookie;
__u32 location;
};
@@ -458,16 +474,10 @@ struct ethtool_rxnfc {
struct compat_ethtool_rx_flow_spec {
u32 flow_type;
- union {
- struct ethtool_tcpip4_spec tcp_ip4_spec;
- struct ethtool_tcpip4_spec udp_ip4_spec;
- struct ethtool_tcpip4_spec sctp_ip4_spec;
- struct ethtool_ah_espip4_spec ah_ip4_spec;
- struct ethtool_ah_espip4_spec esp_ip4_spec;
- struct ethtool_usrip4_spec usr_ip4_spec;
- struct ethhdr ether_spec;
- u8 hdata[72];
- } h_u, m_u;
+ union ethtool_flow_union h_u;
+ struct ethtool_flow_ext h_ext;
+ union ethtool_flow_union m_u;
+ struct ethtool_flow_ext m_ext;
compat_u64 ring_cookie;
u32 location;
};
@@ -1072,6 +1082,8 @@ struct ethtool_ops {
#define IPV4_FLOW 0x10 /* hash only */
#define IPV6_FLOW 0x11 /* hash only */
#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
+/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
+#define FLOW_EXT 0x80000000
/* L3-L4 network traffic flow hash options */
#define RXH_L2DA (1 << 1)
diff --git a/net/socket.c b/net/socket.c
index 5212447..575c84f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2643,13 +2643,13 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
return -EFAULT;
if (convert_in) {
- /* We expect there to be holes between fs.m_u and
+ /* We expect there to be holes between fs.m_ext and
* fs.ring_cookie and at the end of fs, but nowhere else.
*/
- BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_u) +
- sizeof(compat_rxnfc->fs.m_u) !=
- offsetof(struct ethtool_rxnfc, fs.m_u) +
- sizeof(rxnfc->fs.m_u));
+ BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_ext) +
+ sizeof(compat_rxnfc->fs.m_ext) !=
+ offsetof(struct ethtool_rxnfc, fs.m_ext) +
+ sizeof(rxnfc->fs.m_ext));
BUILD_BUG_ON(
offsetof(struct compat_ethtool_rxnfc, fs.location) -
offsetof(struct compat_ethtool_rxnfc, fs.ring_cookie) !=
@@ -2657,7 +2657,7 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
offsetof(struct ethtool_rxnfc, fs.ring_cookie));
if (copy_in_user(rxnfc, compat_rxnfc,
- (void *)(&rxnfc->fs.m_u + 1) -
+ (void *)(&rxnfc->fs.m_ext + 1) -
(void *)rxnfc) ||
copy_in_user(&rxnfc->fs.ring_cookie,
&compat_rxnfc->fs.ring_cookie,
@@ -2674,7 +2674,7 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
if (convert_out) {
if (copy_in_user(compat_rxnfc, rxnfc,
- (const void *)(&rxnfc->fs.m_u + 1) -
+ (const void *)(&rxnfc->fs.m_ext + 1) -
(const void *)rxnfc) ||
copy_in_user(&compat_rxnfc->fs.ring_cookie,
&rxnfc->fs.ring_cookie,
^ permalink raw reply related
* [net-next-2.6 PATCH 1/2] ethtool: prevent null pointer dereference with NTUPLE set but no set_rx_ntuple
From: Alexander Duyck @ 2011-04-08 22:07 UTC (permalink / raw)
To: davem, jeffrey.t.kirsher, bhutchings; +Cc: netdev
In-Reply-To: <20110408220410.25468.49130.stgit@gitlad.jf.intel.com>
This change is meant to prevent a possible null pointer dereference if
NETIF_F_NTUPLE is defined but the set_rx_ntuple function pointer is not.
The main motivation behind this patch is to eventually replace the ntuple
interfaces entirely with the network flow classifier interfaces. This
allows the device drivers to maintain the ntuple check internally while
using the network flow classifier interface for setting up and displaying
rules.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
net/core/ethtool.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 1b7fa98..704e176 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -910,6 +910,9 @@ static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev,
struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL;
int ret;
+ if (!ops->set_rx_ntuple)
+ return -EOPNOTSUPP;
+
if (!(dev->features & NETIF_F_NTUPLE))
return -EINVAL;
^ permalink raw reply related
* [net-next-2.6 PATCH 0/2] Start of work to cleanup ntuple filters
From: Alexander Duyck @ 2011-04-08 22:07 UTC (permalink / raw)
To: davem, jeffrey.t.kirsher, bhutchings; +Cc: netdev
This patch series is the start of my work to cleanup ntuple filters and the
way they are implemented in ixgbe. These first two patches lay the groundwork
for moving ixgbe over to using the network flow classifier interface instead
of the ntuple interface.
This will eventually allow for ixgbe to be able to maintain its own rule list,
add support for removal of filters, and will correct the multiple display
issues seen with ntuple filters.
---
Alexander Duyck (2):
ethtool: add ntuple flow specifier data to network flow classifier
ethtool: prevent null pointer dereference with NTUPLE set but no set_rx_ntuple
include/linux/ethtool.h | 52 +++++++++++++++++++++++++++++------------------
net/core/ethtool.c | 3 +++
net/socket.c | 14 ++++++-------
3 files changed, 42 insertions(+), 27 deletions(-)
--
^ permalink raw reply
* Re: [Bug 32832] New: shutdown(2) does not fully shut down socket any more
From: David Miller @ 2011-04-08 21:36 UTC (permalink / raw)
To: eric.dumazet; +Cc: shemminger, netdev
In-Reply-To: <1302296633.2656.79.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 08 Apr 2011 23:03:53 +0200
> Le mercredi 06 avril 2011 à 16:48 -0700, David Miller a écrit :
>>
>> This is already being discussed:
>>
>> http://marc.info/?l=linux-netdev&m=130176733401613&w=2
>
>
> Status update : I'll take time this week end to work on this and find a
> solution.
Thanks a lot Eric.
^ permalink raw reply
* [net-next PATCH 3/3] vxge: update driver version
From: Jon Mason @ 2011-04-08 21:11 UTC (permalink / raw)
To: davem; +Cc: netdev
Update vxge driver version to 2.5.3
Signed-off-by: Jon Mason <jdmason@kudzu.us>
---
drivers/net/vxge/vxge-version.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vxge/vxge-version.h b/drivers/net/vxge/vxge-version.h
index 581e215..b9efa28 100644
--- a/drivers/net/vxge/vxge-version.h
+++ b/drivers/net/vxge/vxge-version.h
@@ -16,8 +16,8 @@
#define VXGE_VERSION_MAJOR "2"
#define VXGE_VERSION_MINOR "5"
-#define VXGE_VERSION_FIX "2"
-#define VXGE_VERSION_BUILD "22259"
+#define VXGE_VERSION_FIX "3"
+#define VXGE_VERSION_BUILD "22640"
#define VXGE_VERSION_FOR "k"
#define VXGE_FW_VER(maj, min, bld) (((maj) << 16) + ((min) << 8) + (bld))
--
1.7.0.4
^ permalink raw reply related
* [net-next PATCH 2/3] vxge: spin-lock issue
From: Jon Mason @ 2011-04-08 21:11 UTC (permalink / raw)
To: davem; +Cc: netdev
In vxge_hw_vpath_close, __vxge_hw_vp_terminate memsets the vpath which
clobbers the spin lock state, then the driver attempts to acquire the
spin lock. Resolve this by not zeroing the lock part of vpath struct,
clean-up vpath locking in init, close, and fix locking hole in fw_api
call.
Issue found by Bob Picco <bpicco@redhat.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
---
drivers/net/vxge/vxge-config.c | 48 ++++++++++++++++++++++++++-------------
1 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index e74e4b4..77d0e81 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -159,16 +159,15 @@ vxge_hw_vpath_fw_api(struct __vxge_hw_virtualpath *vpath, u32 action,
u32 fw_memo, u32 offset, u64 *data0, u64 *data1,
u64 *steer_ctrl)
{
- struct vxge_hw_vpath_reg __iomem *vp_reg;
+ struct vxge_hw_vpath_reg __iomem *vp_reg = vpath->vp_reg;
enum vxge_hw_status status;
u64 val64;
- u32 retry = 0, max_retry = 100;
-
- vp_reg = vpath->vp_reg;
+ u32 retry = 0, max_retry = 3;
- if (vpath->vp_open) {
- max_retry = 3;
- spin_lock(&vpath->lock);
+ spin_lock(&vpath->lock);
+ if (!vpath->vp_open) {
+ spin_unlock(&vpath->lock);
+ max_retry = 100;
}
writeq(*data0, &vp_reg->rts_access_steer_data0);
@@ -1000,7 +999,7 @@ exit:
/**
* vxge_hw_device_hw_info_get - Get the hw information
* Returns the vpath mask that has the bits set for each vpath allocated
- * for the driver, FW version information and the first mac addresse for
+ * for the driver, FW version information, and the first mac address for
* each vpath
*/
enum vxge_hw_status __devinit
@@ -1064,9 +1063,10 @@ vxge_hw_device_hw_info_get(void __iomem *bar0,
val64 = readq(&toc->toc_vpath_pointer[i]);
+ spin_lock_init(&vpath.lock);
vpath.vp_reg = (struct vxge_hw_vpath_reg __iomem *)
(bar0 + val64);
- vpath.vp_open = 0;
+ vpath.vp_open = VXGE_HW_VP_NOT_OPEN;
status = __vxge_hw_vpath_pci_func_mode_get(&vpath, hw_info);
if (status != VXGE_HW_OK)
@@ -1090,7 +1090,7 @@ vxge_hw_device_hw_info_get(void __iomem *bar0,
val64 = readq(&toc->toc_vpath_pointer[i]);
vpath.vp_reg = (struct vxge_hw_vpath_reg __iomem *)
(bar0 + val64);
- vpath.vp_open = 0;
+ vpath.vp_open = VXGE_HW_VP_NOT_OPEN;
status = __vxge_hw_vpath_addr_get(&vpath,
hw_info->mac_addrs[i],
@@ -4646,7 +4646,27 @@ static void __vxge_hw_vp_terminate(struct __vxge_hw_device *hldev, u32 vp_id)
vpath->hldev->tim_int_mask1, vpath->vp_id);
hldev->stats.hw_dev_info_stats.vpath_info[vpath->vp_id] = NULL;
- memset(vpath, 0, sizeof(struct __vxge_hw_virtualpath));
+ /* If the whole struct __vxge_hw_virtualpath is zeroed, nothing will
+ * work after the interface is brought down.
+ */
+ spin_lock(&vpath->lock);
+ vpath->vp_open = VXGE_HW_VP_NOT_OPEN;
+ spin_unlock(&vpath->lock);
+
+ vpath->vpmgmt_reg = NULL;
+ vpath->nofl_db = NULL;
+ vpath->max_mtu = 0;
+ vpath->vsport_number = 0;
+ vpath->max_kdfc_db = 0;
+ vpath->max_nofl_db = 0;
+ vpath->ringh = NULL;
+ vpath->fifoh = NULL;
+ memset(&vpath->vpath_handles, 0, sizeof(struct list_head));
+ vpath->stats_block = 0;
+ vpath->hw_stats = NULL;
+ vpath->hw_stats_sav = NULL;
+ vpath->sw_stats = NULL;
+
exit:
return;
}
@@ -4670,7 +4690,7 @@ __vxge_hw_vp_initialize(struct __vxge_hw_device *hldev, u32 vp_id,
vpath = &hldev->virtual_paths[vp_id];
- spin_lock_init(&hldev->virtual_paths[vp_id].lock);
+ spin_lock_init(&vpath->lock);
vpath->vp_id = vp_id;
vpath->vp_open = VXGE_HW_VP_OPEN;
vpath->hldev = hldev;
@@ -5019,10 +5039,6 @@ enum vxge_hw_status vxge_hw_vpath_close(struct __vxge_hw_vpath_handle *vp)
__vxge_hw_vp_terminate(devh, vp_id);
- spin_lock(&vpath->lock);
- vpath->vp_open = VXGE_HW_VP_NOT_OPEN;
- spin_unlock(&vpath->lock);
-
vpath_close_exit:
return status;
}
--
1.7.0.4
^ permalink raw reply related
* [net-next PATCH 1/3] vxge: always enable hardware time stamp
From: Jon Mason @ 2011-04-08 21:11 UTC (permalink / raw)
To: davem; +Cc: netdev
Hardware time stamp calculation can only be enabled by the privileged
function. Enable it always by default and simply use the ethtool
interface to set a flag to indicate whether or not the respective
function driver should indicate the timestamp along with the received
packet.
Also, make certain fields in vxge_hw_device_config bit-fields to reduce
the size of the struct.
Signed-off-by: Jon Mason <jdmason@kudzu.us>
---
drivers/net/vxge/vxge-config.h | 70 ++++++++++++++++++++------------------
drivers/net/vxge/vxge-main.c | 43 ++++++++++++++---------
drivers/net/vxge/vxge-traffic.h | 2 +-
3 files changed, 64 insertions(+), 51 deletions(-)
diff --git a/drivers/net/vxge/vxge-config.h b/drivers/net/vxge/vxge-config.h
index 3c53aa7..359b9b9 100644
--- a/drivers/net/vxge/vxge-config.h
+++ b/drivers/net/vxge/vxge-config.h
@@ -412,44 +412,48 @@ struct vxge_hw_vp_config {
* See also: struct vxge_hw_tim_intr_config{}.
*/
struct vxge_hw_device_config {
- u32 dma_blockpool_initial;
- u32 dma_blockpool_max;
-#define VXGE_HW_MIN_DMA_BLOCK_POOL_SIZE 0
-#define VXGE_HW_INITIAL_DMA_BLOCK_POOL_SIZE 0
-#define VXGE_HW_INCR_DMA_BLOCK_POOL_SIZE 4
-#define VXGE_HW_MAX_DMA_BLOCK_POOL_SIZE 4096
-
-#define VXGE_HW_MAX_PAYLOAD_SIZE_512 2
-
- u32 intr_mode;
-#define VXGE_HW_INTR_MODE_IRQLINE 0
-#define VXGE_HW_INTR_MODE_MSIX 1
-#define VXGE_HW_INTR_MODE_MSIX_ONE_SHOT 2
-
-#define VXGE_HW_INTR_MODE_DEF 0
-
- u32 rth_en;
-#define VXGE_HW_RTH_DISABLE 0
-#define VXGE_HW_RTH_ENABLE 1
-#define VXGE_HW_RTH_DEFAULT 0
-
- u32 rth_it_type;
-#define VXGE_HW_RTH_IT_TYPE_SOLO_IT 0
-#define VXGE_HW_RTH_IT_TYPE_MULTI_IT 1
-#define VXGE_HW_RTH_IT_TYPE_DEFAULT 0
-
- u32 rts_mac_en;
+ u32 device_poll_millis;
+#define VXGE_HW_MIN_DEVICE_POLL_MILLIS 1
+#define VXGE_HW_MAX_DEVICE_POLL_MILLIS 100000
+#define VXGE_HW_DEF_DEVICE_POLL_MILLIS 1000
+
+ u32 dma_blockpool_initial;
+ u32 dma_blockpool_max;
+#define VXGE_HW_MIN_DMA_BLOCK_POOL_SIZE 0
+#define VXGE_HW_INITIAL_DMA_BLOCK_POOL_SIZE 0
+#define VXGE_HW_INCR_DMA_BLOCK_POOL_SIZE 4
+#define VXGE_HW_MAX_DMA_BLOCK_POOL_SIZE 4096
+
+#define VXGE_HW_MAX_PAYLOAD_SIZE_512 2
+
+ u32 intr_mode:2,
+#define VXGE_HW_INTR_MODE_IRQLINE 0
+#define VXGE_HW_INTR_MODE_MSIX 1
+#define VXGE_HW_INTR_MODE_MSIX_ONE_SHOT 2
+
+#define VXGE_HW_INTR_MODE_DEF 0
+
+ rth_en:1,
+#define VXGE_HW_RTH_DISABLE 0
+#define VXGE_HW_RTH_ENABLE 1
+#define VXGE_HW_RTH_DEFAULT 0
+
+ rth_it_type:1,
+#define VXGE_HW_RTH_IT_TYPE_SOLO_IT 0
+#define VXGE_HW_RTH_IT_TYPE_MULTI_IT 1
+#define VXGE_HW_RTH_IT_TYPE_DEFAULT 0
+
+ rts_mac_en:1,
#define VXGE_HW_RTS_MAC_DISABLE 0
#define VXGE_HW_RTS_MAC_ENABLE 1
#define VXGE_HW_RTS_MAC_DEFAULT 0
- struct vxge_hw_vp_config vp_config[VXGE_HW_MAX_VIRTUAL_PATHS];
-
- u32 device_poll_millis;
-#define VXGE_HW_MIN_DEVICE_POLL_MILLIS 1
-#define VXGE_HW_MAX_DEVICE_POLL_MILLIS 100000
-#define VXGE_HW_DEF_DEVICE_POLL_MILLIS 1000
+ hwts_en:1;
+#define VXGE_HW_HWTS_DISABLE 0
+#define VXGE_HW_HWTS_ENABLE 1
+#define VXGE_HW_HWTS_DEFAULT 1
+ struct vxge_hw_vp_config vp_config[VXGE_HW_MAX_VIRTUAL_PATHS];
};
/**
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 395423a..f145293 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -3112,8 +3112,7 @@ vxge_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats)
return net_stats;
}
-static enum vxge_hw_status vxge_timestamp_config(struct vxgedev *vdev,
- int enable)
+static enum vxge_hw_status vxge_timestamp_config(struct __vxge_hw_device *devh)
{
enum vxge_hw_status status;
u64 val64;
@@ -3123,27 +3122,24 @@ static enum vxge_hw_status vxge_timestamp_config(struct vxgedev *vdev,
* required for the driver to load (due to a hardware bug),
* there is no need to do anything special here.
*/
- if (enable)
- val64 = VXGE_HW_XMAC_TIMESTAMP_EN |
- VXGE_HW_XMAC_TIMESTAMP_USE_LINK_ID(0) |
- VXGE_HW_XMAC_TIMESTAMP_INTERVAL(0);
- else
- val64 = 0;
+ val64 = VXGE_HW_XMAC_TIMESTAMP_EN |
+ VXGE_HW_XMAC_TIMESTAMP_USE_LINK_ID(0) |
+ VXGE_HW_XMAC_TIMESTAMP_INTERVAL(0);
- status = vxge_hw_mgmt_reg_write(vdev->devh,
+ status = vxge_hw_mgmt_reg_write(devh,
vxge_hw_mgmt_reg_type_mrpcim,
0,
offsetof(struct vxge_hw_mrpcim_reg,
xmac_timestamp),
val64);
- vxge_hw_device_flush_io(vdev->devh);
+ vxge_hw_device_flush_io(devh);
+ devh->config.hwts_en = VXGE_HW_HWTS_ENABLE;
return status;
}
static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
{
struct hwtstamp_config config;
- enum vxge_hw_status status;
int i;
if (copy_from_user(&config, data, sizeof(config)))
@@ -3164,10 +3160,6 @@ static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
switch (config.rx_filter) {
case HWTSTAMP_FILTER_NONE:
- status = vxge_timestamp_config(vdev, 0);
- if (status != VXGE_HW_OK)
- return -EFAULT;
-
vdev->rx_hwts = 0;
config.rx_filter = HWTSTAMP_FILTER_NONE;
break;
@@ -3186,8 +3178,7 @@ static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
case HWTSTAMP_FILTER_PTP_V2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_SYNC:
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
- status = vxge_timestamp_config(vdev, 1);
- if (status != VXGE_HW_OK)
+ if (vdev->devh->config.hwts_en != VXGE_HW_HWTS_ENABLE)
return -EFAULT;
vdev->rx_hwts = 1;
@@ -4575,6 +4566,24 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
goto _exit4;
}
+ /* Always enable HWTS. This will always cause the FCS to be invalid,
+ * due to the fact that HWTS is using the FCS as the location of the
+ * timestamp. The HW FCS checking will still correctly determine if
+ * there is a valid checksum, and the FCS is being removed by the driver
+ * anyway. So no fucntionality is being lost. Since it is always
+ * enabled, we now simply use the ioctl call to set whether or not the
+ * driver should be paying attention to the HWTS.
+ */
+ if (is_privileged == VXGE_HW_OK) {
+ status = vxge_timestamp_config(hldev);
+ if (status != VXGE_HW_OK) {
+ vxge_debug_init(VXGE_ERR, "%s: HWTS enable failed",
+ VXGE_DRIVER_NAME);
+ ret = -EFAULT;
+ goto _exit4;
+ }
+ }
+
vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_LL);
/* set private device info */
diff --git a/drivers/net/vxge/vxge-traffic.h b/drivers/net/vxge/vxge-traffic.h
index 9d9dfda..c11f72a 100644
--- a/drivers/net/vxge/vxge-traffic.h
+++ b/drivers/net/vxge/vxge-traffic.h
@@ -240,7 +240,7 @@ struct vxge_hw_tim_intr_config {
u32 btimer_val;
#define VXGE_HW_MIN_TIM_BTIMER_VAL 0
#define VXGE_HW_MAX_TIM_BTIMER_VAL 67108864
-#define VXGE_HW_USE_FLASH_DEFAULT 0xffffffff
+#define VXGE_HW_USE_FLASH_DEFAULT (~0)
u32 timer_ac_en;
#define VXGE_HW_TIM_TIMER_AC_ENABLE 1
--
1.7.0.4
^ permalink raw reply related
* Re: [Bug 32832] New: shutdown(2) does not fully shut down socket any more
From: Eric Dumazet @ 2011-04-08 21:03 UTC (permalink / raw)
To: David Miller; +Cc: shemminger, netdev
In-Reply-To: <20110406.164805.193714589.davem@davemloft.net>
Le mercredi 06 avril 2011 à 16:48 -0700, David Miller a écrit :
> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Wed, 6 Apr 2011 16:07:13 -0700
>
> > Begin forwarded message:
> >
> > Date: Wed, 6 Apr 2011 22:42:39 GMT
> > From: bugzilla-daemon@bugzilla.kernel.org
> > To: shemminger@linux-foundation.org
> > Subject: [Bug 32832] New: shutdown(2) does not fully shut down socket any more
> >
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=32832
> >
> > Summary: shutdown(2) does not fully shut down socket any more
> ...
> >
> > In 2.6.35 and earlier, shutdown(2) will fully remove a socket. This does not
> > appear to be true any more and is causing software to misbehave.
> >
>
> This is already being discussed:
>
> http://marc.info/?l=linux-netdev&m=130176733401613&w=2
Status update : I'll take time this week end to work on this and find a
solution.
Thanks
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox