Netdev List
 help / color / mirror / Atom feed
* Re: [patch net-next V4] net: introduce ethernet teaming device
From: Jiri Pirko @ 2011-10-25  6:42 UTC (permalink / raw)
  To: Andy Gospodarek
  Cc: netdev, davem, eric.dumazet, bhutchings, shemminger, fubar, tgraf,
	ebiederm, mirqus, kaber, greearb, jesse, fbl, benjamin.poirier,
	jzupka
In-Reply-To: <20111025000232.GC20605@gospo.rdu.redhat.com>

Tue, Oct 25, 2011 at 02:02:33AM CEST, andy@greyhouse.net wrote:
>On Mon, Oct 24, 2011 at 10:13:25AM +0200, Jiri Pirko wrote:
>> This patch introduces new network device called team. It supposes to be
>> very fast, simple, userspace-driven alternative to existing bonding
>> driver.
>> 
>> Userspace library called libteam with couple of demo apps is available
>> here:
>> https://github.com/jpirko/libteam
>> Note it's still in its dipers atm.
>> 
>> team<->libteam use generic netlink for communication. That and rtnl
>> suppose to be the only way to configure team device, no sysfs etc.
>> 
>> Python binding basis for libteam was recently introduced (some need
>> still need to be done on it though). Daemon providing arpmon/miimon
>> active-backup functionality will be introduced shortly.
>> All what's necessary is already implemented in kernel team driver.
>> 
>> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>> 
>> v3->v4:
>> 	- remove redundant synchronize_rcu from __team_change_mode()
>> 	- revert "set and clear of mode_ops happens per pointer, not per
>> 	  byte"
>> 	- extend comment of function __team_change_mode()
>> 
>> v2->v3:
>> 	- team_change_mtu() user rcu version of list traversal to unwind
>> 	- set and clear of mode_ops happens per pointer, not per byte
>> 	- port hashlist changed to be embedded into team structure
>> 	- error branch in team_port_enter() does cleanup now
>> 	- fixed rtln->rtnl
>> 
>> v1->v2:
>> 	- modes are made as modules. Makes team more modular and
>> 	  extendable.
>> 	- several commenters' nitpicks found on v1 were fixed
>> 	- several other bugs were fixed.
>> 	- note I ignored Eric's comment about roundrobin port selector
>> 	  as Eric's way may be easily implemented as another mode (mode
>> 	  "random") in future.
>
>Jiri,
>
>I've been following this work closely since your first post and now to
>wonder if you could create a 'team' tree somewhere.  It would be nice if
>there was a repo that we could clone for testing and a base for others
>to help with the development and provide patches.
>
>It also might avoid so much of this back and forth, so that you are not
>on v37 by the time the code meets everyones needs. :-)
>
>Once the code goes mainline and Dave pulls your tree, you could then
>remove it.

I believe v5 will be the one :)

Jirka

>
>-andy
>

^ permalink raw reply

* Re: [PATCH] net: allow CAP_NET_RAW to setsockopt SO_PRIORITY
From: Maciej Żenczykowski @ 2011-10-25  6:30 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20111025.022546.1784159727449615100.davem@davemloft.net>

> SO_PRIORITY can control prioritizations that are not influenced
> by packet contents.
>
> There is a huge difference.

I do agree that it can do that, but I'm not sure the difference is
huge as you so put it.
In the vast majority of cases prioritization is desired based on some
meaningful aspect
of a packet that can also be observed later on in the network - hence
vlan tags, tos/tclass marks,
protocol, port numbers and the like.

I guess to me, in the real world (or at least the portion of it I'm
aware of), the difference is minor at best.

Being able to select xmit queues, is kind of like being able to select
output device.
You give a CAP_NET_RAW process raw access to the wire - prioritization seems
just one more aspect of this.  Especially since this isn't permanently
reconfiguring anything.

Anyway, enough discussion ;-)

Cheers,
Maciej

^ permalink raw reply

* Re: [PATCH] net: allow CAP_NET_RAW to setsockopt SO_PRIORITY
From: David Miller @ 2011-10-25  6:25 UTC (permalink / raw)
  To: zenczykowski; +Cc: netdev
In-Reply-To: <CANP3RGfdimCqGL=kdVQdYY0KHqVuVL3CL6arRh3EhdNhyrv9cw@mail.gmail.com>

From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Mon, 24 Oct 2011 22:07:20 -0700

> A raw socket can already spew traffic, ie. packets, with any content.
> This includes VLAN tags and IPv4 TOS field, and IPv6 TCLASS field.
> These are the fields used for packet prioritization at switches and in
> the rest of network fabric.

SO_PRIORITY can control prioritizations that are not influenced
by packet contents.

There is a huge difference.

^ permalink raw reply

* linux-next: manual merge of the bluetooth tree with Linus' tree
From: Stephen Rothwell @ 2011-10-25  6:25 UTC (permalink / raw)
  To: Gustavo F. Padovan
  Cc: linux-next, linux-kernel, Paul Moore, David Miller, netdev,
	Andrei Emeltchenko

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]

Hi Gustavo,

Today's linux-next merge of the bluetooth tree got a conflict in
net/bluetooth/l2cap_sock.c between commit 6230c9b4f895 ("bluetooth:
Properly clone LSM attributes to newly created child connections") from
Linus' tree and commit 15770b1ab974 ("Bluetooth: convert force_active
variable to flag in l2cap chan") from the bluetooth tree.

I fixed it up (see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc net/bluetooth/l2cap_sock.c
index e829236,836d12e..0000000
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@@ -931,12 -944,7 +946,9 @@@ static void l2cap_sock_init(struct soc
  		chan->max_tx = pchan->max_tx;
  		chan->tx_win = pchan->tx_win;
  		chan->sec_level = pchan->sec_level;
- 		chan->role_switch = pchan->role_switch;
- 		chan->force_reliable = pchan->force_reliable;
- 		chan->flushable = pchan->flushable;
- 		chan->force_active = pchan->force_active;
+ 		chan->flags = pchan->flags;
 +
 +		security_sk_clone(parent, sk);
  	} else {
  
  		switch (sk->sk_type) {

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [RFC PATCH 06/17] phy_driver: Add and use phy_driver_[un]register_multiple()
From: Mike Frysinger @ 2011-10-25  5:41 UTC (permalink / raw)
  To: Grant Likely
  Cc: Kyle Moffett, linux-kernel, netdev, David S. Miller,
	Greg Dietsche, Giuseppe Cavallaro, David Daney, Arnaud Patard,
	Baruch Siach, Stephen Hemminger, Lucas De Marchi,
	Marc Kleine-Budde, Andrew Morton
In-Reply-To: <20111025050003.GC798@ponder.secretlab.ca>

On Tue, Oct 25, 2011 at 01:00, Grant Likely wrote:
> On Thu, Oct 20, 2011 at 05:15:54PM -0400, Mike Frysinger wrote:
>> On Thursday 20 October 2011 17:00:13 Kyle Moffett wrote:
>> > +   return phy_driver_register_multiple(bcm63xx_drivers,
>> > +                   ARRAY_SIZE(bcm63xx_drivers));
>>
>> if only the arm ARRAY_AND_SIZE() macro could gain traction in the wider tree:
>>       return phy_driver_register_multiple(ARRAY_AND_SIZE(bcm63xx_drivers));
>
> Propose a patch to move it from arch/arm to include/linux/kernel.h.
> This is the first I've heard of this macro, but I would probably use
> it.

i thought last time rmk suggested it, things got shot down.  but maybe
i remember wrong ... it has been a while since i proposed something
that generated bike shedding, so i'll try again.
-mike

^ permalink raw reply

* Re: [PATCH] net: allow CAP_NET_RAW to setsockopt SO_PRIORITY
From: Maciej Żenczykowski @ 2011-10-25  5:07 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20111025.005819.456617923859129015.davem@davemloft.net>

> SO_PRIORITY influences the packet scheduler and internal
> queueing policies, not just the packet contents that hit
> the wire.
>
> Thus CAP_NET_ADMIN is the appropriate capability check.

I can certainly see why you would think that, but:

A raw socket can already spew traffic, ie. packets, with any content.
This includes VLAN tags and IPv4 TOS field, and IPv6 TCLASS field.
These are the fields used for packet prioritization at switches and in
the rest of network fabric.

AFAICT, it makes no sense to allow a raw socket to prioritize traffic
outside of the host, but
not allow it to prioritize traffic in the host.

- Maciej

^ permalink raw reply

* [PATCH] net: make bonding slaves honour master's skb->priority
From: Maciej Żenczykowski @ 2011-10-25  5:04 UTC (permalink / raw)
  To: Maciej Żenczykowski; +Cc: netdev, Maciej Żenczykowski
In-Reply-To: <1319517660-22085-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <maze@google.com>

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 drivers/net/bonding/bond_main.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 41430ba..2cbc2f8 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -395,7 +395,6 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
 			struct net_device *slave_dev)
 {
 	skb->dev = slave_dev;
-	skb->priority = 1;
 
 	skb->queue_mapping = bond_queue_mapping(skb);
 
-- 
1.7.3.1

^ permalink raw reply related

* Re: [PATCH] net: make bonding slaves honour master's skb->priority
From: Maciej Żenczykowski @ 2011-10-25  5:02 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20111025.005859.101223081342927863.davem@davemloft.net>

These are Gerrit (code review system) commit headers, normally I drop
them, I missed that here (they get added automatically by git hooks).
I'll send it again.

Sorry.

- Maciej

^ permalink raw reply

* Re: [RFC PATCH 06/17] phy_driver: Add and use phy_driver_[un]register_multiple()
From: Grant Likely @ 2011-10-25  5:00 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: Kyle Moffett, linux-kernel, netdev, David S. Miller,
	Greg Dietsche, Giuseppe Cavallaro, David Daney, Arnaud Patard,
	Baruch Siach, Stephen Hemminger, Lucas De Marchi,
	Marc Kleine-Budde, Andrew Morton
In-Reply-To: <201110201715.58441.vapier@gentoo.org>

On Thu, Oct 20, 2011 at 05:15:54PM -0400, Mike Frysinger wrote:
> On Thursday 20 October 2011 17:00:13 Kyle Moffett wrote:
> > +	return phy_driver_register_multiple(bcm63xx_drivers,
> > +			ARRAY_SIZE(bcm63xx_drivers));
> 
> if only the arm ARRAY_AND_SIZE() macro could gain traction in the wider tree:
> 	return phy_driver_register_multiple(ARRAY_AND_SIZE(bcm63xx_drivers));

Propose a patch to move it from arch/arm to include/linux/kernel.h.
This is the first I've heard of this macro, but I would probably use
it.

> ignoring that, this patch looks cool
> 
> Acked-by: Mike Frysinger <vapier@gentoo.org>

Indeed, I like the diffstat.  :-)

Acked-by: Grant Likely <grant.likely@secretlab.ca>

^ permalink raw reply

* Re: [PATCH] net: make bonding slaves honour master's skb->priority
From: David Miller @ 2011-10-25  4:58 UTC (permalink / raw)
  To: zenczykowski; +Cc: maze, netdev
In-Reply-To: <1319517660-22085-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Mon, 24 Oct 2011 21:41:00 -0700

> From: Maciej Żenczykowski <maze@google.com>
> 
> Change-Id: Ieea6ff9aacacb1eb8c52308c8bfe091acbfc09b2

What are these Change-Id tags?  Please don't put these in
your commit message.

I'm dropping this patch, you'll need to resubmit it without
this thing.

^ permalink raw reply

* Re: [PATCH] net: make bonding slaves honour master's skb->priority
From: Jay Vosburgh @ 2011-10-25  4:58 UTC (permalink / raw)
  To: Maciej Żenczykowski; +Cc: Maciej Żenczykowski, netdev
In-Reply-To: <1319517660-22085-1-git-send-email-zenczykowski@gmail.com>

Maciej Żenczykowski <zenczykowski@gmail.com> wrote:

>From: Maciej Żenczykowski <maze@google.com>
>
>Change-Id: Ieea6ff9aacacb1eb8c52308c8bfe091acbfc09b2

	The code change itself is ok, but I'm not sure what this
Change-Id is.  With a regular log message, this should be fine to apply.

	-J


>Signed-off-by: Maciej Żenczykowski <maze@google.com>
>---
> drivers/net/bonding/bond_main.c |    1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 41430ba..2cbc2f8 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -395,7 +395,6 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
> 			struct net_device *slave_dev)
> {
> 	skb->dev = slave_dev;
>-	skb->priority = 1;
>
> 	skb->queue_mapping = bond_queue_mapping(skb);
>
>-- 
>1.7.3.1

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

^ permalink raw reply

* Re: [PATCH] net: allow CAP_NET_RAW to setsockopt SO_PRIORITY
From: David Miller @ 2011-10-25  4:58 UTC (permalink / raw)
  To: zenczykowski; +Cc: maze, netdev
In-Reply-To: <1319518038-28679-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Mon, 24 Oct 2011 21:47:18 -0700

> It is my belief that CAP_NET_ADMIN is and should continue to be about
> configuring the system as a whole, not about configuring per-socket
> or per-packet parameters.
> 
> Sending and receiving raw packets is what CAP_NET_RAW is all about.
> Hence it makes sense to allow a CAP_NET_RAW process to set the
> priority of sockets and thus packets it sends.

SO_PRIORITY influences the packet scheduler and internal
queueing policies, not just the packet contents that hit
the wire.

Thus CAP_NET_ADMIN is the appropriate capability check.

^ permalink raw reply

* Re: [RFC PATCH 02/17] of_mdio: Don't phy_scan_fixups() twice
From: Grant Likely @ 2011-10-25  4:56 UTC (permalink / raw)
  To: Kyle Moffett; +Cc: linux-kernel, netdev, devicetree-discuss
In-Reply-To: <1319144425-15547-3-git-send-email-Kyle.D.Moffett@boeing.com>

On Thu, Oct 20, 2011 at 05:00:09PM -0400, Kyle Moffett wrote:
> The "phy_device_register()" call 5 lines down already calls
> phy_scan_fixups(), there's no need to do it a second time.
> 
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

Applied, thanks.

g.

> ---
>  drivers/of/of_mdio.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
> index d35e300..980c079 100644
> --- a/drivers/of/of_mdio.c
> +++ b/drivers/of/of_mdio.c
> @@ -83,7 +83,6 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
>  				addr);
>  			continue;
>  		}
> -		phy_scan_fixups(phy);
>  
>  		/* Associate the OF node with the device structure so it
>  		 * can be looked up later */
> -- 
> 1.7.2.5
> 

^ permalink raw reply

* RE: [PATCH net-next 0/4] be2net: fixes
From: Sathya.Perla @ 2011-10-25  4:49 UTC (permalink / raw)
  To: davem; +Cc: netdev
In-Reply-To: <20111024.183546.495965585975609045.davem@davemloft.net>

>-----Original Message-----
>From: David Miller [mailto:davem@davemloft.net]
>Sent: Tuesday, October 25, 2011 4:06 AM
>
>From: Sathya Perla <sathya.perla@emulex.com>
>Date: Mon, 24 Oct 2011 18:14:59 +0530
>
>> Pls apply.
>>
>> Sathya Perla (4):
>>   be2net: add vlan/rx-mode/flow-control config to be_setup()
>>   be2net: refactor VF setup/teardown code into be_vf_setup/clear()
>>   be2net: don't create multiple TXQs in BE2
>>   be2net: don't create multiple RX/TX rings in multi channel mode
>
>Applied, but many of your commit messages were poorly formatted (lines
>exceeding 80 columns) and patches #1 and #2 had several trailing
>whitespace errors.
>
>I fixed this all up, but you have to be better than this.
Dave, thanks. Will be careful....

^ permalink raw reply

* [PATCH] net: allow CAP_NET_RAW to setsockopt SO_PRIORITY
From: Maciej Żenczykowski @ 2011-10-25  4:47 UTC (permalink / raw)
  To: Maciej Żenczykowski; +Cc: netdev, Maciej Żenczykowski

From: Maciej Żenczykowski <maze@google.com>

It is my belief that CAP_NET_ADMIN is and should continue to be about
configuring the system as a whole, not about configuring per-socket
or per-packet parameters.

Sending and receiving raw packets is what CAP_NET_RAW is all about.
Hence it makes sense to allow a CAP_NET_RAW process to set the
priority of sockets and thus packets it sends.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/core/sock.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 5a08762..3d163b6 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -612,7 +612,8 @@ set_rcvbuf:
 		break;
 
 	case SO_PRIORITY:
-		if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN))
+		if ((val >= 0 && val <= 6)
+		    || capable(CAP_NET_ADMIN) || capable(CAP_NET_RAW))
 			sk->sk_priority = val;
 		else
 			ret = -EPERM;
-- 
1.7.3.1

^ permalink raw reply related

* [PATCH] net: make bonding slaves honour master's skb->priority
From: Maciej Żenczykowski @ 2011-10-25  4:41 UTC (permalink / raw)
  To: Maciej Żenczykowski; +Cc: netdev, Maciej Żenczykowski

From: Maciej Żenczykowski <maze@google.com>

Change-Id: Ieea6ff9aacacb1eb8c52308c8bfe091acbfc09b2
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 drivers/net/bonding/bond_main.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 41430ba..2cbc2f8 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -395,7 +395,6 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
 			struct net_device *slave_dev)
 {
 	skb->dev = slave_dev;
-	skb->priority = 1;
 
 	skb->queue_mapping = bond_queue_mapping(skb);
 
-- 
1.7.3.1

^ permalink raw reply related

* Re: [PATCH v4 0/9] Cleanup and extension of netdev features
From: Eric Dumazet @ 2011-10-25  3:44 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: netdev, David S. Miller, Ben Hutchings
In-Reply-To: <1319513754.3834.4.camel@edumazet-laptop>

Le mardi 25 octobre 2011 à 05:35 +0200, Eric Dumazet a écrit :

> 
> $ ip link show dev vlan.103
> 7: vlan.103@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> pfifo_fast state UP qlen 100
>     link/ether 00:1e:0b:ec:d3:d2 brd ff:ff:ff:ff:ff:ff
> 
> 
> But :
> 
> $ ethtool -k vlan.103
> Offload parameters for vlan.103:
> rx-checksumming: off
> tx-checksumming: off
> scatter-gather: off
> tcp-segmentation-offload: off
> udp-fragmentation-offload: off
> generic-segmentation-offload: off
> generic-receive-offload: on
> large-receive-offload: off
> rx-vlan-offload: off
> tx-vlan-offload: off
> ntuple-filters: off
> receive-hashing: off
> 
> So basically all features but GRO are off.
> 
> 

By the way If I use vlan on top of nic, it seems OK, so bonding is the
suspect ?

$ ip link add link eth3 eth3.103 type vlan id 103
$ ifconfig eth3.103 up
$ ethtool -k eth3.103
Offload parameters for eth3.103:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: off

^ permalink raw reply

* Re: [PATCH v4 0/9] Cleanup and extension of netdev features
From: Eric Dumazet @ 2011-10-25  3:35 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: netdev, David S. Miller, Ben Hutchings
In-Reply-To: <cover.1319495301.git.mirq-linux@rere.qmqm.pl>

Le mardi 25 octobre 2011 à 02:36 +0200, Michał Mirosław a écrit :
> Commit fd38f734 (igbvf: convert to ndo_fix_features) removed last use
> of old ethtool ops for controlling netdevice's features. This series
> finishes the cleanup and extends feature pool to 64 bits.
> 
> Also, there's additional patch that removes NETIF_F_NO_CSUM as it is
> now, and has been for some time, equivalent to NETIF_F_HW_CSUM.
> 
> To see the new features in action, you need ethtool patched with:
> 
> http://patchwork.ozlabs.org/patch/96374/
> 
> Not much has changed in those patches compared to last version I posted
> in June.

Hi Michal

This reminds me current net-next is busted for bond/vlan, I dont know
why.



$ cat /proc/net/bonding/bond0 
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:1e:0b:ec:d3:d2
Slave queue ID: 0

Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:1e:0b:92:78:50
Slave queue ID: 0

$ ethtool -k eth1
Offload parameters for eth1:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: on


$ ethtool -k eth2
Offload parameters for eth2:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: off


$ ethtool -k bond0
Offload parameters for bond0:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: off



$ ip link show dev vlan.103
7: vlan.103@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
pfifo_fast state UP qlen 100
    link/ether 00:1e:0b:ec:d3:d2 brd ff:ff:ff:ff:ff:ff


But :

$ ethtool -k vlan.103
Offload parameters for vlan.103:
rx-checksumming: off
tx-checksumming: off
scatter-gather: off
tcp-segmentation-offload: off
udp-fragmentation-offload: off
generic-segmentation-offload: off
generic-receive-offload: on
large-receive-offload: off
rx-vlan-offload: off
tx-vlan-offload: off
ntuple-filters: off
receive-hashing: off

So basically all features but GRO are off.

^ permalink raw reply

* Re: [RFC v2 PATCH 5/4 PATCH] virtio-net: send gratuitous packet when needed
From: Jason Wang @ 2011-10-25  2:50 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: aliguori, kvm, quintela, jan.kiszka, Rusty Russell, qemu-devel,
	blauwirbel, netdev, pbonzini
In-Reply-To: <20111024052526.GA2362@redhat.com>

On 10/24/2011 01:25 PM, Michael S. Tsirkin wrote:
> On Mon, Oct 24, 2011 at 02:54:59PM +1030, Rusty Russell wrote:
>> On Sat, 22 Oct 2011 13:43:11 +0800, Jason Wang <jasowang@redhat.com> wrote:
>>> This make let virtio-net driver can send gratituous packet by a new
>>> config bit - VIRTIO_NET_S_ANNOUNCE in each config update
>>> interrupt. When this bit is set by backend, the driver would schedule
>>> a workqueue to send gratituous packet through NETDEV_NOTIFY_PEERS.
>>>
>>> This feature is negotiated through bit VIRTIO_NET_F_GUEST_ANNOUNCE.
>>>
>>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>>
>> This seems like a huge layering violation.  Imagine this in real
>> hardware, for example.
> 
> commits 06c4648d46d1b757d6b9591a86810be79818b60c
> and 99606477a5888b0ead0284fecb13417b1da8e3af
> document the need for this:
> 
> NETDEV_NOTIFY_PEERS notifier indicates that a device moved to a 
> different physical link.
> 	and
> In real hardware such notifications are only
> generated when the device comes up or the address changes.
> 
> So hypervisor could get the same behaviour by sending link up/down
> events, this is just an optimization so guest won't do
> unecessary stuff like try to reconfigure an IP address.
> 
> 
> Maybe LOCATION_CHANGE would be a better name?
> 

ANNOUNCE_SELF?

> 
>> There may be a good reason why virtual devices might want this kind of
>> reconfiguration cheat, which is unnecessary for normal machines,
> 
> I think yes, the difference with real hardware is guest can change
> location without link getting dropped.
> FWIW, Xen seems to use this capability too.

So does ms netvsc.

> 
>> but
>> it'd have to be spelled out clearly in the spec to justify it...
>>
>> Cheers,
>> Rusty.
> 
> Agree, and I'd like to see the spec too. The interface seems
> to involve the guest clearing the status bit when it detects
> an event?

I would describe this in spec. The interface need guest to clear the
status bit, this would let the back-end know it has finished the work as
we may need to send the gratuitous packets many times.

> 
> Also - how does it interact with the link up event?
> We probably don't want to schedule this when we detect
> a link status change or during initialization, as
> this patch seems to do? What if link goes down
> while the work is running? Is that OK?
> 

Looks like there's are duplications if guest enable arp_notify vm is
started, but we need to handle the situation that resuming a stopped
virtual machine.

For the link down race, I don't see any real issue, either dropping or
queued.

^ permalink raw reply

* Re: [PATCH V2 2/4] MIPS: Add board support for Loongson1B
From: Kelvin Cheung @ 2011-10-25  2:12 UTC (permalink / raw)
  To: Giuseppe CAVALLARO
  Cc: Wu Zhangjin, linux-mips, linux-kernel, ralf, r0bertz, netdev
In-Reply-To: <4EA585B5.5030405@st.com>

2011/10/24, Giuseppe CAVALLARO <peppe.cavallaro@st.com>:
> On 10/24/2011 4:05 PM, Kelvin Cheung wrote:
>> 2011/10/24, Giuseppe CAVALLARO <peppe.cavallaro@st.com>:
>>> Hello Kelvin.
>>>
>>> On 10/24/2011 12:36 PM, Kelvin Cheung wrote:
>>>
>>> [snip]
>>>
>>>> According to datasheet of Loongson 1B, the buffer size in RX/TX
>>>> descriptor is only 2KB. So the Loongson1B's GMAC could not handle
>>>> jumbo frames. And the second buffer is useless in this case. Am I
>>>> right? Is there a better way than ifdef CONFIG_MACH_LOONGSON1 to
>>>> avoid duplicate code?
>>>
>>> Sorry for my misunderstanding.
>>>
>>> I think you have to use the normal descriptor and remove the enh_desc
>>> from the platform w/o modifying the driver at all.
>>>
>>> The driver will be able to select/configure all automatically (also
>>> jumbo).
>>>
>>> Let me know.
>>
>> That's the problem.
>> The bitfield definition of Loongson1B is also different from normal
>> descriptor.
>
> The problem is not in the Loongson1B gmac.

I found that the bit checksum_insertion is not existed in normal descriptor.

> The normal descriptor fields in the stmmac refer to an old synopsys
> databook.

Could you send me the new databook of Synopsys GMAC?

> New chips have the same structure you have added; so we should fix this
> in the driver w/o breaking the compatibility for old chips.

Agree.

> I kindly ask you to confirm if the currently normal descriptor structure
> (w/o your changes) doesn't work on your platform.
> Did you test it?

Well, the normal descriptor works on my platform except TX checksum offload.

>> Moreover, I want to enable the TX checksum offload function which is
>> not supported in normal descriptor.
>> Any suggestions?
>
> It is supported but you have to pass from the platform: tx_coe = 1.

I noticed that the flag csum_insertion is passed to
ndesc_prepare_tx_desc() in stmmac_xmit(). But ndesc_prepare_tx_desc()
just ignores it.
In other words, the TX checksum offload function is disabled in normal
descriptor currently.

Should we fix this problem for normal descriptor?

> Peppe
>>
>>> Note:
>>> IIRC, there is a bit difference in case of normal descriptors for
>>> Synopsys databook newer than the 1.91 (I used for testing this mode).
>>> In any case, I remember that, on some platforms, the normal descriptors
>>> have been used w/o problems also on these new chip generations.
>>>
>>> Peppe
>>>
>>>
>>
>>
>
>


-- 
Best Regards!
Kelvin

^ permalink raw reply

* [PATCH v4 5/9] net: Define enum for net device features.
From: Michał Mirosław @ 2011-10-25  0:36 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Ben Hutchings
In-Reply-To: <cover.1319495301.git.mirq-linux@rere.qmqm.pl>

Define feature values by bit position instead of direct 2**i values
and force the values to be of type netdev_features_t.

Cleaned and extended from patch by Mahesh Bandewar <maheshb@google.com>:
+ added netdev_features_t casts
+ included bits under NETIF_F_GSO_MASK
+ moved feature #defines out of struct net_device definition

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 include/linux/netdev_features.h |  129 +++++++++++++++++++++++++++-----------
 1 files changed, 91 insertions(+), 38 deletions(-)

diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index af52381..04ac8f8 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -14,52 +14,105 @@
 
 typedef u32 netdev_features_t;
 
-/* Net device feature bits; if you change something,
- * also update netdev_features_strings[] in ethtool.c */
-
-#define NETIF_F_SG		1	/* Scatter/gather IO. */
-#define NETIF_F_IP_CSUM		2	/* Can checksum TCP/UDP over IPv4. */
-#define NETIF_F_NO_CSUM		4	/* Does not require checksum. F.e. loopack. */
-#define NETIF_F_HW_CSUM		8	/* Can checksum all the packets. */
-#define NETIF_F_IPV6_CSUM	16	/* Can checksum TCP/UDP over IPV6 */
-#define NETIF_F_HIGHDMA		32	/* Can DMA to high memory. */
-#define NETIF_F_FRAGLIST	64	/* Scatter/gather IO. */
-#define NETIF_F_HW_VLAN_TX	128	/* Transmit VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_RX	256	/* Receive VLAN hw acceleration */
-#define NETIF_F_HW_VLAN_FILTER	512	/* Receive filtering on VLAN */
-#define NETIF_F_VLAN_CHALLENGED	1024	/* Device cannot handle VLAN packets */
-#define NETIF_F_GSO		2048	/* Enable software GSO. */
-#define NETIF_F_LLTX		4096	/* LockLess TX - deprecated. Please */
+enum {
+	NETIF_F_SG_BIT,			/* Scatter/gather IO. */
+	NETIF_F_IP_CSUM_BIT,		/* Can checksum TCP/UDP over IPv4. */
+	NETIF_F_NO_CSUM_BIT,		/* Does not require checksum. F.e. loopack. */
+	NETIF_F_HW_CSUM_BIT,		/* Can checksum all the packets. */
+	NETIF_F_IPV6_CSUM_BIT,		/* Can checksum TCP/UDP over IPV6 */
+	NETIF_F_HIGHDMA_BIT,		/* Can DMA to high memory. */
+	NETIF_F_FRAGLIST_BIT,		/* Scatter/gather IO. */
+	NETIF_F_HW_VLAN_TX_BIT,		/* Transmit VLAN hw acceleration */
+	NETIF_F_HW_VLAN_RX_BIT,		/* Receive VLAN hw acceleration */
+	NETIF_F_HW_VLAN_FILTER_BIT,	/* Receive filtering on VLAN */
+	NETIF_F_VLAN_CHALLENGED_BIT,	/* Device cannot handle VLAN packets */
+	NETIF_F_GSO_BIT,		/* Enable software GSO. */
+	NETIF_F_LLTX_BIT,		/* LockLess TX - deprecated. Please */
 					/* do not use LLTX in new drivers */
-#define NETIF_F_NETNS_LOCAL	8192	/* Does not change network namespaces */
-#define NETIF_F_GRO		16384	/* Generic receive offload */
-#define NETIF_F_LRO		32768	/* large receive offload */
+	NETIF_F_NETNS_LOCAL_BIT,	/* Does not change network namespaces */
+	NETIF_F_GRO_BIT,		/* Generic receive offload */
+	NETIF_F_LRO_BIT,		/* large receive offload */
 
-/* the GSO_MASK reserves bits 16 through 23 */
-#define NETIF_F_FCOE_CRC	(1 << 24) /* FCoE CRC32 */
-#define NETIF_F_SCTP_CSUM	(1 << 25) /* SCTP checksum offload */
-#define NETIF_F_FCOE_MTU	(1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
-#define NETIF_F_NTUPLE		(1 << 27) /* N-tuple filters supported */
-#define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
-#define NETIF_F_RXCSUM		(1 << 29) /* Receive checksumming offload */
-#define NETIF_F_NOCACHE_COPY	(1 << 30) /* Use no-cache copyfromuser */
-#define NETIF_F_LOOPBACK	(1 << 31) /* Enable loopback */
+	/**/NETIF_F_GSO_SHIFT,		/* keep the order of SKB_GSO_* bits */
+	NETIF_F_TSO_BIT			/* ... TCPv4 segmentation */
+		= NETIF_F_GSO_SHIFT,
+	NETIF_F_UFO_BIT,		/* ... UDPv4 fragmentation */
+	NETIF_F_GSO_ROBUST_BIT,		/* ... ->SKB_GSO_DODGY */
+	NETIF_F_TSO_ECN_BIT,		/* ... TCP ECN support */
+	NETIF_F_TSO6_BIT,		/* ... TCPv6 segmentation */
+	NETIF_F_FSO_BIT,		/* ... FCoE segmentation */
+	NETIF_F_GSO_RESERVED1,		/* ... free (fill GSO_MASK to 8 bits) */
+	/**/NETIF_F_GSO_LAST,		/* [can't be last bit, see GSO_MASK] */
+	NETIF_F_GSO_RESERVED2		/* ... free (fill GSO_MASK to 8 bits) */
+		= NETIF_F_GSO_LAST,
 
-/* Segmentation offload features */
-#define NETIF_F_GSO_SHIFT	16
-#define NETIF_F_GSO_MASK	0x00ff0000
-#define NETIF_F_TSO		(SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
-#define NETIF_F_UFO		(SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
-#define NETIF_F_GSO_ROBUST	(SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
-#define NETIF_F_TSO_ECN		(SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
-#define NETIF_F_TSO6		(SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
-#define NETIF_F_FSO		(SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
+	NETIF_F_FCOE_CRC_BIT,		/* FCoE CRC32 */
+	NETIF_F_SCTP_CSUM_BIT,		/* SCTP checksum offload */
+	NETIF_F_FCOE_MTU_BIT,		/* Supports max FCoE MTU, 2158 bytes*/
+	NETIF_F_NTUPLE_BIT,		/* N-tuple filters supported */
+	NETIF_F_RXHASH_BIT,		/* Receive hashing offload */
+	NETIF_F_RXCSUM_BIT,		/* Receive checksumming offload */
+	NETIF_F_NOCACHE_COPY_BIT,	/* Use no-cache copyfromuser */
+	NETIF_F_LOOPBACK_BIT,		/* Enable loopback */
+
+	/*
+	 * Add your fresh new feature above and remember to update
+	 * netdev_features_strings[] in net/core/ethtool.c and maybe
+	 * some feature mask #defines below. Please also describe it
+	 * in Documentation/networking/netdev-features.txt.
+	 */
+
+	/**/NETDEV_FEATURE_COUNT
+};
+
+/* copy'n'paste compression ;) */
+#define __NETIF_F_BIT(bit)	((netdev_features_t)1 << (bit))
+#define __NETIF_F(name)		__NETIF_F_BIT(NETIF_F_##name##_BIT)
+
+#define NETIF_F_FCOE_CRC	__NETIF_F(FCOE_CRC)
+#define NETIF_F_FCOE_MTU	__NETIF_F(FCOE_MTU)
+#define NETIF_F_FRAGLIST	__NETIF_F(FRAGLIST)
+#define NETIF_F_FSO		__NETIF_F(FSO)
+#define NETIF_F_GRO		__NETIF_F(GRO)
+#define NETIF_F_GSO		__NETIF_F(GSO)
+#define NETIF_F_GSO_ROBUST	__NETIF_F(GSO_ROBUST)
+#define NETIF_F_HIGHDMA		__NETIF_F(HIGHDMA)
+#define NETIF_F_HW_CSUM		__NETIF_F(HW_CSUM)
+#define NETIF_F_HW_VLAN_FILTER	__NETIF_F(HW_VLAN_FILTER)
+#define NETIF_F_HW_VLAN_RX	__NETIF_F(HW_VLAN_RX)
+#define NETIF_F_HW_VLAN_TX	__NETIF_F(HW_VLAN_TX)
+#define NETIF_F_IP_CSUM		__NETIF_F(IP_CSUM)
+#define NETIF_F_IPV6_CSUM	__NETIF_F(IPV6_CSUM)
+#define NETIF_F_LLTX		__NETIF_F(LLTX)
+#define NETIF_F_LOOPBACK	__NETIF_F(LOOPBACK)
+#define NETIF_F_LRO		__NETIF_F(LRO)
+#define NETIF_F_NETNS_LOCAL	__NETIF_F(NETNS_LOCAL)
+#define NETIF_F_NOCACHE_COPY	__NETIF_F(NOCACHE_COPY)
+#define NETIF_F_NO_CSUM		__NETIF_F(NO_CSUM)
+#define NETIF_F_NTUPLE		__NETIF_F(NTUPLE)
+#define NETIF_F_RXCSUM		__NETIF_F(RXCSUM)
+#define NETIF_F_RXHASH		__NETIF_F(RXHASH)
+#define NETIF_F_SCTP_CSUM	__NETIF_F(SCTP_CSUM)
+#define NETIF_F_SG		__NETIF_F(SG)
+#define NETIF_F_TSO6		__NETIF_F(TSO6)
+#define NETIF_F_TSO_ECN		__NETIF_F(TSO_ECN)
+#define NETIF_F_TSO		__NETIF_F(TSO)
+#define NETIF_F_UFO		__NETIF_F(UFO)
+#define NETIF_F_VLAN_CHALLENGED	__NETIF_F(VLAN_CHALLENGED)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
 #define NETIF_F_NEVER_CHANGE	(NETIF_F_VLAN_CHALLENGED | \
 				 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
-#define NETIF_F_ETHTOOL_BITS	(0xff3fffff & ~NETIF_F_NEVER_CHANGE)
+
+/* remember that ((t)1 << t_BITS) is undefined in C99 */
+#define NETIF_F_ETHTOOL_BITS	((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \
+		(__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) - 1)) & \
+		~NETIF_F_NEVER_CHANGE)
+
+/* Segmentation offload feature mask */
+#define NETIF_F_GSO_MASK	(__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
+		__NETIF_F_BIT(NETIF_F_GSO_SHIFT))
 
 /* List of features with software fallbacks. */
 #define NETIF_F_GSO_SOFTWARE	(NETIF_F_TSO | NETIF_F_TSO_ECN | \
-- 
1.7.6.3

^ permalink raw reply related

* [PATCH v4 8/9] net: extend netdev_features_t to 64 bits
From: Michał Mirosław @ 2011-10-25  0:36 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Ben Hutchings
In-Reply-To: <cover.1319495301.git.mirq-linux@rere.qmqm.pl>

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 include/linux/netdev_features.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 04ac8f8..20e3a1f 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -12,7 +12,7 @@
 
 #include <linux/types.h>
 
-typedef u32 netdev_features_t;
+typedef u64 netdev_features_t;
 
 enum {
 	NETIF_F_SG_BIT,			/* Scatter/gather IO. */
-- 
1.7.6.3

^ permalink raw reply related

* [PATCH v4 9/9] net: remove NETIF_F_NO_CSUM feature bit
From: Michał Mirosław @ 2011-10-25  0:36 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Ben Hutchings
In-Reply-To: <cover.1319495301.git.mirq-linux@rere.qmqm.pl>

Only distinct use is checking if NETIF_F_NOCACHE_COPY should be
enabled by default. The check heuristics is altered a bit here,
so it hits other people than before. The default shouldn't be
trusted for performance-critical cases anyway.

For all other uses NETIF_F_NO_CSUM is equivalent to NETIF_F_HW_CSUM.

v4: rebased on end of the series
    avoid disabling NETIF_F_NOCACHE_COPY by default

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/ieee802154/fakehard.c   |    2 +-
 drivers/misc/sgi-xp/xpnet.c     |    2 +-
 drivers/net/bonding/bond_main.c |    2 +-
 drivers/net/can/dev.c           |    2 +-
 drivers/net/can/slcan.c         |    2 +-
 drivers/net/dummy.c             |    2 +-
 drivers/net/ifb.c               |    2 +-
 drivers/net/loopback.c          |    2 +-
 drivers/net/veth.c              |    2 +-
 include/linux/netdev_features.h |    5 ++---
 include/linux/skbuff.h          |    1 -
 net/bridge/br_device.c          |    4 ++--
 net/core/dev.c                  |   21 ++++++---------------
 net/core/ethtool.c              |    1 -
 net/ieee802154/6lowpan.c        |    2 +-
 15 files changed, 20 insertions(+), 32 deletions(-)

diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c
index eb0e2cc..73d4531 100644
--- a/drivers/ieee802154/fakehard.c
+++ b/drivers/ieee802154/fakehard.c
@@ -343,7 +343,7 @@ static void ieee802154_fake_setup(struct net_device *dev)
 {
 	dev->addr_len		= IEEE802154_ADDR_LEN;
 	memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
-	dev->features		= NETIF_F_NO_CSUM;
+	dev->features		= NETIF_F_HW_CSUM;
 	dev->needed_tailroom	= 2; /* FCS */
 	dev->mtu		= 127;
 	dev->tx_queue_len	= 10;
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 42f0673..3fac67a 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -576,7 +576,7 @@ xpnet_init(void)
 	 * report an error if the data is not retrievable and the
 	 * packet will be dropped.
 	 */
-	xpnet_device->features = NETIF_F_NO_CSUM;
+	xpnet_device->features = NETIF_F_HW_CSUM;
 
 	result = register_netdev(xpnet_device);
 	if (result != 0) {
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5fce8f0..627c10f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4360,7 +4360,7 @@ static void bond_setup(struct net_device *bond_dev)
 				NETIF_F_HW_VLAN_RX |
 				NETIF_F_HW_VLAN_FILTER;
 
-	bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM);
+	bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
 	bond_dev->features |= bond_dev->hw_features;
 }
 
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 25695bd..120f1ab 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -454,7 +454,7 @@ static void can_setup(struct net_device *dev)
 
 	/* New-style flags. */
 	dev->flags = IFF_NOARP;
-	dev->features = NETIF_F_NO_CSUM;
+	dev->features = NETIF_F_HW_CSUM;
 }
 
 struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index a979b00..3f1ebcc 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -387,7 +387,7 @@ static void slc_setup(struct net_device *dev)
 
 	/* New-style flags. */
 	dev->flags		= IFF_NOARP;
-	dev->features           = NETIF_F_NO_CSUM;
+	dev->features           = NETIF_F_HW_CSUM;
 }
 
 /******************************************
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index a7c5e88..087648e 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -134,7 +134,7 @@ static void dummy_setup(struct net_device *dev)
 	dev->flags |= IFF_NOARP;
 	dev->flags &= ~IFF_MULTICAST;
 	dev->features	|= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO;
-	dev->features	|= NETIF_F_NO_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
+	dev->features	|= NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX;
 	random_ether_addr(dev->dev_addr);
 }
 
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 46b5f5f..e05b645 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -164,7 +164,7 @@ static const struct net_device_ops ifb_netdev_ops = {
 	.ndo_validate_addr = eth_validate_addr,
 };
 
-#define IFB_FEATURES (NETIF_F_NO_CSUM | NETIF_F_SG  | NETIF_F_FRAGLIST	| \
+#define IFB_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG  | NETIF_F_FRAGLIST	| \
 		      NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6	| \
 		      NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX)
 
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 4ce9e5f..b71998d 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -169,7 +169,7 @@ static void loopback_setup(struct net_device *dev)
 	dev->features 		= NETIF_F_SG | NETIF_F_FRAGLIST
 		| NETIF_F_ALL_TSO
 		| NETIF_F_UFO
-		| NETIF_F_NO_CSUM
+		| NETIF_F_HW_CSUM
 		| NETIF_F_RXCSUM
 		| NETIF_F_HIGHDMA
 		| NETIF_F_LLTX
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 5b23767..66571d7 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -270,7 +270,7 @@ static void veth_setup(struct net_device *dev)
 	dev->features |= NETIF_F_LLTX;
 	dev->destructor = veth_dev_free;
 
-	dev->hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
+	dev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_RXCSUM;
 }
 
 /*
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 20e3a1f..77f5202 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -17,7 +17,7 @@ typedef u64 netdev_features_t;
 enum {
 	NETIF_F_SG_BIT,			/* Scatter/gather IO. */
 	NETIF_F_IP_CSUM_BIT,		/* Can checksum TCP/UDP over IPv4. */
-	NETIF_F_NO_CSUM_BIT,		/* Does not require checksum. F.e. loopack. */
+	__UNUSED_NETIF_F_1,
 	NETIF_F_HW_CSUM_BIT,		/* Can checksum all the packets. */
 	NETIF_F_IPV6_CSUM_BIT,		/* Can checksum TCP/UDP over IPV6 */
 	NETIF_F_HIGHDMA_BIT,		/* Can DMA to high memory. */
@@ -88,7 +88,6 @@ enum {
 #define NETIF_F_LRO		__NETIF_F(LRO)
 #define NETIF_F_NETNS_LOCAL	__NETIF_F(NETNS_LOCAL)
 #define NETIF_F_NOCACHE_COPY	__NETIF_F(NOCACHE_COPY)
-#define NETIF_F_NO_CSUM		__NETIF_F(NO_CSUM)
 #define NETIF_F_NTUPLE		__NETIF_F(NTUPLE)
 #define NETIF_F_RXCSUM		__NETIF_F(RXCSUM)
 #define NETIF_F_RXHASH		__NETIF_F(RXHASH)
@@ -118,7 +117,7 @@ enum {
 #define NETIF_F_GSO_SOFTWARE	(NETIF_F_TSO | NETIF_F_TSO_ECN | \
 				 NETIF_F_TSO6 | NETIF_F_UFO)
 
-#define NETIF_F_GEN_CSUM	(NETIF_F_HW_CSUM | NETIF_F_NO_CSUM)
+#define NETIF_F_GEN_CSUM	NETIF_F_HW_CSUM
 #define NETIF_F_V4_CSUM		(NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
 #define NETIF_F_V6_CSUM		(NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
 #define NETIF_F_ALL_CSUM	(NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ef4655d..ff3af4d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -88,7 +88,6 @@
  *	at device setup time.
  *	NETIF_F_HW_CSUM	- it is clever device, it is able to checksum
  *			  everything.
- *	NETIF_F_NO_CSUM - loopback or reliable single hop media.
  *	NETIF_F_IP_CSUM - device is dumb. It is able to csum only
  *			  TCP/UDP over IPv4. Sigh. Vendors like this
  *			  way by an unknown reason. Though, see comment above
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 772bad3..a3754ac 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -342,10 +342,10 @@ void br_dev_setup(struct net_device *dev)
 	dev->priv_flags = IFF_EBRIDGE;
 
 	dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
-			NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX |
+			NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | NETIF_F_LLTX |
 			NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_TX;
 	dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
-			   NETIF_F_GSO_MASK | NETIF_F_NO_CSUM |
+			   NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
 			   NETIF_F_HW_VLAN_TX;
 
 	br->dev = dev;
diff --git a/net/core/dev.c b/net/core/dev.c
index 25dc263..73c799c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5366,12 +5366,6 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
 		features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
 	}
 
-	if ((features & NETIF_F_NO_CSUM) &&
-	    (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
-		netdev_warn(dev, "mixed no checksumming and other settings.\n");
-		features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM);
-	}
-
 	/* Fix illegal SG+CSUM combinations. */
 	if ((features & NETIF_F_SG) &&
 	    !(features & NETIF_F_ALL_CSUM)) {
@@ -5628,11 +5622,12 @@ int register_netdevice(struct net_device *dev)
 	dev->wanted_features = dev->features & dev->hw_features;
 
 	/* Turn on no cache copy if HW is doing checksum */
-	dev->hw_features |= NETIF_F_NOCACHE_COPY;
-	if ((dev->features & NETIF_F_ALL_CSUM) &&
-	    !(dev->features & NETIF_F_NO_CSUM)) {
-		dev->wanted_features |= NETIF_F_NOCACHE_COPY;
-		dev->features |= NETIF_F_NOCACHE_COPY;
+	if (!(dev->flags & IFF_LOOPBACK)) {
+		dev->hw_features |= NETIF_F_NOCACHE_COPY;
+		if (dev->features & NETIF_F_ALL_CSUM) {
+			dev->wanted_features |= NETIF_F_NOCACHE_COPY;
+			dev->features |= NETIF_F_NOCACHE_COPY;
+		}
 	}
 
 	/* Make NETIF_F_HIGHDMA inheritable to VLAN devices.
@@ -6377,10 +6372,6 @@ netdev_features_t netdev_increment_features(netdev_features_t all,
 	all |= one & (NETIF_F_ONE_FOR_ALL|NETIF_F_ALL_CSUM) & mask;
 	all &= one | ~NETIF_F_ALL_FOR_ALL;
 
-	/* If device needs checksumming, downgrade to it. */
-	if (all & (NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM))
-		all &= ~NETIF_F_NO_CSUM;
-
 	/* If one device supports hw checksumming, set for all. */
 	if (all & NETIF_F_GEN_CSUM)
 		all &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index bbf84fe..d2eff9e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -43,7 +43,6 @@ EXPORT_SYMBOL(ethtool_op_get_link);
 static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
 	[NETIF_F_SG_BIT] =               "tx-scatter-gather",
 	[NETIF_F_IP_CSUM_BIT] =          "tx-checksum-ipv4",
-	[NETIF_F_NO_CSUM_BIT] =          "tx-checksum-unneeded",
 	[NETIF_F_HW_CSUM_BIT] =          "tx-checksum-ip-generic",
 	[NETIF_F_IPV6_CSUM_BIT] =        "tx-checksum-ipv6",
 	[NETIF_F_HIGHDMA_BIT] =          "highdma",
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 19d6aef..1fde233 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -730,7 +730,7 @@ static void lowpan_setup(struct net_device *dev)
 	dev->addr_len		= IEEE802154_ADDR_LEN;
 	memset(dev->broadcast, 0xff, IEEE802154_ADDR_LEN);
 	dev->type		= ARPHRD_IEEE802154;
-	dev->features		= NETIF_F_NO_CSUM;
+	dev->features		= NETIF_F_HW_CSUM;
 	/* Frame Control + Sequence Number + Address fields + Security Header */
 	dev->hard_header_len	= 2 + 1 + 20 + 14;
 	dev->needed_tailroom	= 2; /* FCS */
-- 
1.7.6.3

^ permalink raw reply related

* [PATCH v4 6/9] net: ethtool: use C99 array initialization for feature-names table
From: Michał Mirosław @ 2011-10-25  0:36 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Ben Hutchings
In-Reply-To: <cover.1319495301.git.mirq-linux@rere.qmqm.pl>

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 net/core/ethtool.c |   74 +++++++++++++++++++++++++--------------------------
 1 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index f135f1c..817ad4b 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -40,6 +40,42 @@ EXPORT_SYMBOL(ethtool_op_get_link);
 
 #define ETHTOOL_DEV_FEATURE_WORDS	1
 
+static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
+	[NETIF_F_SG_BIT] =               "tx-scatter-gather",
+	[NETIF_F_IP_CSUM_BIT] =          "tx-checksum-ipv4",
+	[NETIF_F_NO_CSUM_BIT] =          "tx-checksum-unneeded",
+	[NETIF_F_HW_CSUM_BIT] =          "tx-checksum-ip-generic",
+	[NETIF_F_IPV6_CSUM_BIT] =        "tx-checksum-ipv6",
+	[NETIF_F_HIGHDMA_BIT] =          "highdma",
+	[NETIF_F_FRAGLIST_BIT] =         "tx-scatter-gather-fraglist",
+	[NETIF_F_HW_VLAN_TX_BIT] =       "tx-vlan-hw-insert",
+
+	[NETIF_F_HW_VLAN_RX_BIT] =       "rx-vlan-hw-parse",
+	[NETIF_F_HW_VLAN_FILTER_BIT] =   "rx-vlan-filter",
+	[NETIF_F_VLAN_CHALLENGED_BIT] =  "vlan-challenged",
+	[NETIF_F_GSO_BIT] =              "tx-generic-segmentation",
+	[NETIF_F_LLTX_BIT] =             "tx-lockless",
+	[NETIF_F_NETNS_LOCAL_BIT] =      "netns-local",
+	[NETIF_F_GRO_BIT] =              "rx-gro",
+	[NETIF_F_LRO_BIT] =              "rx-lro",
+
+	[NETIF_F_TSO_BIT] =              "tx-tcp-segmentation",
+	[NETIF_F_UFO_BIT] =              "tx-udp-fragmentation",
+	[NETIF_F_GSO_ROBUST_BIT] =       "tx-gso-robust",
+	[NETIF_F_TSO_ECN_BIT] =          "tx-tcp-ecn-segmentation",
+	[NETIF_F_TSO6_BIT] =             "tx-tcp6-segmentation",
+	[NETIF_F_FSO_BIT] =              "tx-fcoe-segmentation",
+
+	[NETIF_F_FCOE_CRC_BIT] =         "tx-checksum-fcoe-crc",
+	[NETIF_F_SCTP_CSUM_BIT] =        "tx-checksum-sctp",
+	[NETIF_F_FCOE_MTU_BIT] =         "fcoe-mtu",
+	[NETIF_F_NTUPLE_BIT] =           "rx-ntuple-filter",
+	[NETIF_F_RXHASH_BIT] =           "rx-hashing",
+	[NETIF_F_RXCSUM_BIT] =           "rx-checksum",
+	[NETIF_F_NOCACHE_COPY_BIT] =     "tx-nocache-copy",
+	[NETIF_F_LOOPBACK_BIT] =         "loopback",
+};
+
 static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
 {
 	struct ethtool_gfeatures cmd = {
@@ -107,44 +143,6 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
 	return ret;
 }
 
-static const char netdev_features_strings[ETHTOOL_DEV_FEATURE_WORDS * 32][ETH_GSTRING_LEN] = {
-	/* NETIF_F_SG */              "tx-scatter-gather",
-	/* NETIF_F_IP_CSUM */         "tx-checksum-ipv4",
-	/* NETIF_F_NO_CSUM */         "tx-checksum-unneeded",
-	/* NETIF_F_HW_CSUM */         "tx-checksum-ip-generic",
-	/* NETIF_F_IPV6_CSUM */       "tx-checksum-ipv6",
-	/* NETIF_F_HIGHDMA */         "highdma",
-	/* NETIF_F_FRAGLIST */        "tx-scatter-gather-fraglist",
-	/* NETIF_F_HW_VLAN_TX */      "tx-vlan-hw-insert",
-
-	/* NETIF_F_HW_VLAN_RX */      "rx-vlan-hw-parse",
-	/* NETIF_F_HW_VLAN_FILTER */  "rx-vlan-filter",
-	/* NETIF_F_VLAN_CHALLENGED */ "vlan-challenged",
-	/* NETIF_F_GSO */             "tx-generic-segmentation",
-	/* NETIF_F_LLTX */            "tx-lockless",
-	/* NETIF_F_NETNS_LOCAL */     "netns-local",
-	/* NETIF_F_GRO */             "rx-gro",
-	/* NETIF_F_LRO */             "rx-lro",
-
-	/* NETIF_F_TSO */             "tx-tcp-segmentation",
-	/* NETIF_F_UFO */             "tx-udp-fragmentation",
-	/* NETIF_F_GSO_ROBUST */      "tx-gso-robust",
-	/* NETIF_F_TSO_ECN */         "tx-tcp-ecn-segmentation",
-	/* NETIF_F_TSO6 */            "tx-tcp6-segmentation",
-	/* NETIF_F_FSO */             "tx-fcoe-segmentation",
-	"",
-	"",
-
-	/* NETIF_F_FCOE_CRC */        "tx-checksum-fcoe-crc",
-	/* NETIF_F_SCTP_CSUM */       "tx-checksum-sctp",
-	/* NETIF_F_FCOE_MTU */        "fcoe-mtu",
-	/* NETIF_F_NTUPLE */          "rx-ntuple-filter",
-	/* NETIF_F_RXHASH */          "rx-hashing",
-	/* NETIF_F_RXCSUM */          "rx-checksum",
-	/* NETIF_F_NOCACHE_COPY */    "tx-nocache-copy",
-	/* NETIF_F_LOOPBACK */        "loopback",
-};
-
 static int __ethtool_get_sset_count(struct net_device *dev, int sset)
 {
 	const struct ethtool_ops *ops = dev->ethtool_ops;
-- 
1.7.6.3

^ permalink raw reply related

* [PATCH v4 7/9] ethtool: prepare for larger netdev_features_t type
From: Michał Mirosław @ 2011-10-25  0:36 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Ben Hutchings
In-Reply-To: <cover.1319495301.git.mirq-linux@rere.qmqm.pl>

v2:	changed loop in ethtool_set_features() per Ben's suggestion

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 net/core/ethtool.c |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 817ad4b..bbf84fe 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -38,7 +38,7 @@ EXPORT_SYMBOL(ethtool_op_get_link);
 
 /* Handlers for each ethtool command */
 
-#define ETHTOOL_DEV_FEATURE_WORDS	1
+#define ETHTOOL_DEV_FEATURE_WORDS	((NETDEV_FEATURE_COUNT + 31) / 32)
 
 static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {
 	[NETIF_F_SG_BIT] =               "tx-scatter-gather",
@@ -82,16 +82,20 @@ static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
 		.cmd = ETHTOOL_GFEATURES,
 		.size = ETHTOOL_DEV_FEATURE_WORDS,
 	};
-	struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS] = {
-		{
-			.available = dev->hw_features,
-			.requested = dev->wanted_features,
-			.active = dev->features,
-			.never_changed = NETIF_F_NEVER_CHANGE,
-		},
-	};
+	struct ethtool_get_features_block features[ETHTOOL_DEV_FEATURE_WORDS];
 	u32 __user *sizeaddr;
 	u32 copy_size;
+	int i;
+
+	/* in case feature bits run out again */
+	BUILD_BUG_ON(ETHTOOL_DEV_FEATURE_WORDS*sizeof(u32) > sizeof(netdev_features_t));
+
+	for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
+		features[i].available = (u32)(dev->hw_features >> (32*i));
+		features[i].requested = (u32)(dev->wanted_features >> (32*i));
+		features[i].active = (u32)(dev->features >> (32*i));
+		features[i].never_changed = (u32)(NETIF_F_NEVER_CHANGE >> (32*i));
+	}
 
 	sizeaddr = useraddr + offsetof(struct ethtool_gfeatures, size);
 	if (get_user(copy_size, sizeaddr))
@@ -113,7 +117,8 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
 {
 	struct ethtool_sfeatures cmd;
 	struct ethtool_set_features_block features[ETHTOOL_DEV_FEATURE_WORDS];
-	int ret = 0;
+	netdev_features_t wanted = 0, valid = 0;
+	int i, ret = 0;
 
 	if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
 		return -EFAULT;
@@ -125,19 +130,24 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
 	if (copy_from_user(features, useraddr, sizeof(features)))
 		return -EFAULT;
 
-	if (features[0].valid & ~NETIF_F_ETHTOOL_BITS)
+	for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
+		valid |= (netdev_features_t)features[i].valid << (32*i);
+		wanted |= (netdev_features_t)features[i].requested << (32*i);
+	}
+
+	if (valid & ~NETIF_F_ETHTOOL_BITS)
 		return -EINVAL;
 
-	if (features[0].valid & ~dev->hw_features) {
-		features[0].valid &= dev->hw_features;
+	if (valid & ~dev->hw_features) {
+		valid &= dev->hw_features;
 		ret |= ETHTOOL_F_UNSUPPORTED;
 	}
 
-	dev->wanted_features &= ~features[0].valid;
-	dev->wanted_features |= features[0].valid & features[0].requested;
+	dev->wanted_features &= ~valid;
+	dev->wanted_features |= wanted & valid;
 	__netdev_update_features(dev);
 
-	if ((dev->wanted_features ^ dev->features) & features[0].valid)
+	if ((dev->wanted_features ^ dev->features) & valid)
 		ret |= ETHTOOL_F_WISH;
 
 	return ret;
-- 
1.7.6.3

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox