* Re: [v3 PATCH 2/2] netpoll: remove IFF_IN_NETPOLL flag
From: Cong Wang @ 2010-12-08 8:52 UTC (permalink / raw)
To: Changli Gao
Cc: linux-kernel, Jiri Pirko, Neil Horman, netdev, David S. Miller,
Eric W. Biederman, Herbert Xu, bonding-devel, Jay Vosburgh,
Stephen Hemminger
In-Reply-To: <AANLkTikdweTkcsxTgf+phRaHYWMb9eAwrtr1xJr+0C1s@mail.gmail.com>
On 12/08/10 16:49, Changli Gao wrote:
> On Wed, Dec 8, 2010 at 4:36 PM, Cong Wang<amwang@redhat.com> wrote:
>>
>> A few lines above that code said:
>>
>> /* Private (from user) interface flags (netdevice->priv_flags). */
>>
>> unless this comment is wrong, we don't need to worry.
>>
>
> It seems these macros are exported to user space wrongly.
>
Maybe we should add #ifdef __KERNEL__ to protect them, I think.
^ permalink raw reply
* Re: [v3 PATCH 2/2] netpoll: remove IFF_IN_NETPOLL flag
From: Changli Gao @ 2010-12-08 8:49 UTC (permalink / raw)
To: Cong Wang
Cc: linux-kernel, Jiri Pirko, Neil Horman, netdev, David S. Miller,
Eric W. Biederman, Herbert Xu, bonding-devel, Jay Vosburgh,
Stephen Hemminger
In-Reply-To: <4CFF437D.1060904@redhat.com>
On Wed, Dec 8, 2010 at 4:36 PM, Cong Wang <amwang@redhat.com> wrote:
>
> A few lines above that code said:
>
> /* Private (from user) interface flags (netdevice->priv_flags). */
>
> unless this comment is wrong, we don't need to worry.
>
It seems these macros are exported to user space wrongly.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply
* Re: [PATCH 2/3] xfrm: Traffic Flow Confidentiality for IPv4 ESP
From: Herbert Xu @ 2010-12-08 8:49 UTC (permalink / raw)
To: Martin Willi; +Cc: linux-crypto, netdev
In-Reply-To: <1291717744-30111-3-git-send-email-martin@strongswan.org>
On Tue, Dec 07, 2010 at 11:29:03AM +0100, Martin Willi wrote:
> Add TFC padding to all packets smaller than the boundary configured
> on the xfrm state. If the boundary is larger than the PMTU, limit
> padding to the PMTU.
Thanks for the update Martin.
However, I still think it's more complicated than it needs be.
In particular, why would we need a boundary at all? Setting it to
anything other than the PMTU would seem to defeat the purpose of
TFC for packets between the boundary and the PMTU.
If we can get rid of tfc.pad, we can simplify the user-interface
change to just adding an xfrm_state flag.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [v3 PATCH 2/2] netpoll: remove IFF_IN_NETPOLL flag
From: Cong Wang @ 2010-12-08 8:36 UTC (permalink / raw)
To: Changli Gao
Cc: linux-kernel, Jiri Pirko, Neil Horman, netdev, David S. Miller,
Eric W. Biederman, Herbert Xu, bonding-devel, Jay Vosburgh,
Stephen Hemminger
In-Reply-To: <AANLkTindQMNKhC2aowUyjm=uO8gFKqOOPa9HXSU1q7Gh@mail.gmail.com>
On 12/08/10 16:16, Changli Gao wrote:
>
> You can't change the values of these macros or delete some of them,
> because they are exported to user space and are parts of ABI.
>
A few lines above that code said:
/* Private (from user) interface flags (netdevice->priv_flags). */
unless this comment is wrong, we don't need to worry.
^ permalink raw reply
* Re: [PATCH] tcp: avoid a possible divide by zero
From: Eric Dumazet @ 2010-12-08 8:33 UTC (permalink / raw)
To: Martin Steigerwald; +Cc: Ben Hutchings, David Miller, netdev
In-Reply-To: <201012080923.36086.Martin@lichtvoll.de>
Le mercredi 08 décembre 2010 à 09:23 +0100, Martin Steigerwald a écrit :
> Are there so many sysctls which are likely to freeze the kernel when fed
> with wrong value? Once could argue for sysctls where invalid values don't
> cause any serious harm, its not so important to fix it. I probably could
> have next weeks training members a go at poking creative values in other
> controls as well to see what happens.
>
We have many sysctls that can lead to non working machine.
Any kind of limits actually. Just set them to 0 (or maybe a negative
number :( )
0 socket, 0 file descriptor, 0 memory, 0 speed limit, 0 lengthes ...
> So this patch helps other cases as well? Or is it, as I think just a
> different approach, to fix the issue my training member brought up, by its
> cause instead of or additional to limiting its range?
>
> Want to check whether I basically understood the patch. Do you want me to
> test it?
It has nothing to do with the issue you raised, and is a completely
different subject. I got it while spending 5 minutes yesterday night
grep-ing some sysctls in network tree. 0 value is one of expected value
for this sysctl, but the test was not safe.
^ permalink raw reply
* [PATCH net-next-2.6] filter: use size of fetched data in __load_pointer()
From: Eric Dumazet @ 2010-12-08 8:26 UTC (permalink / raw)
To: David Miller; +Cc: netdev
__load_pointer() checks data we fetch from skb is included in head
portion, but assumes we fetch one byte, instead of up to four.
This wont crash because we have extra bytes (struct skb_shared_info)
after head, but this can read uninitialized bytes.
Fix this using size of the data (1, 2, 4 bytes) in the test.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/core/filter.c b/net/core/filter.c
index 25500f1..a57991e 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -88,7 +88,7 @@ enum {
};
/* No hurry in this branch */
-static void *__load_pointer(const struct sk_buff *skb, int k)
+static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size)
{
u8 *ptr = NULL;
@@ -97,7 +97,7 @@ static void *__load_pointer(const struct sk_buff *skb, int k)
else if (k >= SKF_LL_OFF)
ptr = skb_mac_header(skb) + k - SKF_LL_OFF;
- if (ptr >= skb->head && ptr < skb_tail_pointer(skb))
+ if (ptr >= skb->head && ptr + size <= skb_tail_pointer(skb))
return ptr;
return NULL;
}
@@ -110,7 +110,7 @@ static inline void *load_pointer(const struct sk_buff *skb, int k,
else {
if (k >= SKF_AD_OFF)
return NULL;
- return __load_pointer(skb, k);
+ return __load_pointer(skb, k, size);
}
}
^ permalink raw reply related
* Re: [PATCH] tcp: avoid a possible divide by zero
From: Martin Steigerwald @ 2010-12-08 8:23 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Ben Hutchings, David Miller, netdev
In-Reply-To: <1291759435.5324.25.camel@edumazet-laptop>
[-- Attachment #1: Type: Text/Plain, Size: 3084 bytes --]
Am Dienstag 07 Dezember 2010 schrieb Eric Dumazet:
> Le mardi 07 décembre 2010 à 21:32 +0000, Ben Hutchings a écrit :
> > On Tue, 2010-12-07 at 22:28 +0100, Eric Dumazet wrote:
> > [...]
> >
> > > Thanks
> > >
> > > Great, I feel we are going to fix all sysctls, one by one then :(
Are there so many sysctls which are likely to freeze the kernel when fed
with wrong value? Once could argue for sysctls where invalid values don't
cause any serious harm, its not so important to fix it. I probably could
have next weeks training members a go at poking creative values in other
controls as well to see what happens.
> > > lkml removed from Cc
> > >
> > >
> > > [PATCH] tcp: avoid a possible divide by zero
> > >
> > > sysctl_tcp_tso_win_divisor might be set to zero while one cpu runs
> > > in tcp_tso_should_defer(). Make sure we dont allow a divide by
> > > zero by reading sysctl_tcp_tso_win_divisor once.
> > >
> > > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> > > ---
[...]
> > > + win_divisor = sysctl_tcp_tso_win_divisor;
> >
> > You need to use ACCESS_ONCE(sysctl_tcp_tso_win_divisor). Otherwise
> > the compiler may eliminate the local variable and read the global
> > twice.
>
> Yes, I knew that, of course :)
>
> I wonder how many bugs like that we have in sysctls
>
> Thanks
>
> [PATCH v2] tcp: avoid a possible divide by zero
>
> sysctl_tcp_tso_win_divisor might be set to zero while one cpu runs in
> tcp_tso_should_defer(). Make sure we dont allow a divide by zero by
> reading sysctl_tcp_tso_win_divisor exactly once.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> v2: Use ACCESS_ONCE() as Ben suggested
>
> net/ipv4/tcp_output.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 05b1ecf..0464d70 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -1513,6 +1513,7 @@ static int tcp_tso_should_defer(struct sock *sk,
> struct sk_buff *skb) struct tcp_sock *tp = tcp_sk(sk);
> const struct inet_connection_sock *icsk = inet_csk(sk);
> u32 send_win, cong_win, limit, in_flight;
> + int win_divisor;
[...]
> - if (sysctl_tcp_tso_win_divisor) {
> + win_divisor = ACCESS_ONCE(sysctl_tcp_tso_win_divisor);
> + if (win_divisor) {
> u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache);
>
> /* If at least some fraction of a window is available,
> * just use it.
> */
> - chunk /= sysctl_tcp_tso_win_divisor;
> + chunk /= win_divisor;
> if (limit >= chunk)
> goto send_now;
> } else {
So this patch helps other cases as well? Or is it, as I think just a
different approach, to fix the issue my training member brought up, by its
cause instead of or additional to limiting its range?
Want to check whether I basically understood the patch. Do you want me to
test it?
Thanks,
--
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [v3 PATCH 2/2] netpoll: remove IFF_IN_NETPOLL flag
From: Changli Gao @ 2010-12-08 8:16 UTC (permalink / raw)
To: Amerigo Wang
Cc: linux-kernel, Jiri Pirko, Neil Horman, netdev, David S. Miller,
Eric W. Biederman, Herbert Xu, bonding-devel, Jay Vosburgh,
Stephen Hemminger
In-Reply-To: <20101208075218.5792.64791.sendpatchset@localhost.localdomain>
On Wed, Dec 8, 2010 at 3:52 PM, Amerigo Wang <amwang@redhat.com> wrote:
> From: Amerigo Wang <amwang@redhat.com>
> Date: Thu, 2 Dec 2010 21:34:44 +0800
> Subject: [v3 PATCH 2/2] netpoll: remove IFF_IN_NETPOLL flag
>
> This patch removes the flag IFF_IN_NETPOLL, we don't need it any more since
> we have netpoll_tx_running() now.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Neil Horman <nhorman@redhat.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Jay Vosburgh <fubar@us.ibm.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Stephen Hemminger <shemminger@vyatta.com>
> Cc: Jiri Pirko <jpirko@redhat.com>
> Cc: "Eric W. Biederman" <ebiederm@xmission.com>
>
> ---
>
> drivers/net/bonding/bond_main.c | 6 ++----
> drivers/net/bonding/bonding.h | 2 +-
> include/linux/if.h | 9 ++++-----
> net/core/netpoll.c | 2 --
> 4 files changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 7fafe06..21ac08b 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -448,11 +448,9 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
> }
>
> skb->priority = 1;
> - if (unlikely(netpoll_tx_running(slave_dev))) {
> - slave_dev->priv_flags |= IFF_IN_NETPOLL;
> + if (unlikely(netpoll_tx_running(slave_dev)))
> bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
> - slave_dev->priv_flags &= ~IFF_IN_NETPOLL;
> - } else
> + else
> dev_queue_xmit(skb);
>
> return 0;
> diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
> index c4f6a94..493e645 100644
> --- a/drivers/net/bonding/bonding.h
> +++ b/drivers/net/bonding/bonding.h
> @@ -138,7 +138,7 @@ static inline void unblock_netpoll_tx(void)
>
> static inline int is_netpoll_tx_blocked(struct net_device *dev)
> {
> - if (unlikely(dev->priv_flags & IFF_IN_NETPOLL))
> + if (unlikely(netpoll_tx_running(dev)))
> return cpumask_test_cpu(smp_processor_id(), netpoll_block_tx);
> return 0;
> }
> diff --git a/include/linux/if.h b/include/linux/if.h
> index 1239599..3bc63e6 100644
> --- a/include/linux/if.h
> +++ b/include/linux/if.h
> @@ -71,11 +71,10 @@
> * release skb->dst
> */
> #define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
> -#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */
> -#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
> -#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */
> -#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */
> -#define IFF_OVS_DATAPATH 0x10000 /* device used as Open vSwitch
> +#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */
> +#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */
> +#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
> +#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
> * datapath port */
>
You can't change the values of these macros or delete some of them,
because they are exported to user space and are parts of ABI.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply
* [v3 PATCH 2/2] netpoll: remove IFF_IN_NETPOLL flag
From: Amerigo Wang @ 2010-12-08 7:52 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Pirko, Neil Horman, netdev, David S. Miller,
Eric W. Biederman, Amerigo Wang, Herbert Xu, bonding-devel,
Jay Vosburgh, Stephen Hemminger
In-Reply-To: <20101208075208.5792.45247.sendpatchset@localhost.localdomain>
From: Amerigo Wang <amwang@redhat.com>
Date: Thu, 2 Dec 2010 21:34:44 +0800
Subject: [v3 PATCH 2/2] netpoll: remove IFF_IN_NETPOLL flag
This patch removes the flag IFF_IN_NETPOLL, we don't need it any more since
we have netpoll_tx_running() now.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Neil Horman <nhorman@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jiri Pirko <jpirko@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
---
drivers/net/bonding/bond_main.c | 6 ++----
drivers/net/bonding/bonding.h | 2 +-
include/linux/if.h | 9 ++++-----
net/core/netpoll.c | 2 --
4 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7fafe06..21ac08b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -448,11 +448,9 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
}
skb->priority = 1;
- if (unlikely(netpoll_tx_running(slave_dev))) {
- slave_dev->priv_flags |= IFF_IN_NETPOLL;
+ if (unlikely(netpoll_tx_running(slave_dev)))
bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
- slave_dev->priv_flags &= ~IFF_IN_NETPOLL;
- } else
+ else
dev_queue_xmit(skb);
return 0;
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index c4f6a94..493e645 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -138,7 +138,7 @@ static inline void unblock_netpoll_tx(void)
static inline int is_netpoll_tx_blocked(struct net_device *dev)
{
- if (unlikely(dev->priv_flags & IFF_IN_NETPOLL))
+ if (unlikely(netpoll_tx_running(dev)))
return cpumask_test_cpu(smp_processor_id(), netpoll_block_tx);
return 0;
}
diff --git a/include/linux/if.h b/include/linux/if.h
index 1239599..3bc63e6 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -71,11 +71,10 @@
* release skb->dst
*/
#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
-#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */
-#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
-#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */
-#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */
-#define IFF_OVS_DATAPATH 0x10000 /* device used as Open vSwitch
+#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */
+#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */
+#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
+#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
* datapath port */
#define IF_GET_IFACE 0x0001 /* for querying only */
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index ee38acb..8a5c1c9 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -314,9 +314,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
tries > 0; --tries) {
if (__netif_tx_trylock(txq)) {
if (!netif_tx_queue_stopped(txq)) {
- dev->priv_flags |= IFF_IN_NETPOLL;
status = ops->ndo_start_xmit(skb, dev);
- dev->priv_flags &= ~IFF_IN_NETPOLL;
if (status == NETDEV_TX_OK)
txq_trans_update(txq);
}
--
1.7.1
^ permalink raw reply related
* [v3 PATCH 1/2] bonding: sync netpoll code with bridge
From: Amerigo Wang @ 2010-12-08 7:52 UTC (permalink / raw)
To: linux-kernel
Cc: Jiri Pirko, Neil Horman, netdev, David S. Miller,
Eric W. Biederman, Amerigo Wang, Herbert Xu, bonding-devel,
Jay Vosburgh, Stephen Hemminger
From: Amerigo Wang <amwang@redhat.com>
Date: Thu, 2 Dec 2010 21:31:19 +0800
Subject: [v3 PATCH 1/2] bonding: sync netpoll code with bridge
V3: remove an useless #ifdef.
This patch unifies the netpoll code in bonding with netpoll code in bridge,
thanks to Herbert that code is much cleaner now.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Neil Horman <nhorman@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jiri Pirko <jpirko@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
---
drivers/net/bonding/bond_main.c | 155 ++++++++++++++++++++++++--------------
drivers/net/bonding/bonding.h | 20 +++++
2 files changed, 118 insertions(+), 57 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 0273ad0..7fafe06 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -59,7 +59,6 @@
#include <linux/uaccess.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
-#include <linux/netpoll.h>
#include <linux/inetdevice.h>
#include <linux/igmp.h>
#include <linux/etherdevice.h>
@@ -449,15 +448,11 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
}
skb->priority = 1;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- if (unlikely(bond->dev->priv_flags & IFF_IN_NETPOLL)) {
- struct netpoll *np = bond->dev->npinfo->netpoll;
- slave_dev->npinfo = bond->dev->npinfo;
+ if (unlikely(netpoll_tx_running(slave_dev))) {
slave_dev->priv_flags |= IFF_IN_NETPOLL;
- netpoll_send_skb_on_dev(np, skb, slave_dev);
+ bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
slave_dev->priv_flags &= ~IFF_IN_NETPOLL;
} else
-#endif
dev_queue_xmit(skb);
return 0;
@@ -1310,63 +1305,113 @@ static void bond_detach_slave(struct bonding *bond, struct slave *slave)
}
#ifdef CONFIG_NET_POLL_CONTROLLER
-/*
- * You must hold read lock on bond->lock before calling this.
- */
-static bool slaves_support_netpoll(struct net_device *bond_dev)
+static inline int slave_enable_netpoll(struct slave *slave)
{
- struct bonding *bond = netdev_priv(bond_dev);
- struct slave *slave;
- int i = 0;
- bool ret = true;
+ struct netpoll *np;
+ int err = 0;
- bond_for_each_slave(bond, slave, i) {
- if ((slave->dev->priv_flags & IFF_DISABLE_NETPOLL) ||
- !slave->dev->netdev_ops->ndo_poll_controller)
- ret = false;
+ np = kmalloc(sizeof(*np), GFP_KERNEL);
+ err = -ENOMEM;
+ if (!np)
+ goto out;
+
+ np->dev = slave->dev;
+ err = __netpoll_setup(np);
+ if (err) {
+ kfree(np);
+ goto out;
}
- return i != 0 && ret;
+ slave->np = np;
+out:
+ return err;
+}
+static inline void slave_disable_netpoll(struct slave *slave)
+{
+ struct netpoll *np = slave->np;
+
+ if (!np)
+ return;
+
+ slave->np = NULL;
+ synchronize_rcu_bh();
+ __netpoll_cleanup(np);
+ kfree(np);
+}
+static inline bool slave_dev_support_netpoll(struct net_device *slave_dev)
+{
+ if (slave_dev->priv_flags & IFF_DISABLE_NETPOLL)
+ return false;
+ if (!slave_dev->netdev_ops->ndo_poll_controller)
+ return false;
+ return true;
}
static void bond_poll_controller(struct net_device *bond_dev)
{
- struct bonding *bond = netdev_priv(bond_dev);
+}
+
+static void __bond_netpoll_cleanup(struct bonding *bond)
+{
struct slave *slave;
int i;
- bond_for_each_slave(bond, slave, i) {
- if (slave->dev && IS_UP(slave->dev))
- netpoll_poll_dev(slave->dev);
- }
+ bond_for_each_slave(bond, slave, i)
+ if (slave->dev)
+ slave_disable_netpoll(slave);
}
-
static void bond_netpoll_cleanup(struct net_device *bond_dev)
{
struct bonding *bond = netdev_priv(bond_dev);
+
+ read_lock(&bond->lock);
+ __bond_netpoll_cleanup(bond);
+ read_unlock(&bond->lock);
+}
+
+static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni)
+{
+ struct bonding *bond = netdev_priv(dev);
struct slave *slave;
- const struct net_device_ops *ops;
- int i;
+ int i, err = 0;
read_lock(&bond->lock);
- bond_dev->npinfo = NULL;
bond_for_each_slave(bond, slave, i) {
- if (slave->dev) {
- ops = slave->dev->netdev_ops;
- if (ops->ndo_netpoll_cleanup)
- ops->ndo_netpoll_cleanup(slave->dev);
- else
- slave->dev->npinfo = NULL;
+ if (!slave->dev)
+ continue;
+ err = slave_enable_netpoll(slave);
+ if (err) {
+ __bond_netpoll_cleanup(bond);
+ break;
}
}
read_unlock(&bond->lock);
+ return err;
}
-#else
+static struct netpoll_info *bond_netpoll_info(struct bonding *bond)
+{
+ return bond->dev->npinfo;
+}
+#else
+static inline int slave_enable_netpoll(struct slave *slave)
+{
+ return 0;
+}
+static inline void slave_disable_netpoll(struct slave *slave)
+{
+}
static void bond_netpoll_cleanup(struct net_device *bond_dev)
{
}
-
+static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni)
+{
+ return 0;
+}
+static struct netpoll_info *bond_netpoll_info(struct bonding *bond)
+{
+ return NULL;
+}
#endif
/*---------------------------------- IOCTL ----------------------------------*/
@@ -1804,17 +1849,19 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
bond_set_carrier(bond);
#ifdef CONFIG_NET_POLL_CONTROLLER
- if (slaves_support_netpoll(bond_dev)) {
- bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
- if (bond_dev->npinfo)
- slave_dev->npinfo = bond_dev->npinfo;
- } else if (!(bond_dev->priv_flags & IFF_DISABLE_NETPOLL)) {
- bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
- pr_info("New slave device %s does not support netpoll\n",
- slave_dev->name);
- pr_info("Disabling netpoll support for %s\n", bond_dev->name);
+ slave_dev->npinfo = bond_netpoll_info(bond);
+ if (slave_dev->npinfo) {
+ if (slave_enable_netpoll(new_slave)) {
+ read_unlock(&bond->lock);
+ pr_info("Error, %s: master_dev is using netpoll, "
+ "but new slave device does not support netpoll.\n",
+ bond_dev->name);
+ res = -EBUSY;
+ goto err_close;
+ }
}
#endif
+
read_unlock(&bond->lock);
res = bond_create_slave_symlinks(bond_dev, slave_dev);
@@ -2016,17 +2063,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
netdev_set_master(slave_dev, NULL);
-#ifdef CONFIG_NET_POLL_CONTROLLER
- read_lock_bh(&bond->lock);
-
- if (slaves_support_netpoll(bond_dev))
- bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
- read_unlock_bh(&bond->lock);
- if (slave_dev->netdev_ops->ndo_netpoll_cleanup)
- slave_dev->netdev_ops->ndo_netpoll_cleanup(slave_dev);
- else
- slave_dev->npinfo = NULL;
-#endif
+ slave_disable_netpoll(slave);
/* close slave before restoring its mac address */
dev_close(slave_dev);
@@ -2061,6 +2098,7 @@ static int bond_release_and_destroy(struct net_device *bond_dev,
ret = bond_release(bond_dev, slave_dev);
if ((ret == 0) && (bond->slave_cnt == 0)) {
+ bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
pr_info("%s: destroying bond %s.\n",
bond_dev->name, bond_dev->name);
unregister_netdevice(bond_dev);
@@ -2138,6 +2176,8 @@ static int bond_release_all(struct net_device *bond_dev)
netdev_set_master(slave_dev, NULL);
+ slave_disable_netpoll(slave);
+
/* close slave before restoring its mac address */
dev_close(slave_dev);
@@ -4670,6 +4710,7 @@ static const struct net_device_ops bond_netdev_ops = {
.ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,
#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_netpoll_setup = bond_netpoll_setup,
.ndo_netpoll_cleanup = bond_netpoll_cleanup,
.ndo_poll_controller = bond_poll_controller,
#endif
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index ad3ae46..c4f6a94 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -21,6 +21,7 @@
#include <linux/kobject.h>
#include <linux/cpumask.h>
#include <linux/in6.h>
+#include <linux/netpoll.h>
#include "bond_3ad.h"
#include "bond_alb.h"
@@ -203,6 +204,9 @@ struct slave {
u16 queue_id;
struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */
struct tlb_slave_info tlb_info;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ struct netpoll *np;
+#endif
};
/*
@@ -324,6 +328,22 @@ static inline unsigned long slave_last_rx(struct bonding *bond,
return slave->dev->last_rx;
}
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static inline void bond_netpoll_send_skb(const struct slave *slave,
+ struct sk_buff *skb)
+{
+ struct netpoll *np = slave->np;
+
+ if (np)
+ netpoll_send_skb(np, skb);
+}
+#else
+static inline void bond_netpoll_send_skb(const struct slave *slave,
+ struct sk_buff *skb)
+{
+}
+#endif
+
static inline void bond_set_slave_inactive_flags(struct slave *slave)
{
struct bonding *bond = netdev_priv(slave->dev->master);
--
1.7.1
^ permalink raw reply related
* Re: [PATCH 44/44] [XFRM] IPV6: Support Mobile IPv6 extension headers sorting.
From: wisalsami @ 2010-12-08 7:31 UTC (permalink / raw)
To: netdev
In-Reply-To: <20060825.031651.88475974.davem@davemloft.net>
Hi,
I m started working on vertical handover, and also got the patch
(NIST_Mobility) working on ns-2.29 (but it doesn't matter its not 2.29). But
i m new to this subject, so i need some help, that how should i implement
MIPL on ns-2. or have you worked on NIST_Mobility patch on ns, that whether
nist_mobility patch support mipl and mipv6 or not.
because i found a header file name as "mip6.h"
could you help me in this topic, if not, then if you direct me to someone.
reards
Wisal Sami
wisalsami@yahoo.co.uk
--
View this message in context: http://old.nabble.com/-PATCH-0-44--Mobile-IPv6-Platform%2C-Take-2-%28for-net-2.6.19%29-tp5946388p30403215.html
Sent from the netdev mailing list archive at Nabble.com.
^ permalink raw reply
* Re: IPsecv6 tunnel mode fragmentation
From: Herbert Xu @ 2010-12-08 7:11 UTC (permalink / raw)
To: latten; +Cc: netdev, samudrala, rashmin
In-Reply-To: <1291587520.11224.38.camel@faith.austin.ibm.com>
Joy Latten <latten@austin.ibm.com> wrote:
>
> We have come across an ipsec problem that I think was
> noted a while back in the following link.
> http://www.mail-archive.com/netdev@vger.kernel.org/msg61659.html
Looks like a configuration issue to me. One end is using the
same IP address (*::1234) both within and outside the tunnel.
Thus when the ICMP error message is sent it ends up outside the
tunnel causing it to be discarded by the other side.
So if you're using tunnel mode you really should use distinct
IP addresses.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [34/44] Limit sysctl_tcp_mem and sysctl_udp_mem initializers to prevent integer overflows.
From: Eric Dumazet @ 2010-12-08 5:50 UTC (permalink / raw)
To: Greg KH
Cc: Linus Torvalds, linux-kernel, stable, David S. Miller,
stable-review, akpm, alan, Robin Holt, Willy Tarreau, netdev,
linux-sctp, Alexey Kuznetsov, Pekka Savola (ipv6), James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, Vlad Yasevich,
Sridhar Samudrala
In-Reply-To: <20101208041656.GA2291@suse.de>
Le mardi 07 décembre 2010 à 20:16 -0800, Greg KH a écrit :
> On Tue, Dec 07, 2010 at 05:22:34PM -0800, Linus Torvalds wrote:
> > On Tue, Dec 7, 2010 at 4:04 PM, Greg KH <gregkh@suse.de> wrote:
> > >
> > > From: Robin Holt <holt@sgi.com>
> > >
> > > [ Problem was fixed differently upstream. -DaveM ]
> >
> > Gaah. I'd really like to see more of a description for things like
> > this. A commit ID for the alternate fix, or at least a few words about
> > the different fix or reason why upstream doesn't need the stable
> > commit.
>
> I'll let David confirm this, he's the one who sent it to me :)
upstream uses commit 8d987e5c7510 (net: avoid limits overflow)
This commit is a bit more untrusive for stable kernels :
It depends on :
a9febbb4bd13 (sysctl: min/max bounds are optional)
27b3d80a7b6a (sysctl: fix min/max handling in __do_proc_doulongvec_minmax())
^ permalink raw reply
* [PATCH 2/2] via-velocity: fix the WOL bug on 1000M full duplex forced mode
From: David Lv @ 2010-12-08 5:47 UTC (permalink / raw)
To: netdev, romieu, DavidLv, ShirleyHu, AndersMa
The VIA velocity card can't be waken up by WOL tool on 1000M full
duplex forced mode.
This patch fixes the bug.
Thanks!
Signed-off-by: David Lv <DavidLv@viatech.com.cn>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/via-velocity.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 95accb9..052b344 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -3001,16 +3001,18 @@ static int velocity_set_wol(struct velocity_info *vptr)
MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR, vptr->mac_regs);
- } else {
- if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
- if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
- MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG, vptr->mac_regs);
+ } else if (SPD_DPX_1000_FULL != vptr->options.spd_dpx) {
+ if (SPD_DPX_AUTO == vptr->options.spd_dpx) {
+ if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
+ if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
+ MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG, vptr->mac_regs);
- MII_REG_BITS_OFF(ADVERTISE_1000FULL | ADVERTISE_1000HALF,
MII_CTRL1000, vptr->mac_regs);
- }
+ MII_REG_BITS_OFF(ADVERTISE_1000FULL | ADVERTISE_1000HALF,
MII_CTRL1000, vptr->mac_regs);
+ }
- if (vptr->mii_status & VELOCITY_SPEED_1000)
- MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR, vptr->mac_regs);
+ if (vptr->mii_status & VELOCITY_SPEED_1000)
+ MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR, vptr->mac_regs);
+ }
BYTE_REG_BITS_ON(CHIPGCR_FCMODE, ®s->CHIPGCR);
--
1.7.3.2
^ permalink raw reply related
* Re: biosdevname v0.3.2
From: Matt Domsch @ 2010-12-08 5:19 UTC (permalink / raw)
To: Ben Hutchings
Cc: linux-hotplug, netdev, K, Narendra, Hargrave, Jordan,
Rose, Charles, Colin Watson
In-Reply-To: <1291747282.21627.9.camel@bwh-desktop>
On Tue, Dec 07, 2010 at 06:41:22PM +0000, Ben Hutchings wrote:
> On Tue, 2010-12-07 at 12:19 -0600, Matt Domsch wrote:
> > On Tue, Dec 07, 2010 at 06:16:22PM +0000, Ben Hutchings wrote:
> > > It appears that 'unknown slot' is treated as a specific slot and all
> > > devices with an unknown slot are given unique indices. Perhaps this
> > > doesn't matter in the end, since no name is generated when the slot is
> > > unknown.
> >
> > Yes on all counts.
> >
> > > However, the 2 NIC ports do have their own indices (specified with the
> > > dev_id attribute) and it should be possible to distinguish slots by
> > > PCI/PCIe topology even though the name given won't correspond to any
> > > markings on the motherboard.
> >
> > Tell me more about the dev_id attribute. I'm happy to use it, but I
> > don't understand the rules around populating it.
>
> As I understand it, dev_id is supposed to distinguish net devices
> corresponding to multiple ports on a single network controller.
> However, a value of 0 could mean either 'unspecified' or 'first port' so
> you would have to verify that multiple net devices for the same slot
> have unique dev_id values before taking them into account.
Only a handful of drivers seem to populate dev_id that I can find:
[drivers/net]$ grep -r -- '->dev_id' *
cxgb4/t4_hw.c: adap->port[i]->dev_id = j;
mlx4/en_netdev.c: dev->dev_id = port - 1;
sfc/siena.c: efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1;
My test system has none of these, so dev_id does have the expected
value of 0 for all ports, same card or whatever, but in all of these
drivers appear to use 0 to mean first port too.
So, I'm not sure how useful this field is in practice today. Right
idea though...
Thanks,
Matt
--
Matt Domsch
Technology Strategist
Dell | Office of the CTO
^ permalink raw reply
* Re: Fwd: usbnet: Recursive Locking bug ?
From: David Brownell @ 2010-12-08 4:55 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
Neil Jones
In-Reply-To: <AANLkTi=VB0Kt=2c1C1b-Ps8x_zA5Tnf+tfHjvO8gWgm8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
I'll look at this some later, though I seem to
have missed a post with the diagnostic saying
what lock is being recursed.
That particular chunk of code has periodically
turned up problems, and isn't very pretty. But
the most curious aspect of it is that it seemed
to shake out HCD-specific behaviors. (We've
gotten rid of most such code by now, this is a
slight exception.
Specifically, HCDs that could unlink speedily
without certain locking patterns (ISTR OHCI and
EHCI, if not also UHCI) didn't trigger oddness.
But some other HCDs, with different approaches
to unlinking URBs, were less happy. ( I was
likely working with MUSB at the time.)
I spent some time trying to rework that code in
"usbnet", but no clean-and-obvious solutions
became apparent when I did that (a few years
back). Plus, ISTR being the only person to
find issues (back then), so I couldn't make
an argument to spend much more time on it.
Hope that helps anyone trying to fix this.
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [RFC][net-next-2.6 PATCH 2/2] Update enic drv to support IFLA_PORT_PROTO_* attributes
From: Christian Benvenuti @ 2010-12-08 4:32 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20101208042925.16856.89232.stgit@savbu-pc100.cisco.com>
From: Christian Benvenuti <benve@cisco.com>
NOTE: Since there are other enic patches currently waiting for
approval on netdev, I will update and re-send this patch
should any of the other patches get accepted in the meantime.
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
---
drivers/net/enic/enic.h | 2 +
drivers/net/enic/enic_main.c | 73 +++++++++++++++++++++++++++++++++++-------
2 files changed, 62 insertions(+), 13 deletions(-)
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 7067254..a930fb9 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -32,7 +32,7 @@
#define DRV_NAME "enic"
#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
-#define DRV_VERSION "1.4.1.7"
+#define DRV_VERSION "1.4.1.7nl"
#define DRV_COPYRIGHT "Copyright 2008-2010 Cisco Systems, Inc"
#define ENIC_BARS_MAX 6
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9f293fa..c15c302 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1223,24 +1223,14 @@ static int enic_set_port_profile(struct enic *enic, u8 *mac)
return 0;
}
-static int enic_set_vf_port(struct net_device *netdev, int vf,
+static void enic_set_vf_port_parse_global_attr(struct enic *enic,
struct nlattr *port[])
{
- struct enic *enic = netdev_priv(netdev);
-
- memset(&enic->pp, 0, sizeof(enic->pp));
-
if (port[IFLA_PORT_REQUEST]) {
enic->pp.set |= ENIC_SET_REQUEST;
enic->pp.request = nla_get_u8(port[IFLA_PORT_REQUEST]);
}
- if (port[IFLA_PORT_PROFILE]) {
- enic->pp.set |= ENIC_SET_NAME;
- memcpy(enic->pp.name, nla_data(port[IFLA_PORT_PROFILE]),
- PORT_PROFILE_MAX);
- }
-
if (port[IFLA_PORT_INSTANCE_UUID]) {
enic->pp.set |= ENIC_SET_INSTANCE;
memcpy(enic->pp.instance_uuid,
@@ -1252,6 +1242,57 @@ static int enic_set_vf_port(struct net_device *netdev, int vf,
memcpy(enic->pp.host_uuid,
nla_data(port[IFLA_PORT_HOST_UUID]), PORT_UUID_MAX);
}
+}
+
+static void enic_set_vf_port_parse_legacy_attr(struct enic *enic,
+ struct nlattr *port[])
+{
+ if (port[IFLA_PORT_PROFILE]) {
+ enic->pp.set |= ENIC_SET_NAME;
+ memcpy(enic->pp.name, nla_data(port[IFLA_PORT_PROFILE]),
+ PORT_PROFILE_MAX);
+ }
+}
+
+static int enic_set_vf_port_parse_proto_attr(struct enic *enic,
+ struct nlattr *port[])
+{
+ struct nlattr *tb_8021qbh[IFLA_PORT_8021QBH_MAX+1];
+ int err = 0;
+
+ if (!port[IFLA_PORT_PROTO_8021QBH])
+ return -1;
+
+ err = rtnl_link_parse_port_proto(PORT_PROTO_8021QBH,
+ port[IFLA_PORT_PROTO_8021QBH],
+ tb_8021qbh);
+ if (err < 0)
+ goto errout;
+
+ if (tb_8021qbh[IFLA_PORT_8021QBH_PROFILE]) {
+ enic->pp.set |= ENIC_SET_NAME;
+ memcpy(enic->pp.name,
+ nla_data(tb_8021qbh[IFLA_PORT_8021QBH_PROFILE]),
+ PORT_PROFILE_MAX);
+ }
+
+errout:
+ return err;
+}
+
+static int enic_set_vf_port(struct net_device *netdev, int vf,
+ struct nlattr *port[])
+{
+ struct enic *enic = netdev_priv(netdev);
+ int err = 0;
+
+ memset(&enic->pp, 0, sizeof(enic->pp));
+
+ enic_set_vf_port_parse_global_attr(enic, port);
+
+ err = enic_set_vf_port_parse_proto_attr(enic, port);
+ if (err < 0)
+ enic_set_vf_port_parse_legacy_attr(enic, port);
/* don't support VFs, yet */
if (vf != PORT_SELF_VF)
@@ -1280,6 +1321,7 @@ static int enic_get_vf_port(struct net_device *netdev, int vf,
struct enic *enic = netdev_priv(netdev);
int err, error, done;
u16 response = PORT_PROFILE_RESPONSE_SUCCESS;
+ struct nlattr *proto;
if (!(enic->pp.set & ENIC_SET_APPLIED))
return -ENODATA;
@@ -1309,7 +1351,7 @@ static int enic_get_vf_port(struct net_device *netdev, int vf,
NLA_PUT_U16(skb, IFLA_PORT_REQUEST, enic->pp.request);
NLA_PUT_U16(skb, IFLA_PORT_RESPONSE, response);
- if (enic->pp.set & ENIC_SET_NAME)
+ if (enic->pp.set & ENIC_SET_NAME) /* Deprecated */
NLA_PUT(skb, IFLA_PORT_PROFILE, PORT_PROFILE_MAX,
enic->pp.name);
if (enic->pp.set & ENIC_SET_INSTANCE)
@@ -1319,6 +1361,13 @@ static int enic_get_vf_port(struct net_device *netdev, int vf,
NLA_PUT(skb, IFLA_PORT_HOST_UUID, PORT_UUID_MAX,
enic->pp.host_uuid);
+ proto = nla_nest_start(skb, IFLA_PORT_PROTO_8021QBH);
+ if (proto == NULL)
+ goto nla_put_failure;
+ NLA_PUT(skb, IFLA_PORT_8021QBH_PROFILE, PORT_PROFILE_MAX,
+ enic->pp.name);
+ nla_nest_end(skb, proto);
+
return 0;
nla_put_failure:
^ permalink raw reply related
* [RFC][net-next-2.6 PATCH 1/2] Add new protocol nested IFLA_PORT_PROTO_* attr
From: Christian Benvenuti @ 2010-12-08 4:31 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20101208042925.16856.89232.stgit@savbu-pc100.cisco.com>
From: Christian Benvenuti <benve@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
---
include/linux/if_link.h | 31 +++++++++++++++++++++++++++++--
include/net/rtnetlink.h | 3 +++
net/core/rtnetlink.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 76 insertions(+), 3 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 6485d2a..6f331aa 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -332,12 +332,14 @@ enum {
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF, /* __u32 */
- IFLA_PORT_PROFILE, /* string */
- IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */
+ IFLA_PORT_PROFILE, /* (deprecated) */
+ IFLA_PORT_VSI_TYPE, /* (deprecated) */
IFLA_PORT_INSTANCE_UUID, /* binary UUID */
IFLA_PORT_HOST_UUID, /* binary UUID */
IFLA_PORT_REQUEST, /* __u8 */
IFLA_PORT_RESPONSE, /* __u16, output only */
+ IFLA_PORT_PROTO_8021QBH,
+ IFLA_PORT_PROTO_8021QBG,
__IFLA_PORT_MAX,
};
@@ -378,4 +380,29 @@ struct ifla_port_vsi {
__u8 pad[3];
};
+enum port_proto {
+ PORT_PROTO_UNSPEC,
+ PORT_PROTO_8021QBH,
+ PORT_PROTO_8021QBG,
+ __PORT_PROTO_MAX,
+};
+
+#define PORT_PROTO_MAX (__PORT_PROTO_MAX - 1)
+
+enum {
+ IFLA_PORT_8021QBG_UNSPEC,
+ IFLA_PORT_8021QBG_VSI_TYPE, /* (pre-)standard VDP */
+ __IFLA_PORT_8021QBG_MAX,
+};
+
+#define IFLA_PORT_8021QBG_MAX (__IFLA_PORT_8021QBG_MAX - 1)
+
+enum {
+ IFLA_PORT_8021QBH_UNSPEC,
+ IFLA_PORT_8021QBH_PROFILE,
+ __IFLA_PORT_8021QBH_MAX,
+};
+
+#define IFLA_PORT_8021QBH_MAX (__IFLA_PORT_8021QBH_MAX - 1)
+
#endif /* _LINUX_IF_LINK_H */
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 4093ca7..bea154c 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -118,6 +118,9 @@ extern int rtnl_af_register(struct rtnl_af_ops *ops);
extern void rtnl_af_unregister(struct rtnl_af_ops *ops);
+extern int rtnl_link_parse_port_proto(enum port_proto proto,
+ struct nlattr *proto_attr,
+ struct nlattr *tb[]);
extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 750db57..7390b60 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -723,7 +723,15 @@ static size_t rtnl_port_size(const struct net_device *dev)
+ nla_total_size(PORT_UUID_MAX) /* PORT_INSTANCE_UUID */
+ nla_total_size(PORT_UUID_MAX) /* PORT_HOST_UUID */
+ nla_total_size(1) /* PROT_VDP_REQUEST */
- + nla_total_size(2); /* PORT_VDP_RESPONSE */
+ + nla_total_size(2) /* PORT_VDP_RESPONSE */
+
+ + nla_total_size(0) /* PROTO_8021QBH */
+ + nla_total_size(PORT_PROFILE_MAX) /* 8021QBH_PROFILE */
+
+ + nla_total_size(0) /* PROTO_8021QBG */
+ + nla_total_size(sizeof(struct ifla_port_vsi));
+ /* 8021QBG_VSI */
+
size_t vf_ports_size = nla_total_size(sizeof(struct nlattr));
size_t vf_port_size = nla_total_size(sizeof(struct nlattr))
+ port_size;
@@ -1067,6 +1075,18 @@ static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
.len = sizeof(struct ifla_vf_tx_rate) },
};
+static
+const struct nla_policy ifla_port_8021qbh_policy[IFLA_PORT_8021QBH_MAX+1] = {
+ [IFLA_PORT_8021QBH_PROFILE] = { .type = NLA_STRING,
+ .len = PORT_PROFILE_MAX },
+};
+
+static
+const struct nla_policy ifla_port_8021qbg_policy[IFLA_PORT_8021QBG_MAX+1] = {
+ [IFLA_PORT_8021QBG_VSI_TYPE] = { .type = NLA_BINARY,
+ .len = sizeof(struct ifla_port_vsi)},
+};
+
static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = {
[IFLA_PORT_VF] = { .type = NLA_U32 },
[IFLA_PORT_PROFILE] = { .type = NLA_STRING,
@@ -1079,8 +1099,31 @@ static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = {
.len = PORT_UUID_MAX },
[IFLA_PORT_REQUEST] = { .type = NLA_U8, },
[IFLA_PORT_RESPONSE] = { .type = NLA_U16, },
+ [IFLA_PORT_PROTO_8021QBH] = { .type = NLA_NESTED },
+ [IFLA_PORT_PROTO_8021QBG] = { .type = NLA_NESTED },
};
+int rtnl_link_parse_port_proto(enum port_proto proto, struct nlattr *proto_attr,
+ struct nlattr *tb[])
+{
+ if ((proto > PORT_PROTO_MAX) || (proto_attr == NULL) || (tb == NULL))
+ return -EINVAL;
+
+ switch (proto) {
+ case PORT_PROTO_UNSPEC:
+ return -EINVAL;
+ case PORT_PROTO_8021QBH:
+ return nla_parse_nested(tb, IFLA_PORT_8021QBH_MAX,
+ proto_attr, ifla_port_8021qbh_policy);
+ case PORT_PROTO_8021QBG:
+ return nla_parse_nested(tb, IFLA_PORT_8021QBG_MAX,
+ proto_attr, ifla_port_8021qbg_policy);
+ default:
+ return -ENOTSUPP;
+ }
+}
+EXPORT_SYMBOL(rtnl_link_parse_port_proto);
+
struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[])
{
struct net *net;
^ permalink raw reply related
* [RFC][net-next-2.6 PATCH 0/2] rtnetlink: New IFLA_PORT_PROTO_* attr
From: Christian Benvenuti @ 2010-12-08 4:29 UTC (permalink / raw)
To: davem; +Cc: netdev
The following series add the new IFLA_PORT_PROTO_* nested
protocol attributes to rtnetlink and it updates the enic
driver to support them.
01/2 - Add new protocol nested IFLA_PORT_PROTO_* attrs
02/2 - Update enic driver to support new IFLA_PORT_PROTO_* attrs
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
--------------------------------------------
Here is how the text below is organized:
- 1) INTRO
Describes what 802.1Qbh change led us to propose
the Netlink changes discussed here.
- 2) REASON FOR THIS CHANGE
Describe why we think the changes we propose make sense now.
- 3) OUR PROPOSAL
Describe the changes to the current IFLA_PORT_* attr scheme.
- 4) IFLA_* versus IFLA_PORT_*
Describe an alternative approach to the one described in
the previous section (OUR PROPOSAL).
- 5) DUPLICATE PARAMETERS versus INDEPENDENT PARAMETERS
Describe one more reason why we think it would be useful
to have per-proto nested attributes.
- 6) PARSING OF PROTOCOL ATTRIBUTES
Describe how/when the new sub-attributes of the new protocol
nested attributes are parsed.
- 7) PRIORITY ORDER FOR "DOUBLE" PARAMETERS
Describe how to handle the case where the same attribute
is present both as a common attribute and as a protocol
private attribute.
- 8) OPT1: MORE CONFIGURATION FLEXIBILITY
Describe one optional change which can be used to further
enhance the config flexibility. This change is independent
from the one discussed in "OUR PROPOSAL".
- 9) OPT2: MORE CHANGES TO THE NETLINK SCHEME
Describe how to extend the changes described in "OUR PROPOSAL" to
include the common attributes.
- 10) BACKWARD COMPATIBILITY
A couple of notes about how backward compatibility would
be handled.
--------------------------------------------------
1) INTRO
--------------------------------------------------
In the current implementation of the network port profile feature
the parameters used by 802.1Qbg and 802.1Qbh IEEE protocols share
the same Netlink attribute scheme.
Here is the list of the currently defined attributes:
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF, /* __u32 */
IFLA_PORT_PROFILE, /* string */
IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP*/
IFLA_PORT_INSTANCE_UUID, /* binary UUID */
IFLA_PORT_HOST_UUID, /* binary UUID */
IFLA_PORT_REQUEST, /* __u8 */
IFLA_PORT_RESPONSE, /* __u16, output only */
__IFLA_PORT_MAX,
};
It is a flat list of attributes:
- some of them are used by 802.1QBH
- some of them are used by 802.1QBG
and
- some others are shared by the two protocols.
In order to be able to scope a port profile, as part of the 802.1Qbh
implementation we would like to add a new attribute: IFLA_PORT_CLUSTER_UUID.
This parameter (perhaps known under a different name) is already in use
(or going to be added) by most Virtual Machine Managers to define migration
domains. In the case of 802.1Qbh a port profile would most likely be scoped
using the same ID used by VM manager to represent the migration domain.
Adding another attribute (IFLA_PORT_CLUSTER_UUID in this case) to the list of
IFLA_PORT_* attributes is an option.
However, we thought that it would be better to 1st re-arrange the current
Netlink attribute scheme in order to better group the IFLA_PORT_* attributes
(for example by protocol).
Patch_1/2 describes the Netlink scheme change, while Patch_2/2 shows how the
enic driver would change to adapt to the new scheme.
Before to post the (trivial) patch that adds support for the new proposed
IFLA_PORT_CLUSTER_UUID attribute, I would like to see if you seen any value
in the change proposed with this patch.
The rest of the email simply describes into more details the patch and the
various options that we can consider. I included this So that we may be able
to converge faster.
--------------------------------------------------
2) REASON FOR THIS CHANGE
--------------------------------------------------
We would like to add one more attribute (IFLA_PORT_CLUSTER_UUID), and the list
of IFLA_PORT_* attributes may need to grow again due to the changes that may
be required by the two still evolving standard protocols 802.1Qbh/802.1Qbg.
Because of that, if you see a value in the re-organization of the
IFLA_PORT_* attributes that we are proposing, it would be better to address
such changes sooner than later, in order to reduce the impact of backward
compatibility issues later.
--------------------------------------------------
3) OUR PROPOSAL
--------------------------------------------------
Instead of a flat list of attributes, the new scheme that we propose defines
two groups of attributes (one per protocol):
- 802.1Qbh parameters
- 802.1Qbg parameters
Each one of the above groups would be represented by an attribute of type
NLA_NESTED. If there will ever be another protocol coming into the picture we
can simply add a new NLA_NESTED attribute which would represent its set of
attributes.
In other words, this is the current scheme:
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF,
IFLA_PORT_PROFILE,
IFLA_PORT_VSI_TYPE,
IFLA_PORT_INSTANCE_UUID,
IFLA_PORT_HOST_UUID,
IFLA_PORT_REQUEST,
IFLA_PORT_RESPONSE,
__IFLA_PORT_MAX,
};
and this would be the new one:
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF,
IFLA_PORT_PROFILE, (*)
IFLA_PORT_VSI_TYPE, (*)
IFLA_PORT_INSTANCE_UUID,
IFLA_PORT_HOST_UUID,
IFLA_PORT_REQUEST,
IFLA_PORT_RESPONSE,
IFLA_PORT_PROTO_8021QBG, <--- NEW nested attr
IFLA_PORT_PROTO_8021QBH, <--- NEW nested attr
__IFLA_PORT_MAX,
};
The above attributes marked with (*) are protocol specific (while all the
others are common to the two protocols) and therefore would be deprecated
and replaced with new ones, as shown in the scheme below:
[IFLA_PORT_VF]
[IFLA_PORT_INSTANCE_UUID]
[IFLA_PORT_HOST_UUID]
[IFLA_PORT_REQUEST]
[IFLA_PORT_RESPONSE]
[IFLA_PORT_PROTO_8021QBG]
[IFLA_PORT_8021QBG_VSI_TYPE] <-- NEW sub attr
[IFLA_PORT_PROTO_8021QBH]
[IFLA_PORT_8021QBH_PROFILE] <-- NEW sub attr
In summary:
/* NEW list of 802.1QBG attributes */
enum {
IFLA_PORT_PROTO_8021QBG_VSI_TYPE,
__IFLA_PORT_PROTO_8021QBG_MAX,
};
/* NEW list of 802.1QBH attributes */
enum {
IFLA_PORT_PROTO_8021QBH_PROFILE,
__IFLA_PORT_PROTO_8021QBH_MAX,
};
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF,
IFLA_PORT_PROFILE, <--(BH only / deprecated)
IFLA_PORT_VSI_TYPE, <--(BG only / deprecated)
IFLA_PORT_INSTANCE_UUID, <----(common)
IFLA_PORT_HOST_UUID, <----(common)
IFLA_PORT_REQUEST, <----(common)
IFLA_PORT_RESPONSE, <----(common)
IFLA_PORT_PROTO_8021QBH, <------ NEW nested attr
IFLA_PORT_PROTO_8021QBG, <------ NEW nested attr
__IFLA_PORT_MAX,
};
--------------------------------------------------
4) IFLA_* versus IFLA_PORT_*
--------------------------------------------------
Here is an alternative way to introduce the new Netlink attribute scheme.
We personally like better the previous scheme, but I'll include this one too
should someone find it interesting.
The idea is that we can apply the changes one level higher into the Netlink
attribute hierarchy:
IFLA_* (*1)
/ ... \
v v
IFLA_PORT_* .... (*2)
In other words, the previous scheme adds the new attributes at level (*2) while
this alternative solution would add the new attributes at level (*1)
The current scheme at level (*1) uses these two attributes:
IFLA_VF_PORT
IFLA_PORT_SELF
while this new one would use these two new attributes:
IFLA_GEN_VF_PORT
IFLA_GEN_PORT_SELF
which translates to this:
enum {
IFLA_UNSPEC,
...
IFLA_VF_PORTS, <--- OLD / deprecated
IFLA_PORT_SELF, <--- OLD / deprecated
IFLA_GEN_VF_PORTS, <----NEW
IFLA_GEN_PORT_SELF, <----NEW
__IFLA_MAX
};
With this alternative scheme we would be able to define a new list of
attributes IFLA_PORT_GEN_* which would not include any deprecated attr:
enum {
IFLA_PORT_GEN_UNSPEC,
... common attr here ...
IFLA_PORT_GEN_PROTO_8021QBH,
IFLA_PORT_GEN_PROTO_8021QBG,
__IFLA_PORT_MAX,
};
NOTE: I am not suggesting the use of "_GEN". I used that keyword
just for the example.
The consumer of the Netling messages can easily distinguish between legacy
attributes (ie, IFLA_VF_PORTS/IFLA_PORT_SELF attributes) and new ones
(ie, IFLA_GEN_VF_PORTS/IFLA_GEN_PORT_SELF attributes)
--------------------------------------------------
5) DUPLICATE PARAMETERS versus INDEPENDENT PARAMETERS
--------------------------------------------------
One more note about the semantic of this new attribute scheme (which
applies to both proposals above).
There may be cases where a group of protocols (ie, 802.1Qbh and 802.1Qbg
as of today) has similar parameters but the latter do not share the same
exact meaning/syntax.
This situation would not be an issue because each protocol would interpret
those parameters independently accordingly to its semantic.
However, what could represent a limitation/issue is that those protocols
may have different data size/type requirements for the same parameter.
For example 802.1Qbg uses ifla_port_vsi.mgr_id to represent something
very similar to the IFLA_PORT_CLUSTER_UUID attribute that we would like
to add for 802.1Qbh. However:
- 802.1Qbg/ifla_port_vsi.mgr_id (which is already in the kernel)
is a 8-bit field
- 802.1Qbh/CLUSTER_UUID (which we would like to add) requires
more than 8 bits and could be a string
Here are a couple of options to handle this mismatch in the data type/size
requirements:
OPTION_1: we try to find a compromise and share the same data size/type.
In the above example, this may require a change in the
ifla_port_vsi data structure definition (to increase for
example the size of mgr_id) or, if we leave it the way it is
defined right now, the new 802.1Qbh cluster UUID would have to
live with the current 8-bit limitation imposed by
ifla_port_vsi.mgr_id.
OPTION_2: I'll mention this option for the sake of completeness, but I am
not suggesting it.
We could remove the mgr_id field from the ifla_port_vsi structure
and introduce a new shared attribute (ie IFLA_PORT_PROTO_GRP in the
example below). This attribute would then use a union to
provide different data sizes for the same config parameter, so
that we could for example use it to introduce the CLUSTER_UUID
needed for 802.1Qbh:
[IFLA_PORT_PROTO_ALL]
[IFLA_PORT_PROTO_ALL_GRP] = { .type = NLA_BINARY,
.len = sizeof(struct ifla_port_grp)};
struct ifla_port_grp {
union {
struct {
uint8_t managerID;
} 8021qbg;
struct {
uint8_t cluster_uuid[<size_of_cluster_id_here>];
} 8021qbh;
}
};
The keywords "group"/"cluster"/"domain" are pretty overloaded nowadays.
In the example above I used "_grp" just for lack of inspiration.
OPTION_3: According to the new Netlink attribute scheme that we are
proposing, each protocol has its own set of attributes and
therefore it would not be considered superfluous to have the
same (or a similar) attribute defined for both protocols.
(in this case it would be manager_ID for 802.1qbg and
cluster_uuid for 802.1qbh).
To us OPTION_3 looks like the option that offers most flexibility.
This case above (mgr_id versus Cluster UUID) is just an example, however the
possibility of having the two parameters being independent allows for an easier
extendibility/adaptation of the two (still evolving) protocol implementations.
--------------------------------------------------
6) PARSING OF PROTOCOL ATTRIBUTES
--------------------------------------------------
When a device driver (or a generic consumer in kernel space) Receives a netlink
message that carries one of the new IFLA_PORT_PROTO_* attributes, it can use
the _new_ rtnetlink API rtnl_link_parse_port_proto:
rtnetlink::do_setlink
|
+--> driver::ndo_set_vf_port
|
+--> rtnetlink::rtnl_link_parse_port_proto
--------------------------------------------------
7) PRIORITY ORDER FOR "DOUBLE" PARAMETERS
--------------------------------------------------
As part of the semantic of this new Netlink attribute scheme, we would
recommend this additional rule:
if one parameter is present twice in a Netlink message, that
is to say it is present both as a shared parameter (ie, in the
IFLA_PORT_* list of attributes) and as a protocol private parameter
(ie, in one of the IFLA_PORT_PROTO_* nested attributes), the
most specific one would win (ie IFLA_PORT_PROTO_* in this case).
This would allow the new scheme to adapt to changes into the scope (and data
type/size) of the parameters without any change to the core code. For example:
Example_1 (shared attr -> private attr):
Today we have 802.1Qbh and 802.1Qbg in the picture. If tomorrow we add
a new IFLA_PORT_PROTO_XYZ protocol, the latter may have different
requirements (with regards to data size and type) for a given parameter,
and may therefore prefer to add its own (private) version of that
parameter inside its IFLA_PORT_PROTO_XYZ nested attribute.
Example_2 (private attr -> shared attr):
This is the reverse case of the previous example. Since the two
protocols are still evolving, new use case scenarios may drive
changes to the current data type/size requirements of the parameters.
Because of this, what is now a protocol private attribute may tomorrow
be eligible for changing to a shared attribute.
In such a case, the protocol would simply stop using its private
attribute (inside IFLA_PORT_PROTO_*) and start using the shared
one (ie IFLA_PORT_*).
--------------------------------------------------
8) OPT1: MORE CONFIGURATION FLEXIBILITY
--------------------------------------------------
The change described in this section is orthogonal to the ones Discussed above.
We believe it would add value to the new scheme.
We would like to include it as part of the new Netlink scheme (but the current
patch does not include it).
In order to allow device drivers (or a generic consumer of the Netlink messages)
to provide extra features or simple optimizations I would suggest the
introduction of a new nested attribute that I will call IFLA_PORT_DATA for now.
This attribute would allow the use of extra attributes that are not part of
the official protocol specs (802.1Qbg/bh for now) or simply allow device
drivers to start supporting pre-standard parameters that would not be included
in the Netlink scheme before they reach some stability.
In order to keep the implementation as simple as possible and to allow the
different drivers to change/update/version their private attributes without
having to change each time the IFLA_PORT_* list of attributes, I would propose
to define IFLA_PORT_DATA of type NLA_UNSPEC: it is up to the consumer to
interpret/parse it.
Of course, the hypothesis here is that the sender knows who the receiver (ie,
most likely the driver) is, and viceversa (otherwise they would not be able to
agree on a data structure type).
Here is how the previously described scheme would change with the addition of
this new attribute:
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF,
IFLA_PORT_PROFILE,
IFLA_PORT_VSI_TYPE,
IFLA_PORT_INSTANCE_UUID,
IFLA_PORT_HOST_UUID,
IFLA_PORT_REQUEST,
IFLA_PORT_RESPONSE,
IFLA_PORT_DATA, <========== NEW
IFLA_PORT_PROTO_8021QBH,
IFLA_PORT_PROTO_8021QBG,
__IFLA_PORT_MAX,
};
Here are a couple of examples of use.
Let's suppose that driver ABC needed to receive a couple of parameters
more (that are not part of the official 802.1Qbh/bg protocols).
In this case driver ABC can use the new attribute IFLA_PORT_DATA to
receive its two additional parameters without any need to touch/modify
the IFLA_PORT_* list of attributes.
If in the future driver ABC needed to change any of its private
parameters (those it receives through the IFLA_PORT_DATA attribute), it
can do it by updating its parsing routine (of course it would need
to implement a basic versioning scheme for its private attributes), but
no change would be required in the core Netlink code.
I can see one more advantage. If that hypothetical extra feature
provided by driver ABC (which requires the use of IFLA_PORT_ DATA) will
one day become a sort of generic feature that it makes sense to
implement for all drivers (or for a number of them), those attributes
that used to be embedded into the IFLA_PORT_DATA attribute can now be
made visible to the upper (Netlink) layer and be therefore added to
the IFLA_PORT_* list.
This could be the case of a pre-standard config parameter that gets
confirmed and becomes stable.
Of course, the idea is not that of abusing IFLA_PORT_DATA, but rather
that of allowing comsumers (ie, device drivers or user space apps)
to receive extra parameters needed to implement/provide optimizations.
If we do not want to add IFLA_PORT_DATA, an alternative solution would
be that of using a separate control channel to provide that extra
info, for example based on something like the NETLINK_GENERIC Netlink
protocol.
This alternative approach would offer the same flexibility, but I
can see One drawback: this solution would require some extra code
to synchronize the two control channels
(generic NETLINK_ROUTE/IFLA_PORT_XXX and NETLINK_GENERIC/Driver).
--------------------------------------------------
9) OPT2: MORE CHANGES TO THE NETLINK SCHEME
--------------------------------------------------
On top of the new nested protocol attributes discussed already, we
could define an additional one where we can put all common parameters.
>From a logical perspective it would be something like this:
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF,
IFLA_PORT_PROTO_ALL, <--- NEW nested attr
IFLA_PORT_PROTO_8021QBG, <--- NEW nested attr
IFLA_PORT_PROTO_8021QBH, <--- NEW nested attr
__IFLA_PORT_MAX,
};
But since we cannot remove the obsolete attributes, the real
scheme would be this:
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF,
IFLA_PORT_PROFILE, <-------(BH only) / deprecated
IFLA_PORT_VSI_TYPE, <-------(BG only) / deprecated
IFLA_PORT_INSTANCE_UUID, <-------(common) / deprecated (*)
IFLA_PORT_HOST_UUID, <-------(common) / deprecated (*)
IFLA_PORT_REQUEST, <-------(common) / deprecated (*)
IFLA_PORT_RESPONSE, <-------(common) / deprecated (*)
IFLA_PORT_PROTO_ALL, <-- NEW nested attr
IFLA_PORT_PROTO_8021QBH, <-- NEW nested attr
IFLA_PORT_PROTO_8021QBG, <-- NEW nested attr
__IFLA_PORT_MAX,
};
(*) common parameters that would move inside IFLA_PORT_PROTO_ALL.
This approach would allow us to keep adding shared params
and nested proto attributes without mixing them.
In other words this would NOT be possible:
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF,
IFLA_PORT_PROFILE,
IFLA_PORT_VSI_TYPE,
IFLA_PORT_INSTANCE_UUID,
IFLA_PORT_HOST_UUID,
IFLA_PORT_REQUEST,
IFLA_PORT_RESPONSE,
IFLA_PORT_PROTO_8021QBH,
IFLA_PORT_PROTO_8021QBG,
IFLA_PORT_ABCD1, <---New protos and
IFLA_PORT_PROTO_XYZ, <---new common parameters
IFLA_PORT_ABCD2 <---get mixed
__IFLA_PORT_MAX,
};
I know, it's just a cosmetic detail, but I wanted to mention it
for the sake of completeness.
--------------------------------------------------
10) BACKWARD COMPATIBILITY
--------------------------------------------------
Let me split the comments into two parts: GET vs SET.
a) RTM_SETLINK
The recipient of the message, for example the enic driver, should
1st look for the new protocol attributes IFLA_PORT_PROTO_*.
Only when the latter is not present it should check for the
deprecated attributes.
I would suggest making it ILLEGAL to mix new and deprecated
attributes.
b) RTM_GETLINK
The recipient of the message, for example the enic driver, should
return both the deprecated and the new attributes. This would not
involve much overhead as the number of deprecated attributes is small.
When the protocol nested attributes IFLA_PORT_PROTO_* will be
populated with new sub-attributes (like the CLUSTER_UUID we would like
to add), the user space clients will have to adapt to the new
attribute scheme if they want to be able to see/receive the new
attributes (like CLUSTER_UUID).
Thanks
/Christian
^ permalink raw reply
* Re: [34/44] Limit sysctl_tcp_mem and sysctl_udp_mem initializers to prevent integer overflows.
From: Greg KH @ 2010-12-08 4:16 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, stable, David S. Miller, stable-review, akpm, alan,
Robin Holt, Willy Tarreau, netdev, linux-sctp, Alexey Kuznetsov,
Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, Vlad Yasevich, Sridhar Samudrala
In-Reply-To: <AANLkTimTw3O-OM-5Cgv0ELNj8SmMjaaeMHMd2NNezxi7@mail.gmail.com>
On Tue, Dec 07, 2010 at 05:22:34PM -0800, Linus Torvalds wrote:
> On Tue, Dec 7, 2010 at 4:04 PM, Greg KH <gregkh@suse.de> wrote:
> >
> > From: Robin Holt <holt@sgi.com>
> >
> > [ Problem was fixed differently upstream. -DaveM ]
>
> Gaah. I'd really like to see more of a description for things like
> this. A commit ID for the alternate fix, or at least a few words about
> the different fix or reason why upstream doesn't need the stable
> commit.
I'll let David confirm this, he's the one who sent it to me :)
thanks,
greg k-h
^ permalink raw reply
* [PATCH 1/2] via-velocity: set sleep speed to 10Mbps for powersaving.
From: David Lv @ 2010-12-08 4:10 UTC (permalink / raw)
To: netdev, romieu, DavidLv, ShirleyHu, AndersMa
I am sending this patch for setting speed to 10Mbps when entering into
sleep mode.
It is for power saving.
Thanks!
Signed-off-by: David Lv <DavidLv@viatech.com.cn>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/via-velocity.c | 67 ++++++++++++++++++++++++++++++++------------
drivers/net/via-velocity.h | 3 ++
2 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index cab96ad..95accb9 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -334,6 +334,15 @@ VELOCITY_PARAM(speed_duplex, "Setting the speed
and duplex mode");
*/
VELOCITY_PARAM(ValPktLen, "Receiving or Drop invalid 802.3 frame");
+/* sleep_speed_10M[] is used for setting wol speed forced 10M
+ 0: Disable (default)
+ 1: Enable
+*/
+#define SLEEP_SPEED_DEF 0
+#define SLEEP_SPEED_DISABLE 0
+#define SLEEP_SPEED_ENABLE 1
+VELOCITY_PARAM(sleep_speed_10M, "Sleep Speed Forced 10M");
+
#define WOL_OPT_DEF 0
#define WOL_OPT_MIN 0
#define WOL_OPT_MAX 7
@@ -487,6 +496,8 @@ static void __devinit velocity_get_options(struct
velocity_opt *opts, int index,
velocity_set_bool_opt(&opts->flags, IP_byte_align[index],
IP_ALIG_DEF, VELOCITY_FLAGS_IP_ALIGN, "IP_byte_align", devname);
velocity_set_bool_opt(&opts->flags, ValPktLen[index],
VAL_PKT_LEN_DEF, VELOCITY_FLAGS_VAL_PKT_LEN, "ValPktLen", devname);
velocity_set_int_opt((int *) &opts->spd_dpx, speed_duplex[index],
MED_LNK_MIN, MED_LNK_MAX, MED_LNK_DEF, "Media link mode", devname);
+ velocity_set_int_opt((int *) &opts->sleep_speed_10m, sleep_speed_10M[index],
+ SLEEP_SPEED_DISABLE, SLEEP_SPEED_ENABLE, SLEEP_SPEED_DEF, "Sleep
Speed Forced 10M", devname);
velocity_set_int_opt((int *) &opts->wol_opts, wol_opts[index],
WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, "Wake On Lan options",
devname);
opts->numrx = (opts->numrx & ~3);
}
@@ -2513,9 +2524,6 @@ static int velocity_close(struct net_device *dev)
if (dev->irq != 0)
free_irq(dev->irq, dev);
- /* Power down the chip */
- pci_set_power_state(vptr->pdev, PCI_D3hot);
-
velocity_free_rings(vptr);
vptr->flags &= (~VELOCITY_FLAGS_OPENED);
@@ -2925,6 +2933,9 @@ static int velocity_set_wol(struct velocity_info *vptr)
struct mac_regs __iomem *regs = vptr->mac_regs;
static u8 buf[256];
int i;
+ u8 CHIPGCR;
+ u16 ANAR;
+ u8 GCR;
static u32 mask_pattern[2][4] = {
{0x00203000, 0x000003C0, 0x00000000, 0x0000000}, /* ARP */
@@ -2968,23 +2979,46 @@ static int velocity_set_wol(struct velocity_info *vptr)
writew(0x0FFF, ®s->WOLSRClr);
- if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
- if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
- MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG, vptr->mac_regs);
+ if ((VELOCITY_SLEEP_SPEED_10M == vptr->options.sleep_speed_10m) &&
+ !(vptr->mii_status & (VELOCITY_SPEED_10 | VELOCITY_DUPLEX_FULL))) {
+ // set force MAC mode bit */
+ BYTE_REG_BITS_ON(CHIPGCR_FCMODE, ®s->CHIPGCR);
- MII_REG_BITS_OFF(ADVERTISE_1000FULL | ADVERTISE_1000HALF,
MII_CTRL1000, vptr->mac_regs);
- }
+ CHIPGCR = readb(®s->CHIPGCR);
+ CHIPGCR &= ~CHIPGCR_FCGMII;
+ CHIPGCR |= CHIPGCR_FCFDX;
+ writeb(CHIPGCR, ®s->CHIPGCR);
+ if (vptr->rev_id < REV_ID_VT3216_A0)
+ BYTE_REG_BITS_OFF(TCR_TB2BDIS, ®s->TCR);
+
+ velocity_mii_read(vptr->mac_regs, MII_ADVERTISE, &ANAR);
+ ANAR &= ~(ADVERTISE_100HALF | ADVERTISE_100FULL | ADVERTISE_10HALF);
+ ANAR |= ADVERTISE_10FULL;
+ velocity_mii_write(vptr->mac_regs, MII_ADVERTISE, ANAR);
+
+ MII_REG_BITS_OFF(ADVERTISE_1000FULL | ADVERTISE_1000HALF,
+ MII_CTRL1000, vptr->mac_regs);
- if (vptr->mii_status & VELOCITY_SPEED_1000)
MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR, vptr->mac_regs);
- BYTE_REG_BITS_ON(CHIPGCR_FCMODE, ®s->CHIPGCR);
+ } else {
+ if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
+ if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
+ MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG, vptr->mac_regs);
- {
- u8 GCR;
- GCR = readb(®s->CHIPGCR);
- GCR = (GCR & ~CHIPGCR_FCGMII) | CHIPGCR_FCFDX;
- writeb(GCR, ®s->CHIPGCR);
+ MII_REG_BITS_OFF(ADVERTISE_1000FULL | ADVERTISE_1000HALF,
MII_CTRL1000, vptr->mac_regs);
+ }
+
+ if (vptr->mii_status & VELOCITY_SPEED_1000)
+ MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR, vptr->mac_regs);
+
+ BYTE_REG_BITS_ON(CHIPGCR_FCMODE, ®s->CHIPGCR);
+
+ {
+ GCR = readb(®s->CHIPGCR);
+ GCR = (GCR & ~CHIPGCR_FCGMII) | CHIPGCR_FCFDX;
+ writeb(GCR, ®s->CHIPGCR);
+ }
}
BYTE_REG_BITS_OFF(ISR_PWEI, ®s->ISR);
@@ -3029,9 +3063,6 @@ static int velocity_suspend(struct pci_dev
*pdev, pm_message_t state)
struct velocity_info *vptr = netdev_priv(dev);
unsigned long flags;
- if (!netif_running(vptr->dev))
- return 0;
-
netif_device_detach(vptr->dev);
spin_lock_irqsave(&vptr->lock, flags);
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index aa2e69b..b5316ff 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -1358,6 +1358,8 @@ enum velocity_msg_level {
#define VELOCITY_FLAGS_FLOW_CTRL 0x01000000UL
+#define VELOCITY_SLEEP_SPEED_10M 1
+
/*
* Flags for driver status
*/
@@ -1426,6 +1428,7 @@ struct velocity_opt {
int txqueue_timer;
int tx_intsup;
int rx_intsup;
+ int sleep_speed_10m;
u32 flags;
};
--
1.7.3.2
^ permalink raw reply related
* set vlan CFI and TPID
From: hong zhiyi @ 2010-12-08 4:04 UTC (permalink / raw)
To: netdev
Hi All,
May I ask how to set the 1 bit CFI and 2 bytesTPID in the VLAN header
by vconfig? and what is the meaning of the egress map and ingress map?
I hope someone can help me.
Best Regards,
Hong Zhiyi
^ permalink raw reply
* Re: [PATCH 0/5 V2] Firewire networking assorted fixes
From: Maxim Levitsky @ 2010-12-08 3:32 UTC (permalink / raw)
To: linux1394-devel; +Cc: Stefan Richter, netdev
In-Reply-To: <1290996593-32416-1-git-send-email-maximlevitsky@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 941 bytes --]
On Mon, 2010-11-29 at 04:09 +0200, Maxim Levitsky wrote:
> Hi,
>
> This is updated version of the patches.
> I updated the changelogs, addressed comments on patch #2
>
> Best regards,
> Maxim Levitsky
>
Today I have achieved the ultimate goal,
full support of firewire networking via NetworkManager.
Currently it is patched with few hacks but much less that I expected.
I also had to patch dhclient as it unfortunately sends raw packets
together with hardware header (ethernet of course...)
I will soon clean up these hacks to turn them into patches and send to
developers.
The kernel side needs only the attached patch.
It adds the link state detection to firewire-net
Just for fun, this is screenshot that proves that NM works:
http://img210.imageshack.us/img210/6019/screenshotdjk.png
Of course, I still need to clean up the patches to NM and dhclient, so
more correctly I am not fully done yet.
Best regards,
Maxim Levitsky
[-- Attachment #2: 0001-firewire-net-add-carrier-detection.patch --]
[-- Type: text/x-patch, Size: 2575 bytes --]
>From d42274653bc06583871ec3230f8308236aff92c2 Mon Sep 17 00:00:00 2001
From: Maxim Levitsky <maximlevitsky@gmail.com>
Date: Wed, 8 Dec 2010 04:22:57 +0200
Subject: [PATCH] firewire: net: add carrier detection
To make userland, eg NM work with firewire
we need to be able if cable is plugged or not.
Simple and correct way of doing that is just couning number
of peers.
No peers - no link and vise versa.
Best regards,
Maxim Levitsky
---
drivers/firewire/net.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index ac563d6..67bad9c 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -178,6 +178,7 @@ struct fwnet_device {
/* Number of tx datagrams that have been queued but not yet acked */
int queued_datagrams;
+ int peer_count;
struct list_head peer_list;
struct fw_card *card;
@@ -1408,6 +1409,10 @@ static int fwnet_change_mtu(struct net_device *net, int new_mtu)
return 0;
}
+static const struct ethtool_ops fwnet_ethtool_ops = {
+ .get_link = ethtool_op_get_link,
+};
+
static const struct net_device_ops fwnet_netdev_ops = {
.ndo_open = fwnet_open,
.ndo_stop = fwnet_stop,
@@ -1426,6 +1431,8 @@ static void fwnet_init_dev(struct net_device *net)
net->hard_header_len = FWNET_HLEN;
net->type = ARPHRD_IEEE1394;
net->tx_queue_len = FWNET_TX_QUEUE_LEN;
+ net->ethtool_ops = &fwnet_ethtool_ops;
+
}
/* caller must hold fwnet_device_mutex */
@@ -1467,6 +1474,7 @@ static int fwnet_add_peer(struct fwnet_device *dev,
spin_lock_irq(&dev->lock);
list_add_tail(&peer->peer_link, &dev->peer_list);
+ dev->peer_count++;
spin_unlock_irq(&dev->lock);
return 0;
@@ -1538,6 +1546,9 @@ static int fwnet_probe(struct device *_dev)
unregister_netdev(net);
list_del(&dev->dev_link);
}
+
+ if (dev->peer_count > 1)
+ netif_carrier_on(net);
out:
if (ret && allocated_netdev)
free_netdev(net);
@@ -1553,6 +1564,7 @@ static void fwnet_remove_peer(struct fwnet_peer *peer)
spin_lock_irq(&peer->dev->lock);
list_del(&peer->peer_link);
+ peer->dev->peer_count--;
spin_unlock_irq(&peer->dev->lock);
list_for_each_entry_safe(pd, pd_next, &peer->pd_list, pd_link)
@@ -1575,6 +1587,11 @@ static int fwnet_remove(struct device *_dev)
fwnet_remove_peer(peer);
+ /* If we serve just one node, that means we lost link
+ with outer world */
+ if (dev->peer_count == 1)
+ netif_carrier_off(dev->netdev);
+
if (list_empty(&dev->peer_list)) {
net = dev->netdev;
unregister_netdev(net);
--
1.7.1
^ permalink raw reply related
* [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address
From: Wei Yongjun @ 2010-12-08 3:11 UTC (permalink / raw)
To: Vlad Yasevich, David Miller; +Cc: linux-sctp, netdev@vger.kernel.org
SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
fix it by mapping v4mapped address to v4 address if allowed.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
net/sctp/socket.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6bd5543..0b9ee34 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2932,6 +2932,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
struct sctp_association *asoc = NULL;
struct sctp_setpeerprim prim;
struct sctp_chunk *chunk;
+ struct sctp_af *af;
int err;
sp = sctp_sk(sk);
@@ -2959,6 +2960,13 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
if (!sctp_state(asoc, ESTABLISHED))
return -ENOTCONN;
+ af = sctp_get_af_specific(prim.sspp_addr.ss_family);
+ if (!af)
+ return -EINVAL;
+
+ if (!af->addr_valid((union sctp_addr *)&prim.sspp_addr, sp, NULL))
+ return -EADDRNOTAVAIL;
+
if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr))
return -EADDRNOTAVAIL;
^ permalink raw reply related
* Re: [34/44] Limit sysctl_tcp_mem and sysctl_udp_mem initializers to prevent integer overflows.
From: Linus Torvalds @ 2010-12-08 1:22 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel, stable, David S. Miller, stable-review, akpm, alan,
Robin Holt, Willy Tarreau, netdev, linux-sctp, Alexey Kuznetsov,
Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, Vlad Yasevich, Sridhar Samudrala
In-Reply-To: <20101208000642.975564500@clark.site>
On Tue, Dec 7, 2010 at 4:04 PM, Greg KH <gregkh@suse.de> wrote:
>
> From: Robin Holt <holt@sgi.com>
>
> [ Problem was fixed differently upstream. -DaveM ]
Gaah. I'd really like to see more of a description for things like
this. A commit ID for the alternate fix, or at least a few words about
the different fix or reason why upstream doesn't need the stable
commit.
Linus
^ 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