* Re: [PATCH net-next v10 03/11] ipv6: export a stub for IPv6 symbols used by vxlan
From: Stephen Hemminger @ 2013-08-28 16:12 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, David S. Miller, Ben Hutchings
In-Reply-To: <1377667379-2315-4-git-send-email-amwang@redhat.com>
On Wed, 28 Aug 2013 13:22:51 +0800
Cong Wang <amwang@redhat.com> wrote:
> +struct ipv6_stub {
> + int (*ipv6_sock_mc_join)(struct sock *sk, int ifindex,
> + const struct in6_addr *addr);
> + int (*ipv6_sock_mc_drop)(struct sock *sk, int ifindex,
> + const struct in6_addr *addr);
> + int (*ipv6_dst_lookup)(struct sock *sk, struct dst_entry **dst,
> + struct flowi6 *fl6);
> + void (*udpv6_encap_enable)(void);
> +};
> +extern const struct ipv6_stub *ipv6_stub __read_mostly;
> +
Since IPv6 really can't ever be safely unloaded. why not:
* admit that, and get rid of ipv6_module exit.
* then this stub can be a static const table.
You see virtual function tables that are writeable are potential malware
targets, although eliminating all of them is impossible, I hate to
see adding new ones.
^ permalink raw reply
* Re: [PATCH net-next v10 09/11] vxlan: add ipv6 proxy support
From: Stephen Hemminger @ 2013-08-28 16:13 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, David S. Miller, David Stevens
In-Reply-To: <1377667379-2315-10-git-send-email-amwang@redhat.com>
On Wed, 28 Aug 2013 13:22:57 +0800
Cong Wang <amwang@redhat.com> wrote:
> +#if IS_ENABLED(CONFIG_IPV6)
> +static int neigh_reduce(struct net_device *dev, struct sk_buff *skb)
> +{
> + struct vxlan_dev *vxlan = netdev_priv(dev);
> + struct neighbour *n;
> + union vxlan_addr ipa;
> + const struct ipv6hdr *iphdr;
> + const struct in6_addr *saddr, *daddr;
> + struct nd_msg *msg;
> + struct inet6_dev *in6_dev = NULL;
> +
> + WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
You may have needed warn during debugging, but you should be able
to audit all the codepaths (this is a static function) to be sure
that this code is correct (ie rcu lock always held).
^ permalink raw reply
* Re: [PATCH net-next v3 13/13] bonding: pr_debug instead of pr_warn in bond_arp_send_all
From: Joe Perches @ 2013-08-28 16:15 UTC (permalink / raw)
To: Veaceslav Falico, Jason Baron; +Cc: netdev, Jay Vosburgh, Andy Gospodarek
In-Reply-To: <1377705842-8276-14-git-send-email-vfalico@redhat.com>
(adding Jason Baron to comment on dynamic_debug)
On Wed, 2013-08-28 at 18:04 +0200, Veaceslav Falico wrote:
> They're simply annoying and will spam dmesg constantly if we hit them, so
> convert to pr_debug so that we still can access them in case of debugging.
>
> v2: new patch
> v3: no change
Hi Veaceslav:
This changelog bit maybe is better placed below the ---
Hey Jason:
This conversion loses the net_ratelimit().
This maybe is an example of where dynamic_debug
could be better with some global rate control.
> CC: Jay Vosburgh <fubar@us.ibm.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
> ---
> drivers/net/bonding/bond_main.c | 14 ++++++--------
> 1 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index a52cff1..47e1052 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -2336,10 +2336,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
> rt = ip_route_output(dev_net(bond->dev), targets[i], 0,
> RTO_ONLINK, 0);
> if (IS_ERR(rt)) {
> - if (net_ratelimit()) {
> - pr_warning("%s: no route to arp_ip_target %pI4\n",
> - bond->dev->name, &targets[i]);
> - }
> + pr_debug("%s: no route to arp_ip_target %pI4\n",
> + bond->dev->name, &targets[i]);
> continue;
> }
>
> @@ -2364,10 +2362,10 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
> rcu_read_unlock();
>
> /* Not our device - skip */
> - if (net_ratelimit())
> - pr_warning("%s: no path to arp_ip_target %pI4 via rt.dev %s\n",
> - bond->dev->name, &targets[i],
> - rt->dst.dev ? rt->dst.dev->name : "NULL");
> + pr_debug("%s: no path to arp_ip_target %pI4 via rt.dev %s\n",
> + bond->dev->name, &targets[i],
> + rt->dst.dev ? rt->dst.dev->name : "NULL");
> +
> ip_rt_put(rt);
> continue;
>
^ permalink raw reply
* Re: [PATCH net-next] qdisc: allow setting default queuing discipline
From: Stephen Hemminger @ 2013-08-28 16:18 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1377665870.8828.163.camel@edumazet-glaptop>
On Tue, 27 Aug 2013 21:57:50 -0700
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2013-08-27 at 21:00 -0700, Eric Dumazet wrote:
> > On Tue, 2013-08-27 at 16:19 -0700, Stephen Hemminger wrote:
> > > By default, the pfifo_fast queue discipline has been used by default
> > > for all devices. But we have better choices now.
> > >
> > > This patch allow setting the default queueing discipline with sysctl.
> > > This allows easy use of better queueing disciplines on all devices
> > > without having to use tc qdisc scripts. It is intended to allow
> > > an easy path for distributions to make fq_codel or sfq the default
> > > qdisc.
> > >
> > > This patch also makes pfifo_fast more of a first class qdisc, since
> > > it is now possible to manually override the default and explicitly
> > > use pfifo_fast. The behavior for systems who do not use the sysctl
> > > is unchanged, they still get pfifo_fast
> > >
> > > Also removes leftover random # in sysctl net core.
> > >
> > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > >
> > > ---
> >
> > I find this quite incredible, because I was going to write such patch
> > tonight ;)
> >
> > Now I can just relax, thanks so much Stephen !
> >
> > Acked-by: Eric Dumazet <edumazet@google.com>
> >
>
> I was wondering if we also could redefine the pfifo default, used for
> example in HTB classes.
>
> ie calls to qdisc_create_dflt( ... &pfifo_qdisc_ops )
>
> /proc/sys/net/core/default_qdisc would 'define' the default pfifo_fast,
>
> /proc/sys/net/core/default_pfifo_qdisc would 'define' the default pfifo,
>
> Or something like that...
Although your idea adds completeness, not sure if it is worth it.
The thing is if user is using HTB, they already are using tc
commands to set it up, therefore the additional script steps to choose some
other qdisc for the leaf nodes doesn't seem like a burden.
Therefore the sysctl doesn't help much and might even create more
confusion because there is now two places to update.
^ permalink raw reply
* RE: [net-next 06/10] ixgbe: cleanup some log messages
From: Skidmore, Donald C @ 2013-08-28 16:19 UTC (permalink / raw)
To: Joe Perches, Kirsher, Jeffrey T
Cc: davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
sassmann@redhat.com
In-Reply-To: <1377701368.1928.10.camel@joe-AO722>
> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Wednesday, August 28, 2013 7:49 AM
> To: Kirsher, Jeffrey T
> Cc: davem@davemloft.net; Skidmore, Donald C; netdev@vger.kernel.org;
> gospo@redhat.com; sassmann@redhat.com
> Subject: Re: [net-next 06/10] ixgbe: cleanup some log messages
>
> On Wed, 2013-08-28 at 03:33 -0700, Jeff Kirsher wrote:
> > From: Don Skidmore <donald.c.skidmore@intel.com>
>
> > Some minor log messages cleanup, changing the level one message is
> > logged, adding a bit of detail to another and put all the text on one line.
>
> Not a comment about this patch but:
>
> > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
> > b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
> []
> > @@ -1282,7 +1282,7 @@ s32 ixgbe_identify_qsfp_module_generic(struct
> ixgbe_hw *hw)
> > status = 0;
> > } else {
> > if (hw->allow_unsupported_sfp == true) {
>
> At some point it might be nice to remove the remaining bool direct
> comparisons to true/false
>
> $ git grep -E -n "(==|!=)\s*(true|false)" drivers/net/ethernet/intel
> drivers/net/ethernet/intel/e1000e/netdev.c:4871:
> (hw->mac.autoneg == true) &&
> drivers/net/ethernet/intel/e1000e/phy.c:2651: * Assumes semaphore is
> already acquired. When page_set==true, assumes
> drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c:763: if (hw-
> >phy.reset_disable == false) {
> drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c:819: if (hw-
> >mac.orig_link_settings_stored == false) {
> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:954:
> (hw->phy.smart_speed_active == false))
> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:1099: if (hw-
> >phy.reset_disable == false && hw->phy.ops.reset != NULL)
> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:1167: if (hw-
> >mac.orig_link_settings_stored == false) {
> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:2371: if (hw-
> >phy.qsfp_shared_i2c_bus == true) {
> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:2397: if (hw-
> >phy.qsfp_shared_i2c_bus == true) {
> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:2424: if (hw-
> >phy.qsfp_shared_i2c_bus == true) {
> drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c:2450: if (hw-
> >phy.qsfp_shared_i2c_bus == true) {
> drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c:1273:
> if (hw->allow_unsupported_sfp == true) {
>
Thanks for pointing this out Joe.
I'll work on a patch to do that for ixgbe and talk with the e1000e owner about doing it with their driver.
^ permalink raw reply
* Re: [PATCH net-next v3 13/13] bonding: pr_debug instead of pr_warn in bond_arp_send_all
From: Veaceslav Falico @ 2013-08-28 16:22 UTC (permalink / raw)
To: Joe Perches; +Cc: Jason Baron, netdev, Jay Vosburgh, Andy Gospodarek
In-Reply-To: <1377706548.1928.16.camel@joe-AO722>
On Wed, Aug 28, 2013 at 09:15:48AM -0700, Joe Perches wrote:
...snip...
>On Wed, 2013-08-28 at 18:04 +0200, Veaceslav Falico wrote:
...snip...
>> v2: new patch
>> v3: no change
>
>Hi Veaceslav:
Hi Joe,
>This changelog bit maybe is better placed below the ---
Yep, got it, will modify the next version (in case there will be one -
hopefully it's not a reason to resend the whole patchset - though if anyone
insists I can easily do it).
Thanks for the input!
^ permalink raw reply
* Re: [PATCH net-next v1 5/9] bonding: convert bond_has_this_ip() to use upper devices
From: Veaceslav Falico @ 2013-08-28 16:32 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: Jiri Pirko, netdev, Jay Vosburgh, Andy Gospodarek
In-Reply-To: <521E0FA0.5070506@redhat.com>
On Wed, Aug 28, 2013 at 10:56:32AM -0400, Vlad Yasevich wrote:
...snip...
>I've been playing with approach 2 for some work I am doing for
>macvtap-over-bond, but I like you idea for 3 better.
>
>It would make things simpler in the long run.
I've just sent the third version of the 3rd approach, which implements
lower/upper device lists for every device that are guaranteed, under RCU,
tu have all the upper/lower devices linked to the device. It also permits
to distinguish the 'neighbour' devices (i.e. linked on the first level,
i.e. direct-linked) from the 'distant' ones, which are not directly linked
but rather inherited.
It also implements the first function (and the only one that I've needed
to get rid of vlan lists in bonding) - netdev_for_each_upper_dev_rcu(),
which can be used as a loop:
struct net_device *upper;
struct list_head *iter;
rcu_read_lock();
netdev_for_each_upper_dev_rcu(dev, upper, iter) {
... do whatever you want with the upper dev ...
}
rcu_read_unlock();
In case you'll need, you can easily implement the same way
netdev_for_each_lower_dev_rcu().
Hope that helps.
>
>-vlad
^ permalink raw reply
* Re: [net-next 06/10] ixgbe: cleanup some log messages
From: Joe Perches @ 2013-08-28 16:36 UTC (permalink / raw)
To: Skidmore, Donald C, Bruce Allan
Cc: Kirsher, Jeffrey T, davem@davemloft.net, netdev@vger.kernel.org,
gospo@redhat.com, sassmann@redhat.com
In-Reply-To: <F6FB0E698C9B3143BDF729DF222866466FD4530B@ORSMSX110.amr.corp.intel.com>
On Wed, 2013-08-28 at 16:19 +0000, Skidmore, Donald C wrote:
> > -----Original Message-----
> > From: Joe Perches [mailto:joe@perches.com]
[]
> > At some point it might be nice to remove the remaining bool direct
> > comparisons to true/false
> >
> > $ git grep -E -n "(==|!=)\s*(true|false)" drivers/net/ethernet/intel
> > drivers/net/ethernet/intel/e1000e/netdev.c:4871:
> > (hw->mac.autoneg == true) &&
> > drivers/net/ethernet/intel/e1000e/phy.c:2651: * Assumes semaphore is
> > already acquired. When page_set==true, assumes
> > drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c:763: if (hw-
> > >phy.reset_disable == false) {
[etc...]
> Thanks for pointing this out Joe.
Just a bit of code style ocd... ;)
> I'll [] talk with the e1000e owner about doing it with their driver.
I believe the e1000e driver isn't using a bool
comparison as autoneg is a u8, but it could still use
hw->mac.autoneg
for consistency with the other tests in the same driver.
Maybe:
---
drivers/net/ethernet/intel/e1000e/netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 2fead50..be9c033 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -4869,7 +4869,7 @@ static void e1000_watchdog_task(struct work_struct *work)
*/
if ((hw->phy.type == e1000_phy_igp_3 ||
hw->phy.type == e1000_phy_bm) &&
- (hw->mac.autoneg == true) &&
+ hw->mac.autoneg &&
(adapter->link_speed == SPEED_10 ||
adapter->link_speed == SPEED_100) &&
(adapter->link_duplex == HALF_DUPLEX)) {
^ permalink raw reply related
* Re: [PATCH net-next v3 07/13] bonding: make bond_arp_send_all use upper device list
From: Vlad Yasevich @ 2013-08-28 16:45 UTC (permalink / raw)
To: Veaceslav Falico; +Cc: netdev, Jay Vosburgh, Andy Gospodarek
In-Reply-To: <1377705842-8276-8-git-send-email-vfalico@redhat.com>
On 08/28/2013 12:03 PM, Veaceslav Falico wrote:
> Currently, bond_arp_send_all() is aware only of vlans, which breaks
> configurations like bond <- bridge (or any other 'upper' device) with IP
> (which is quite a common scenario for virt setups).
>
> To fix this we convert the bond_arp_send_all() to first verify if the rt
> device is the bond itself, and if not - to go through its list of upper
> devices to see if any of them match the route device for the target. If the
> match is a vlan device - we also save its vlan_id and tag it in
> bond_arp_send().
>
> Also, clean the function a bit to be more readable.
>
> v1: use netdev_for_each_upper_dev()
> v2: use netdev_for_each_upper_dev_rcu()
> v3: no change
>
> CC: Jay Vosburgh <fubar@us.ibm.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
> ---
> drivers/net/bonding/bond_main.c | 84 ++++++++++++++------------------------
> 1 files changed, 31 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 7407e65..5f38188 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -2444,30 +2444,16 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_
>
> static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
> {
> - int i, vlan_id;
> - __be32 *targets = bond->params.arp_targets;
> - struct vlan_entry *vlan;
> - struct net_device *vlan_dev = NULL;
> + struct net_device *upper;
> + struct list_head *iter;
> struct rtable *rt;
> + __be32 *targets = bond->params.arp_targets, addr;
> + int i, vlan_id;
>
> - for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
> - __be32 addr;
> - if (!targets[i])
> - break;
> + for (i = 0; i < BOND_MAX_ARP_TARGETS && targets[i]; i++) {
> pr_debug("basa: target %pI4\n", &targets[i]);
> - if (!bond_vlan_used(bond)) {
> - pr_debug("basa: empty vlan: arp_send\n");
> - addr = bond_confirm_addr(bond->dev, targets[i], 0);
> - bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
> - addr, 0);
> - continue;
> - }
>
> - /*
> - * If VLANs are configured, we do a route lookup to
> - * determine which VLAN interface would be used, so we
> - * can tag the ARP with the proper VLAN tag.
> - */
> + /* Find out through which dev should the packet go */
> rt = ip_route_output(dev_net(bond->dev), targets[i], 0,
> RTO_ONLINK, 0);
> if (IS_ERR(rt)) {
> @@ -2478,47 +2464,39 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
> continue;
> }
>
> - /*
> - * This target is not on a VLAN
> - */
> - if (rt->dst.dev == bond->dev) {
> - ip_rt_put(rt);
> - pr_debug("basa: rtdev == bond->dev: arp_send\n");
> - addr = bond_confirm_addr(bond->dev, targets[i], 0);
> - bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
> - addr, 0);
> - continue;
> - }
> -
> vlan_id = 0;
> - list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
> - rcu_read_lock();
> - vlan_dev = __vlan_find_dev_deep(bond->dev,
> - htons(ETH_P_8021Q),
> - vlan->vlan_id);
> - rcu_read_unlock();
> - if (vlan_dev == rt->dst.dev) {
> - vlan_id = vlan->vlan_id;
> - pr_debug("basa: vlan match on %s %d\n",
> - vlan_dev->name, vlan_id);
> - break;
> - }
> - }
>
> - if (vlan_id && vlan_dev) {
> - ip_rt_put(rt);
> - addr = bond_confirm_addr(vlan_dev, targets[i], 0);
> - bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
> - addr, vlan_id);
> - continue;
> + /* bond device itself */
> + if (rt->dst.dev == bond->dev)
> + goto found;
> +
> + /* search for upper device, like vlan/bridge/team/etc */
> + rcu_read_lock();
> + netdev_for_each_upper_dev_rcu(bond->dev, upper, iter) {
> + if (upper == rt->dst.dev) {
> + /* if it's a vlan - get its VID */
> + if (is_vlan_dev(rt->dst.dev))
> + vlan_id = vlan_dev_vlan_id(rt->dst.dev);
> +
> + rcu_read_unlock();
> + goto found;
> + }
How does this work in the following config:
eth0,eth1 <--- bond <--- vlans 1,2,3 <---- bridge (ip address)
-vlad
> }
> + rcu_read_unlock();
>
> - if (net_ratelimit()) {
> + /* Not our device - skip */
> + if (net_ratelimit())
> pr_warning("%s: no path to arp_ip_target %pI4 via rt.dev %s\n",
> bond->dev->name, &targets[i],
> rt->dst.dev ? rt->dst.dev->name : "NULL");
> - }
> ip_rt_put(rt);
> + continue;
> +
> +found:
> + addr = bond_confirm_addr(rt->dst.dev, targets[i], 0);
> + ip_rt_put(rt);
> + bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
> + addr, vlan_id);
> }
> }
>
>
^ permalink raw reply
* Re: [PATCH net-next] qdisc: allow setting default queuing discipline
From: Eric Dumazet @ 2013-08-28 17:20 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20130828091836.5c8285f4@nehalam.linuxnetplumber.net>
On Wed, 2013-08-28 at 09:18 -0700, Stephen Hemminger wrote:
> Although your idea adds completeness, not sure if it is worth it.
> The thing is if user is using HTB, they already are using tc
> commands to set it up, therefore the additional script steps to choose some
> other qdisc for the leaf nodes doesn't seem like a burden.
> Therefore the sysctl doesn't help much and might even create more
> confusion because there is now two places to update.
Well, I need such a facility because I cannot change HTB setup.
I can boot a new kernel, yet not really change user scripts, especially
when tc setup is actually not a script, but a complex binary doing
constant changes in a complex and dynamic HTB hierarchy.
^ permalink raw reply
* Re: [PATCH net-next v3 07/13] bonding: make bond_arp_send_all use upper device list
From: Veaceslav Falico @ 2013-08-28 17:23 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: netdev, Jay Vosburgh, Andy Gospodarek
In-Reply-To: <521E2932.6060307@redhat.com>
On Wed, Aug 28, 2013 at 12:45:38PM -0400, Vlad Yasevich wrote:
>On 08/28/2013 12:03 PM, Veaceslav Falico wrote:
...snip...
>>+ /* search for upper device, like vlan/bridge/team/etc */
>>+ rcu_read_lock();
>>+ netdev_for_each_upper_dev_rcu(bond->dev, upper, iter) {
>>+ if (upper == rt->dst.dev) {
>>+ /* if it's a vlan - get its VID */
>>+ if (is_vlan_dev(rt->dst.dev))
>>+ vlan_id = vlan_dev_vlan_id(rt->dst.dev);
>>+
>>+ rcu_read_unlock();
>>+ goto found;
>>+ }
>
>How does this work in the following config:
> eth0,eth1 <--- bond <--- vlans 1,2,3 <---- bridge (ip address)
Great catch, it won't work. I'm not sure if the old code does work (cause
bond->dev already has vlans on top of it, so it has the ->vlan_info, and
thus __vlan_find_dev_deep() won't go recursive, but rather check the
bond->dev for the ip address, though I might be wrong), but I'll try to
take a look at the new code to make it work.
First what comes to mind (untested, not compiled):
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 47e1052..36d6899 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2323,7 +2323,7 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_
static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
{
- struct net_device *upper;
+ struct net_device *upper, *real_dev;
struct list_head *iter;
struct rtable *rt;
__be32 *targets = bond->params.arp_targets, addr;
@@ -2350,6 +2350,16 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
/* search for upper device, like vlan/bridge/team/etc */
rcu_read_lock();
netdev_for_each_upper_dev_rcu(bond->dev, upper, iter) {
+ if (is_vlan_dev(upper)) {
+ real_dev = __vlan_find_dev_deep(netdev_master_upper_dev_get_rcu(upper),
+ htons(ETH_P_8021Q),
+ vlan_dev_vlan_id(upper));
+ if (real_dev == rt->dst.dev){
+ vlan_id = vlan_dev_vlan_id(upper);
+ upper = real_dev;
+ }
+ }
+
if (upper == rt->dst.dev) {
/* if it's a vlan - get its VID */
if (is_vlan_dev(rt->dst.dev))
>
>-vlad
^ permalink raw reply related
* Re: [PATCH net-next] qdisc: allow setting default queuing discipline
From: Stephen Hemminger @ 2013-08-28 17:28 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1377710453.8277.11.camel@edumazet-glaptop>
On Wed, 28 Aug 2013 10:20:53 -0700
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2013-08-28 at 09:18 -0700, Stephen Hemminger wrote:
>
> > Although your idea adds completeness, not sure if it is worth it.
> > The thing is if user is using HTB, they already are using tc
> > commands to set it up, therefore the additional script steps to choose some
> > other qdisc for the leaf nodes doesn't seem like a burden.
> > Therefore the sysctl doesn't help much and might even create more
> > confusion because there is now two places to update.
>
> Well, I need such a facility because I cannot change HTB setup.
>
> I can boot a new kernel, yet not really change user scripts, especially
> when tc setup is actually not a script, but a complex binary doing
> constant changes in a complex and dynamic HTB hierarchy.
>
>
>
Hate to say it but maybe module parameter to htb would be an alternative
if you have to deal with that.
^ permalink raw reply
* Re: [PATCH net-next v10 11/11] ipv6: Add generic UDP Tunnel segmentation
From: Pravin Shelar @ 2013-08-28 17:55 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, David S. Miller, Jesse Gross, Stephen Hemminger
In-Reply-To: <1377667379-2315-12-git-send-email-amwang@redhat.com>
On Tue, Aug 27, 2013 at 10:22 PM, Cong Wang <amwang@redhat.com> wrote:
> From: Cong Wang <amwang@redhat.com>
>
> Similar to commit 731362674580cb0c696cd1b1a03d8461a10cf90a
> (tunneling: Add generic Tunnel segmentation)
>
Can we factor out ipv4-udp-tunnel code so that there is no duplicating code?
^ permalink raw reply
* Re: [PATCH net-next v3 07/13] bonding: make bond_arp_send_all use upper device list
From: Veaceslav Falico @ 2013-08-28 18:11 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: netdev, Jay Vosburgh, Andy Gospodarek
In-Reply-To: <20130828172335.GM1992@redhat.com>
On Wed, Aug 28, 2013 at 07:23:35PM +0200, Veaceslav Falico wrote:
>On Wed, Aug 28, 2013 at 12:45:38PM -0400, Vlad Yasevich wrote:
>>On 08/28/2013 12:03 PM, Veaceslav Falico wrote:
>...snip...
>>>+ /* search for upper device, like vlan/bridge/team/etc */
>>>+ rcu_read_lock();
>>>+ netdev_for_each_upper_dev_rcu(bond->dev, upper, iter) {
>>>+ if (upper == rt->dst.dev) {
>>>+ /* if it's a vlan - get its VID */
>>>+ if (is_vlan_dev(rt->dst.dev))
>>>+ vlan_id = vlan_dev_vlan_id(rt->dst.dev);
>>>+
>>>+ rcu_read_unlock();
>>>+ goto found;
>>>+ }
>>
>>How does this work in the following config:
>> eth0,eth1 <--- bond <--- vlans 1,2,3 <---- bridge (ip address)
>
>Great catch, it won't work. I'm not sure if the old code does work (cause
>bond->dev already has vlans on top of it, so it has the ->vlan_info, and
>thus __vlan_find_dev_deep() won't go recursive, but rather check the
>bond->dev for the ip address, though I might be wrong), but I'll try to
>take a look at the new code to make it work.
>
>First what comes to mind (untested, not compiled):
(sorry for the spam - I've sent the mail from android and because it still
can't send anything but html email it bounced from netdev list)
actually, we should just go through the upper list
twice - first looking at all upper vlan's master devices
via __vlan_find_dev_deep(), and if found - get the tag,
and then loop through all devices.
i'll test it and send the next version, if nothing else
comes up.
thanks for the catch and the review.
^ permalink raw reply
* [PATCH net-next 1/1] net: neighbour: Simplify ifdefs around neigh_app_ns()
From: Tim Gardner @ 2013-08-28 18:24 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Tim Gardner, David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, Eric W. Biederman, Gao feng,
Joe Perches
Drop a couple of ifdef/endif pairs by moving the ifdef
surrounding neigh_app_ns() to the interior of neigh_app_ns().
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
This is an admittedly trivial change. I stumbled on it while trying to figure
out why Ubuntu doesn't have CONFIG_ARPD enabled.
net/core/neighbour.c | 4 ++--
net/ipv4/arp.c | 2 --
net/ipv6/ndisc.c | 2 --
3 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 60533db..049dd9e 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2759,13 +2759,13 @@ errout:
rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
}
-#ifdef CONFIG_ARPD
void neigh_app_ns(struct neighbour *n)
{
+#ifdef CONFIG_ARPD
__neigh_notify(n, RTM_GETNEIGH, NLM_F_REQUEST);
+#endif /* CONFIG_ARPD */
}
EXPORT_SYMBOL(neigh_app_ns);
-#endif /* CONFIG_ARPD */
#ifdef CONFIG_SYSCTL
static int zero;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 4429b01..7808093 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -368,9 +368,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
} else {
probes -= neigh->parms->app_probes;
if (probes < 0) {
-#ifdef CONFIG_ARPD
neigh_app_ns(neigh);
-#endif
return;
}
}
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 04d31c2..d5693ad 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -663,9 +663,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
}
ndisc_send_ns(dev, neigh, target, target, saddr);
} else if ((probes -= neigh->parms->app_probes) < 0) {
-#ifdef CONFIG_ARPD
neigh_app_ns(neigh);
-#endif
} else {
addrconf_addr_solict_mult(target, &mcaddr);
ndisc_send_ns(dev, NULL, target, &mcaddr, saddr);
--
1.7.9.5
^ permalink raw reply related
* Re: [net-next 04/10] ixgbe: fix link test when connected to 1Gbps link partner
From: Sergei Shtylyov @ 2013-08-28 18:28 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: davem, Emil Tantilov, netdev, gospo, sassmann
In-Reply-To: <1377686028-30747-5-git-send-email-jeffrey.t.kirsher@intel.com>
Hello.
On 08/28/2013 02:33 PM, Jeff Kirsher wrote:
> From: Emil Tantilov <emil.s.tantilov@intel.com>
> This patch is a partial reverse of:
> commit dfcc4615f09c33454bc553567f7c7506cae60cb9
Please also specify that commit's summary line in parens.
> Specifically forcing the laser before the link check can lead to
> inconsistent results because it does not guarantee that the link will be
> negotiated correctly. Such is the case when dual speed SFP+ module is
> connected to a gigabit link partner.
> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 26 ++++++++----------------
> 1 file changed, 9 insertions(+), 17 deletions(-)
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> index db0dbf6..57465d8 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> @@ -1885,11 +1885,11 @@ static void ixgbe_diag_test(struct net_device *netdev,
> struct ethtool_test *eth_test, u64 *data)
> {
> struct ixgbe_adapter *adapter = netdev_priv(netdev);
> - struct ixgbe_hw *hw = &adapter->hw;
> bool if_running = netif_running(netdev);
>
> set_bit(__IXGBE_TESTING, &adapter->state);
> if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
> + struct ixgbe_hw *hw = &adapter->hw;
Empty line wouldn't here, after declaration. At least in the code above
you have it.
> if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
> int i;
> for (i = 0; i < adapter->num_vfs; i++) {
WBR, Sergei
^ permalink raw reply
* Re: [PATCH net-next 1/1] net: neighbour: Simplify ifdefs around neigh_app_ns()
From: Joe Perches @ 2013-08-28 18:51 UTC (permalink / raw)
To: Tim Gardner
Cc: netdev, linux-kernel, David S. Miller, Alexey Kuznetsov,
James Morris, Hideaki YOSHIFUJI, Patrick McHardy,
Eric W. Biederman, Gao feng
In-Reply-To: <1377714286-51816-1-git-send-email-tim.gardner@canonical.com>
On Wed, 2013-08-28 at 12:24 -0600, Tim Gardner wrote:
> Drop a couple of ifdef/endif pairs by moving the ifdef
> surrounding neigh_app_ns() to the interior of neigh_app_ns().
[]
> This is an admittedly trivial change. I stumbled on it while trying to figure
> out why Ubuntu doesn't have CONFIG_ARPD enabled.
I'd be more inclined to make neigh_app_ns static inline
in the .h file and remove the EXPORT_SYMBOL
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index 60533db..049dd9e 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -2759,13 +2759,13 @@ errout:
> rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
> }
>
> -#ifdef CONFIG_ARPD
> void neigh_app_ns(struct neighbour *n)
> {
> +#ifdef CONFIG_ARPD
> __neigh_notify(n, RTM_GETNEIGH, NLM_F_REQUEST);
> +#endif /* CONFIG_ARPD */
> }
> EXPORT_SYMBOL(neigh_app_ns);
> -#endif /* CONFIG_ARPD */
>
> #ifdef CONFIG_SYSCTL
> static int zero;
> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index 4429b01..7808093 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c
> @@ -368,9 +368,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
> } else {
> probes -= neigh->parms->app_probes;
> if (probes < 0) {
> -#ifdef CONFIG_ARPD
> neigh_app_ns(neigh);
> -#endif
> return;
> }
> }
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index 04d31c2..d5693ad 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -663,9 +663,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
> }
> ndisc_send_ns(dev, neigh, target, target, saddr);
> } else if ((probes -= neigh->parms->app_probes) < 0) {
> -#ifdef CONFIG_ARPD
> neigh_app_ns(neigh);
> -#endif
> } else {
> addrconf_addr_solict_mult(target, &mcaddr);
> ndisc_send_ns(dev, NULL, target, &mcaddr, saddr);
^ permalink raw reply
* RE: [patch net-next v6 4/4] igb/igbvf: implement ndo_get_phys_port_id
From: Brown, Aaron F @ 2013-08-28 19:06 UTC (permalink / raw)
To: Jiri Pirko
Cc: Kirsher, Jeffrey T, netdev@vger.kernel.org, davem@davemloft.net,
stephen@networkplumber.org, Narendra_K@Dell.com,
bhutchings@solarflare.com, or.gerlitz@gmail.com, Wyborny, Carolyn,
Rose, Gregory V, vyasevic@redhat.com, amwang@redhat.com,
johannes@sipsolutions.net
In-Reply-To: <20130828060558.GA1589@minipsycho.orion>
[-- Attachment #1: Type: text/plain, Size: 6383 bytes --]
> -----Original Message-----
> From: Jiri Pirko [mailto:jiri@resnulli.us]
> Sent: Tuesday, August 27, 2013 11:06 PM
> To: Brown, Aaron F
> Cc: Kirsher, Jeffrey T; netdev@vger.kernel.org; davem@davemloft.net;
> stephen@networkplumber.org; Narendra_K@Dell.com;
> bhutchings@solarflare.com; or.gerlitz@gmail.com; Wyborny, Carolyn; Rose,
> Gregory V; vyasevic@redhat.com; amwang@redhat.com;
> johannes@sipsolutions.net
> Subject: Re: [patch net-next v6 4/4] igb/igbvf: implement
> ndo_get_phys_port_id
>
> Wed, Aug 28, 2013 at 04:26:28AM CEST, aaron.f.brown@intel.com wrote:
> >Sorry, I was out sick towards the end of last week and playing catch up
> for the last few days... Info inline.
> >
> >> From: Jiri Pirko [mailto:jiri@resnulli.us]
> >> Sent: Thursday, August 22, 2013 6:10 AM
> >> To: Kirsher, Jeffrey T
> >> Cc: Brown, Aaron F; netdev@vger.kernel.org; davem@davemloft.net;
> >> stephen@networkplumber.org; Narendra_K@Dell.com;
> >> bhutchings@solarflare.com; or.gerlitz@gmail.com; Wyborny, Carolyn;
> >> Rose, Gregory V; vyasevic@redhat.com; amwang@redhat.com;
> >> johannes@sipsolutions.net
> >> Subject: Re: [patch net-next v6 4/4] igb/igbvf: implement
> >> ndo_get_phys_port_id
> >>
> >> Thu, Aug 22, 2013 at 12:39:10PM CEST, jeffrey.t.kirsher@intel.com
> wrote:
> >> >On Mon, 2013-07-29 at 18:16 +0200, Jiri Pirko wrote:
> >> >> igb driver generated random number which will identify physical
> port.
> >> >> This id is available via ndo_get_phys_port_id directly on igb
> netdev.
> >> >> Also, id is passed to igbvf using mailbox. After that, it is
> >> >> available via ndo_get_phys_port_id on igbvf netdev as well.
> >> >>
> >> >> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> >> >> ---
> >> >> drivers/net/ethernet/intel/igb/e1000_mbx.h | 1 +
> >> >> drivers/net/ethernet/intel/igb/igb.h | 3 +++
> >> >> drivers/net/ethernet/intel/igb/igb_main.c | 37
> >> >> ++++++++++++++++++++++++++++-
> >> >> drivers/net/ethernet/intel/igbvf/igbvf.h | 4 ++++
> >> >> drivers/net/ethernet/intel/igbvf/mbx.h | 1 +
> >> >> drivers/net/ethernet/intel/igbvf/netdev.c | 38
> >> >> ++++++++++++++++++++++++++++++
> >> >> drivers/net/ethernet/intel/igbvf/vf.c | 34
> >> >> ++++++++++++++++++++++++++
> >> >> drivers/net/ethernet/intel/igbvf/vf.h | 1 +
> >> >> 8 files changed, 118 insertions(+), 1 deletion(-)
> >> >
> >> >Jiri-
> >> >
> >> >Validation ran into a couple of issues with this patch. Here is
> >> >what Aaron found when testing this patch...
> >>
> >> Interesting. So since igbvf_refresh_ppid() is called from
> >> igbvf_reset() and igbvf_probe(), I believed that is enough. Looks
> >> like perm_addr getting works in similar way. Can you please check if
> >> perm_addr is set correctly in the same time reading phys_port_id gives
> -EOPNOTSUPP?
> >
> >By perm_addr do you mean the MAC Address of the vf? Yes, it is set up
> >(and I can view it vi ip link or sysconfig) when I see the op not
> >supported message (after I fi vfs via sysfs, before bringing the vf
> >interface up or reloading igbvf.)
>
> Can you please send me dmesg log from the system you are testing this?
Attached, dmesg dump from a fresh boot to the eopnosupp. I've been using a .config with a whole bunch of debug junk in it and this is putting out tons of kobject messages, I can re-build and send something with less junk if it's pushing anything relevant off the top.
>
> Looking at the code, it looks like whenever mac.ops.reset_hw() (which sets
> up mac) is called, igbvf_refresh_ppid() is called as well.
>
> Thanks
>
> >
> >>
> >>
> >> >
> >> >Aaron Brown wrote:
> >> >I think I have to fail this, it seems to have an issue with
> >> >initialization. When I first create a vf via sysfs the pys_port_id
> >> >file is created along with the other sysfs files for the vf, however
> >> >an attempt to cat out the value returns " Operation not supported".
> >> >At this point the vf is still down, if I bring it up (or simply
> >> >unload / reload the igbvf driver) I can then cat the file
> >> >successfully and the vf interface phys_port_id matches the
> >> >phys_port_id of the pf. This is testing from bare metal, a console
> >> >session showing this behavior
> >> >follows:
> >> >
> >> >u1304:[0]/sys> find . -iname phys_port_id
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:00.0/net/eth0/phys_port_id
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:00.1/net/eth1/phys_port_id
> >> >./devices/virtual/net/sit0/phys_port_id
> >> >./devices/virtual/net/lo/phys_port_id
> >> >u1304:[0]/sys> cat
> >> >devices/pci0000:00/0000:00:01.0/0000:07:00.0/net/eth0/phys_port_id
> >> >5ece9fbd9cd51546982e15c1f2c11e25
> >> >u1304:[0]/sys>
> >> >
> >> >So far so good, now make a few vfs and check for new phys_port_id
> >> >sysfs
> >> files.
> >> >
> >> >u1304:[0]/sys> find . -iname sriov_numvfs
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:00.0/sriov_numvfs
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:00.1/sriov_numvfs
> >> >u1304:[0]/sys> echo 2 >
> >> devices/pci0000:00/0000:00:01.0/0000:07:00.0/sriov_numvfs
> >> >u1304:[0]/sys> find . -iname phys_port_id
> >> ./devices/pci0000:00/0000:00:01.0/0000:07:00.0/net/eth0/phys_port_id
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:00.1/net/eth1/phys_port_id
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:10.0/net/eth2/phys_port_id
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:10.2/net/eth3/phys_port_id
> >> >./devices/virtual/net/sit0/phys_port_id
> >> >./devices/virtual/net/lo/phys_port_id
> >> >u1304:[0]/sys>
> >> >
> >> >The first vf is eth2, attempt to cat out it's phys_port_id
> >> >
> >> >u1304:[0]/sys> cat
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:10.0/net/eth2/phys_port_id
> >> >cat:
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:10.0/net/eth2/phys_port_id:
> >> >Operation not supported u1304:[0]/sys>
> >> >
> >> >But, if I bring the interface up (or unload / load the igbvf driver)
> >> >I
> >> then am able to cat the phys_port_id of the vf and it matches the
> >> phys_port_id of the physical interface.
> >> >
> >> >u1304:[0]/sys> ifconfig eth2 u1304-2 u1304:[0]/sys> cat
> >> >./devices/pci0000:00/0000:00:01.0/0000:07:10.0/net/eth2/phys_port_id
> >> >5ece9fbd9cd51546982e15c1f2c11e25
> >> >u1304:[0]/sys>
> >>
> >
[-- Attachment #2: phys_port_id_eopnosupp_dmesg_from_boot.tgz --]
[-- Type: application/x-compressed, Size: 29823 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 1/1] net: neighbour: Simplify ifdefs around neigh_app_ns()
From: Tim Gardner @ 2013-08-28 19:09 UTC (permalink / raw)
To: Joe Perches
Cc: netdev, linux-kernel, David S. Miller, Alexey Kuznetsov,
James Morris, Hideaki YOSHIFUJI, Patrick McHardy,
Eric W. Biederman, Gao feng
In-Reply-To: <1377715873.1928.47.camel@joe-AO722>
On 08/28/2013 12:51 PM, Joe Perches wrote:
> On Wed, 2013-08-28 at 12:24 -0600, Tim Gardner wrote:
>> Drop a couple of ifdef/endif pairs by moving the ifdef
>> surrounding neigh_app_ns() to the interior of neigh_app_ns().
> []
>> This is an admittedly trivial change. I stumbled on it while trying to figure
>> out why Ubuntu doesn't have CONFIG_ARPD enabled.
>
> I'd be more inclined to make neigh_app_ns static inline
> in the .h file and remove the EXPORT_SYMBOL
>
I thought about that as well, but then you'd have to extern
__neigh_notify(), which is currently a static function and large enough
to not really be suitable for inlining. Seems like unnecessary churn to me.
rtg
--
Tim Gardner tim.gardner@canonical.com
^ permalink raw reply
* Re: [net-next 1/2] vxlan: Notify drivers for listening UDP port changes
From: John Fastabend @ 2013-08-28 19:34 UTC (permalink / raw)
To: Jeff Kirsher
Cc: davem, Joseph Gasparakis, netdev, gospo, sassmann,
Stephen Hemminger
In-Reply-To: <1377665218-6760-1-git-send-email-jeffrey.t.kirsher@intel.com>
On 8/27/2013 9:46 PM, Jeff Kirsher wrote:
> From: Joseph Gasparakis <joseph.gasparakis@intel.com>
>
> This patch adds two more ndo ops: ndo_add_rx_vxlan_port() and
> ndo_del_rx_vxlan_port().
>
> Drivers can get notifications through the above functions about changes
> of the UDP listening port of VXLAN. Also, when physical ports come up,
> now they can call vxlan_get_rx_port() in order to obtain the port number(s)
> of the existing VXLAN interface in case they already up before them.
>
> This information about the listening UDP port would be used for VXLAN
> related offloads.
[...]
> /* Add new entry to forwarding table -- assumes lock held */
> static int vxlan_fdb_create(struct vxlan_dev *vxlan,
> const u8 *mac, __be32 ip,
> @@ -797,13 +823,15 @@ static void vxlan_sock_hold(struct vxlan_sock *vs)
>
> void vxlan_sock_release(struct vxlan_sock *vs)
> {
> - struct vxlan_net *vn = net_generic(sock_net(vs->sock->sk), vxlan_net_id);
> + struct net *net = sock_net(vs->sock->sk);
> + struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>
> if (!atomic_dec_and_test(&vs->refcnt))
> return;
>
> spin_lock(&vn->sock_lock);
> hlist_del_rcu(&vs->hlist);
> + vxlan_notify_del_rx_port(net, inet_sk(vs->sock->sk)->inet_sport);
> spin_unlock(&vn->sock_lock);
Both the del and add port are protected by sock_lock serializing the
operations.
>
> queue_work(vxlan_wq, &vs->del_work);
> @@ -1543,6 +1571,28 @@ static struct device_type vxlan_type = {
> .name = "vxlan",
> };
>
> +/* Calls the ndo_add_vxlan_port of the caller in order to
> + * supply the listening VXLAN udp ports.
> + */
> +void vxlan_get_rx_port(struct net_device *dev)
> +{
> + struct vxlan_sock *vs;
> + struct net *net = dev_net(dev);
> + u16 port;
> + int i;
> +
> + if (!dev || !dev->netdev_ops || !dev->netdev_ops->ndo_add_vxlan_port)
> + return;
> +
> + for (i = 0; i < PORT_HASH_SIZE; ++i) {
> + hlist_for_each_entry_rcu(vs, vs_head(net, i), hlist) {
> + port = htons(inet_sk(vs->sock->sk)->inet_sport);
> + dev->netdev_ops->ndo_add_vxlan_port(dev, port);
However this list walk occurs without the sock_lock. Looks like you
could delete a port and then subsequently add it here if you had really
"good" timing.
Then it would be deleted from the vxlan list but pushed into hardware.
Probably not a terrible scenario but it would waste hardware resources.
I suspect you want to lock this list traversal with the sock_lock as
well.
> + }
> + }
> +}
> +EXPORT_SYMBOL_GPL(vxlan_get_rx_port);
^ permalink raw reply
* [gcv v3 04/35] net: Replace __get_cpu_var uses
From: Christoph Lameter @ 2013-08-28 19:48 UTC (permalink / raw)
To: Tejun Heo
Cc: akpm, David S. Miller, netdev, linux-arch, Steven Rostedt,
linux-kernel
In-Reply-To: <20130828193457.140443630@linux.com>
__get_cpu_var() is used for multiple purposes in the kernel source. One of them is
address calculation via the form &__get_cpu_var(x). This calculates the address for
the instance of the percpu variable of the current processor based on an offset.
Other use cases are for storing and retrieving data from the current processors percpu area.
__get_cpu_var() can be used as an lvalue when writing data or on the right side of an assignment.
__get_cpu_var() is defined as :
#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
__get_cpu_var() always only does an address determination. However, store and retrieve operations
could use a segment prefix (or global register on other platforms) to avoid the address calculation.
this_cpu_write() and this_cpu_read() can directly take an offset into a percpu area and use
optimized assembly code to read and write per cpu variables.
This patch converts __get_cpu_var into either an explicit address calculation using this_cpu_ptr()
or into a use of this_cpu operations that use the offset. Thereby address calcualtions are avoided
and less registers are used when code is generated.
At the end of the patchset all uses of __get_cpu_var have been removed so the macro is removed too.
The patchset includes passes over all arches as well. Once these operations are used throughout then
specialized macros can be defined in non -x86 arches as well in order to optimize per cpu access by
f.e. using a global register that may be set to the per cpu base.
Transformations done to __get_cpu_var()
1. Determine the address of the percpu instance of the current processor.
DEFINE_PER_CPU(int, y);
int *x = &__get_cpu_var(y);
Converts to
int *x = this_cpu_ptr(&y);
2. Same as #1 but this time an array structure is involved.
DEFINE_PER_CPU(int, y[20]);
int *x = __get_cpu_var(y);
Converts to
int *x = this_cpu_ptr(y);
3. Retrieve the content of the current processors instance of a per cpu variable.
DEFINE_PER_CPU(int, u);
int x = __get_cpu_var(y)
Converts to
int x = __this_cpu_read(y);
4. Retrieve the content of a percpu struct
DEFINE_PER_CPU(struct mystruct, y);
struct mystruct x = __get_cpu_var(y);
Converts to
memcpy(this_cpu_ptr(&x), y, sizeof(x));
5. Assignment to a per cpu variable
DEFINE_PER_CPU(int, y)
__get_cpu_var(y) = x;
Converts to
this_cpu_write(y, x);
6. Increment/Decrement etc of a per cpu variable
DEFINE_PER_CPU(int, y);
__get_cpu_var(y)++
Converts to
this_cpu_inc(y)
Signed-off-by: Christoph Lameter <cl@linux.com>
Index: linux/net/core/dev.c
===================================================================
--- linux.orig/net/core/dev.c 2013-08-26 14:16:59.000000000 -0500
+++ linux/net/core/dev.c 2013-08-26 14:18:37.214005168 -0500
@@ -2129,7 +2129,7 @@ static inline void __netif_reschedule(st
unsigned long flags;
local_irq_save(flags);
- sd = &__get_cpu_var(softnet_data);
+ sd = this_cpu_ptr(&softnet_data);
q->next_sched = NULL;
*sd->output_queue_tailp = q;
sd->output_queue_tailp = &q->next_sched;
@@ -2151,7 +2151,7 @@ void dev_kfree_skb_irq(struct sk_buff *s
unsigned long flags;
local_irq_save(flags);
- sd = &__get_cpu_var(softnet_data);
+ sd = this_cpu_ptr(&softnet_data);
skb->next = sd->completion_queue;
sd->completion_queue = skb;
raise_softirq_irqoff(NET_TX_SOFTIRQ);
@@ -3111,7 +3111,7 @@ static void rps_trigger_softirq(void *da
static int rps_ipi_queued(struct softnet_data *sd)
{
#ifdef CONFIG_RPS
- struct softnet_data *mysd = &__get_cpu_var(softnet_data);
+ struct softnet_data *mysd = this_cpu_ptr(&softnet_data);
if (sd != mysd) {
sd->rps_ipi_next = mysd->rps_ipi_list;
@@ -3138,7 +3138,7 @@ static bool skb_flow_limit(struct sk_buf
if (qlen < (netdev_max_backlog >> 1))
return false;
- sd = &__get_cpu_var(softnet_data);
+ sd = this_cpu_ptr(&softnet_data);
rcu_read_lock();
fl = rcu_dereference(sd->flow_limit);
@@ -3280,7 +3280,7 @@ EXPORT_SYMBOL(netif_rx_ni);
static void net_tx_action(struct softirq_action *h)
{
- struct softnet_data *sd = &__get_cpu_var(softnet_data);
+ struct softnet_data *sd = this_cpu_ptr(&softnet_data);
if (sd->completion_queue) {
struct sk_buff *clist;
@@ -3700,7 +3700,7 @@ EXPORT_SYMBOL(netif_receive_skb);
static void flush_backlog(void *arg)
{
struct net_device *dev = arg;
- struct softnet_data *sd = &__get_cpu_var(softnet_data);
+ struct softnet_data *sd = this_cpu_ptr(&softnet_data);
struct sk_buff *skb, *tmp;
rps_lock(sd);
@@ -4146,7 +4146,7 @@ void __napi_schedule(struct napi_struct
unsigned long flags;
local_irq_save(flags);
- ____napi_schedule(&__get_cpu_var(softnet_data), n);
+ ____napi_schedule(this_cpu_ptr(&softnet_data), n);
local_irq_restore(flags);
}
EXPORT_SYMBOL(__napi_schedule);
@@ -4274,7 +4274,7 @@ EXPORT_SYMBOL(netif_napi_del);
static void net_rx_action(struct softirq_action *h)
{
- struct softnet_data *sd = &__get_cpu_var(softnet_data);
+ struct softnet_data *sd = this_cpu_ptr(&softnet_data);
unsigned long time_limit = jiffies + 2;
int budget = netdev_budget;
void *have;
Index: linux/net/core/drop_monitor.c
===================================================================
--- linux.orig/net/core/drop_monitor.c 2013-08-26 14:16:59.000000000 -0500
+++ linux/net/core/drop_monitor.c 2013-08-26 14:18:37.218005126 -0500
@@ -142,7 +142,7 @@ static void trace_drop_common(struct sk_
unsigned long flags;
local_irq_save(flags);
- data = &__get_cpu_var(dm_cpu_data);
+ data = this_cpu_ptr(&dm_cpu_data);
spin_lock(&data->lock);
dskb = data->skb;
Index: linux/net/core/skbuff.c
===================================================================
--- linux.orig/net/core/skbuff.c 2013-08-26 14:16:59.000000000 -0500
+++ linux/net/core/skbuff.c 2013-08-26 14:18:37.218005126 -0500
@@ -371,7 +371,7 @@ static void *__netdev_alloc_frag(unsigne
unsigned long flags;
local_irq_save(flags);
- nc = &__get_cpu_var(netdev_alloc_cache);
+ nc = this_cpu_ptr(&netdev_alloc_cache);
if (unlikely(!nc->frag.page)) {
refill:
for (order = NETDEV_FRAG_PAGE_MAX_ORDER; ;) {
Index: linux/net/ipv4/syncookies.c
===================================================================
--- linux.orig/net/ipv4/syncookies.c 2013-08-26 14:16:59.000000000 -0500
+++ linux/net/ipv4/syncookies.c 2013-08-26 14:18:37.210005210 -0500
@@ -44,7 +44,7 @@ static DEFINE_PER_CPU(__u32 [16 + 5 + SH
static u32 cookie_hash(__be32 saddr, __be32 daddr, __be16 sport, __be16 dport,
u32 count, int c)
{
- __u32 *tmp = __get_cpu_var(ipv4_cookie_scratch);
+ __u32 *tmp = this_cpu_ptr(ipv4_cookie_scratch);
memcpy(tmp + 4, syncookie_secret[c], sizeof(syncookie_secret[c]));
tmp[0] = (__force u32)saddr;
Index: linux/net/ipv4/tcp_output.c
===================================================================
--- linux.orig/net/ipv4/tcp_output.c 2013-08-26 14:16:59.000000000 -0500
+++ linux/net/ipv4/tcp_output.c 2013-08-26 14:18:37.218005126 -0500
@@ -810,7 +810,7 @@ void tcp_wfree(struct sk_buff *skb)
/* queue this socket to tasklet queue */
local_irq_save(flags);
- tsq = &__get_cpu_var(tsq_tasklet);
+ tsq = this_cpu_ptr(&tsq_tasklet);
list_add(&tp->tsq_node, &tsq->head);
tasklet_schedule(&tsq->tasklet);
local_irq_restore(flags);
Index: linux/net/ipv6/syncookies.c
===================================================================
--- linux.orig/net/ipv6/syncookies.c 2013-08-26 14:16:59.000000000 -0500
+++ linux/net/ipv6/syncookies.c 2013-08-26 14:18:37.214005168 -0500
@@ -66,7 +66,7 @@ static DEFINE_PER_CPU(__u32 [16 + 5 + SH
static u32 cookie_hash(const struct in6_addr *saddr, const struct in6_addr *daddr,
__be16 sport, __be16 dport, u32 count, int c)
{
- __u32 *tmp = __get_cpu_var(ipv6_cookie_scratch);
+ __u32 *tmp = this_cpu_ptr(ipv6_cookie_scratch);
/*
* we have 320 bits of information to hash, copy in the remaining
Index: linux/net/rds/ib_rdma.c
===================================================================
--- linux.orig/net/rds/ib_rdma.c 2013-08-26 14:16:59.000000000 -0500
+++ linux/net/rds/ib_rdma.c 2013-08-26 14:18:37.218005126 -0500
@@ -267,7 +267,7 @@ static inline struct rds_ib_mr *rds_ib_r
unsigned long *flag;
preempt_disable();
- flag = &__get_cpu_var(clean_list_grace);
+ flag = this_cpu_ptr(&clean_list_grace);
set_bit(CLEAN_LIST_BUSY_BIT, flag);
ret = llist_del_first(&pool->clean_list);
if (ret)
Index: linux/include/net/netfilter/nf_conntrack.h
===================================================================
--- linux.orig/include/net/netfilter/nf_conntrack.h 2013-08-26 14:23:46.000000000 -0500
+++ linux/include/net/netfilter/nf_conntrack.h 2013-08-26 14:24:17.190395755 -0500
@@ -243,7 +243,7 @@ extern s16 (*nf_ct_nat_offset)(const str
DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked);
static inline struct nf_conn *nf_ct_untracked_get(void)
{
- return &__raw_get_cpu_var(nf_conntrack_untracked);
+ return __this_cpu_ptr(&nf_conntrack_untracked);
}
extern void nf_ct_untracked_status_or(unsigned long bits);
^ permalink raw reply
* [PATCH net-next 0/3] pf_packet updates
From: Daniel Borkmann @ 2013-08-28 20:13 UTC (permalink / raw)
To: davem; +Cc: netdev
Daniel Borkmann (3):
net: packet: add random fanout scheduler
net: packet: use reciprocal_divide in fanout_demux_hash
net: packet: document available fanout policies
Documentation/networking/packet_mmap.txt | 8 ++++++++
include/uapi/linux/if_packet.h | 1 +
net/packet/af_packet.c | 15 +++++++++++++--
3 files changed, 22 insertions(+), 2 deletions(-)
--
1.7.11.7
^ permalink raw reply
* [PATCH net-next 1/3] net: packet: add randomized fanout scheduler
From: Daniel Borkmann @ 2013-08-28 20:13 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1377720791-15844-1-git-send-email-dborkman@redhat.com>
We currently allow for different fanout scheduling policies in pf_packet
such as scheduling by skb's rxhash, round-robin, by cpu, and rollover.
Also allow for a random, equidistributed selection of the socket from the
fanout process group.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
include/uapi/linux/if_packet.h | 1 +
net/packet/af_packet.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h
index b950c02..dbf0666 100644
--- a/include/uapi/linux/if_packet.h
+++ b/include/uapi/linux/if_packet.h
@@ -56,6 +56,7 @@ struct sockaddr_ll {
#define PACKET_FANOUT_LB 1
#define PACKET_FANOUT_CPU 2
#define PACKET_FANOUT_ROLLOVER 3
+#define PACKET_FANOUT_RND 4
#define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
#define PACKET_FANOUT_FLAG_DEFRAG 0x8000
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 6c53dd9..91596f5 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -88,7 +88,7 @@
#include <linux/virtio_net.h>
#include <linux/errqueue.h>
#include <linux/net_tstamp.h>
-
+#include <linux/reciprocal_div.h>
#ifdef CONFIG_INET
#include <net/inet_common.h>
#endif
@@ -1158,6 +1158,13 @@ static unsigned int fanout_demux_cpu(struct packet_fanout *f,
return smp_processor_id() % num;
}
+static unsigned int fanout_demux_rnd(struct packet_fanout *f,
+ struct sk_buff *skb,
+ unsigned int num)
+{
+ return reciprocal_divide(prandom_u32(), num);
+}
+
static unsigned int fanout_demux_rollover(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int idx, unsigned int skip,
@@ -1215,6 +1222,9 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev,
case PACKET_FANOUT_CPU:
idx = fanout_demux_cpu(f, skb, num);
break;
+ case PACKET_FANOUT_RND:
+ idx = fanout_demux_rnd(f, skb, num);
+ break;
case PACKET_FANOUT_ROLLOVER:
idx = fanout_demux_rollover(f, skb, 0, (unsigned int) -1, num);
break;
@@ -1284,6 +1294,7 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
case PACKET_FANOUT_HASH:
case PACKET_FANOUT_LB:
case PACKET_FANOUT_CPU:
+ case PACKET_FANOUT_RND:
break;
default:
return -EINVAL;
--
1.7.11.7
^ permalink raw reply related
* [PATCH net-next 2/3] net: packet: use reciprocal_divide in fanout_demux_hash
From: Daniel Borkmann @ 2013-08-28 20:13 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1377720791-15844-1-git-send-email-dborkman@redhat.com>
Instead of hard-coding reciprocal_divide function, use the inline
function from reciprocal_div.h.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
net/packet/af_packet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 91596f5..130e2ea 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1135,7 +1135,7 @@ static unsigned int fanout_demux_hash(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int num)
{
- return (((u64)skb->rxhash) * num) >> 32;
+ return reciprocal_divide(skb->rxhash, num);
}
static unsigned int fanout_demux_lb(struct packet_fanout *f,
--
1.7.11.7
^ permalink raw reply related
* [PATCH net-next 3/3] net: packet: document available fanout policies
From: Daniel Borkmann @ 2013-08-28 20:13 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1377720791-15844-1-git-send-email-dborkman@redhat.com>
Update documentation to add fanout policies that are available.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
Documentation/networking/packet_mmap.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt
index 8572796..c012236 100644
--- a/Documentation/networking/packet_mmap.txt
+++ b/Documentation/networking/packet_mmap.txt
@@ -543,6 +543,14 @@ TPACKET_V2 --> TPACKET_V3:
In the AF_PACKET fanout mode, packet reception can be load balanced among
processes. This also works in combination with mmap(2) on packet sockets.
+Currently implemented fanout policies are:
+
+ - PACKET_FANOUT_HASH: schedule to socket by skb's rxhash
+ - PACKET_FANOUT_LB: schedule to socket by round-robin
+ - PACKET_FANOUT_CPU: schedule to socket by CPU packet arrives on
+ - PACKET_FANOUT_RND: schedule to socket by random selection
+ - PACKET_FANOUT_ROLLOVER: if one socket is full, rollover to another
+
Minimal example code by David S. Miller (try things like "./test eth0 hash",
"./test eth0 lb", etc.):
--
1.7.11.7
^ permalink raw reply related
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