Netdev List
 help / color / mirror / Atom feed
* Re: bridge igmp snooping implementation
From: Lin Ming @ 2012-09-25 15:12 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: netdev, Herbert Xu
In-Reply-To: <506184ED.5040104@openwrt.org>

On Tue, Sep 25, 2012 at 6:18 PM, Felix Fietkau <nbd@openwrt.org> wrote:
> Hi,
>
> I'v been looking at the bridge IGMP snooping code and I noticed that it
> appears to not keep track of multicast group member IP addresses. Is
> this intentional?
>
> It seems to me that this would lead to issues when multiple members of
> the same multicast group are behind the same bridge port, and one of
> them leaves.
>
> I'm currently looking into adding a feature that allows bridge ports to
> be configured to selectively turn multicast traffic into unicast
> traffic. For this I would need to change the code to keep track of
> member IP and MAC addresses.

Good idea. This can help to resolve my problem at:
http://marc.info/?l=linux-netdev&m=134855468803809&w=2

Thanks.

>
> This helps a lot on 802.11, where unicast is often much cheaper than
> multicast, even when sending out duplicate packets (higher data rates
> and aggregation heavily reduce airtime utilization).
>
> - Felix

^ permalink raw reply

* [PATCH net 1/2] batman-adv: Fix change mac address of soft iface.
From: Antonio Quartulli @ 2012-09-25 15:57 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1348588637-18441-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>

From: Def <def-QFKgK+z4sOrR7s880joybQ@public.gmane.org>

Into function interface_set_mac_addr, the function tt_local_add was
invoked before updating dev->dev_addr. The new MAC address was not
tagged as NoPurge.

Signed-off-by: Def <def-QFKgK+z4sOrR7s880joybQ@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
 net/batman-adv/soft-interface.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 109ea2a..21c5357 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -100,18 +100,21 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
 {
 	struct batadv_priv *bat_priv = netdev_priv(dev);
 	struct sockaddr *addr = p;
+	uint8_t old_addr[ETH_ALEN];
 
 	if (!is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;
 
+	memcpy(old_addr, dev->dev_addr, ETH_ALEN);
+	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+
 	/* only modify transtable if it has been initialized before */
 	if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) {
-		batadv_tt_local_remove(bat_priv, dev->dev_addr,
+		batadv_tt_local_remove(bat_priv, old_addr,
 				       "mac address changed", false);
 		batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX);
 	}
 
-	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
 	dev->addr_assign_type &= ~NET_ADDR_RANDOM;
 	return 0;
 }
-- 
1.7.12

^ permalink raw reply related

* pull request: batman-adv 2012-09-25
From: Antonio Quartulli @ 2012-09-25 15:57 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

Hello David,

here are two fixes (the last set) we would to propose for net/linux-3.6.

The one from Def fixes a wrong behaviour of batman-adv in case of virtual
interface mac address change, while the other from Linüs fixes a problem in the
route selection which can lead to a continuous route flapping under certain
conditions.

We would also like to enqueue both patches for sending to stable-3.5.

During merge with net/master you will hit a conflict. I'm going to send some
instructions on how to solve it.

Thank you very much,
		Antonio



The following changes since commit 2b018d57ff18e5405823e5cb59651a5b4d946d7b:

  pppoe: drop PPPOX_ZOMBIEs in pppoe_release (2012-09-22 15:49:31 -0400)

are available in the git repository at:

  git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

for you to fetch changes up to 7caf69fb9c5017df01945a1861c042f6aa08edeb:

  batman-adv: Fix symmetry check / route flapping in multi interface setups (2012-09-23 23:12:49 +0200)

----------------------------------------------------------------
Included fixes:
- fix the behaviour of batman-adv in case of virtual interface MAC change event
- fix symmetric link check in neighbour selection

----------------------------------------------------------------
Def (1):
      batman-adv: Fix change mac address of soft iface.

Linus Lüssing (1):
      batman-adv: Fix symmetry check / route flapping in multi interface setups

 net/batman-adv/bat_iv_ogm.c     | 13 +++++++------
 net/batman-adv/soft-interface.c |  7 +++++--
 2 files changed, 12 insertions(+), 8 deletions(-)

^ permalink raw reply

* [PATCH net 2/2] batman-adv: Fix symmetry check / route flapping in multi interface setups
From: Antonio Quartulli @ 2012-09-25 15:57 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Linus Lüssing, Antonio Quartulli
In-Reply-To: <1348588637-18441-1-git-send-email-ordex@autistici.org>

From: Linus Lüssing <linus.luessing@web.de>

If receiving an OGM from a neighbor other than the currently selected
and if it has the same TQ then we are supposed to switch if this
neighbor provides a more symmetric link than the currently selected one.

However this symmetry check currently is broken if the interface of the
neighbor we received the OGM from and the one of the currently selected
neighbor differ: We are currently trying to determine the symmetry of the
link towards the selected router via the link we received the OGM from
instead of just checking via the link towards the currently selected
router.

This leads to way more route switches than necessary and can lead to
permanent route flapping in many common multi interface setups.

This patch fixes this issue by using the right interface for this
symmetry check.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/bat_iv_ogm.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index e877af8..469daab 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -642,7 +642,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
 	struct batadv_neigh_node *router = NULL;
 	struct batadv_orig_node *orig_node_tmp;
 	struct hlist_node *node;
-	uint8_t bcast_own_sum_orig, bcast_own_sum_neigh;
+	int if_num;
+	uint8_t sum_orig, sum_neigh;
 	uint8_t *neigh_addr;
 
 	batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
@@ -727,17 +728,17 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
 	if (router && (neigh_node->tq_avg == router->tq_avg)) {
 		orig_node_tmp = router->orig_node;
 		spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
-		bcast_own_sum_orig =
-			orig_node_tmp->bcast_own_sum[if_incoming->if_num];
+		if_num = router->if_incoming->if_num;
+		sum_orig = orig_node_tmp->bcast_own_sum[if_num];
 		spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
 
 		orig_node_tmp = neigh_node->orig_node;
 		spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
-		bcast_own_sum_neigh =
-			orig_node_tmp->bcast_own_sum[if_incoming->if_num];
+		if_num = neigh_node->if_incoming->if_num;
+		sum_neigh = orig_node_tmp->bcast_own_sum[if_num];
 		spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
 
-		if (bcast_own_sum_orig >= bcast_own_sum_neigh)
+		if (sum_orig >= sum_neigh)
 			goto update_tt;
 	}
 
-- 
1.7.12

^ permalink raw reply related

* RE: [PATCH net-next] netxen: write IP address to firmware when using bonding
From: Rajesh Borundia @ 2012-09-25 15:59 UTC (permalink / raw)
  To: Nikolay Aleksandrov, Sony Chacko
  Cc: netdev, agospoda@redhat.com, David Miller
In-Reply-To: <1348562883-14780-1-git-send-email-nikolay@redhat.com>



>-----Original Message-----
>From: Nikolay Aleksandrov [mailto:nikolay@redhat.com]
>Sent: Tuesday, September 25, 2012 2:18 PM
>To: Sony Chacko
>Cc: netdev; agospoda@redhat.com; Rajesh Borundia; David Miller
>Subject: [PATCH net-next] netxen: write IP address to firmware when
>using bonding
>
>From: Nikolay Aleksandrov <naleksan@redhat.com>
>
>This patch allows LRO aggregation on bonded devices that contain an
>NX3031
>device. It also adds a for_each_netdev_in_bond_rcu(bond, slave) macro
>which executes for each slave that has bond as master.
>
>Signed-off-by: Andy Gospodarek <agospoda@redhat.com>
>Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
>---
> .../net/ethernet/qlogic/netxen/netxen_nic_main.c   | 113
>+++++++++++++++------
> include/linux/netdevice.h                          |   3 +
> 2 files changed, 87 insertions(+), 29 deletions(-)
>
>diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
>b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
>index e2a4858..aaf6cf7 100644
>--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
>+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
>@@ -3244,6 +3244,25 @@ netxen_restore_indev_addr(struct net_device
>*netdev, unsigned long event)
> 	}
> }
>
>+static inline int
>+netxen_config_checkdev(struct net_device *dev)
>+{
>+	struct netxen_adapter *adapter;
>+
>+	if (!is_netxen_netdev(dev))
>+		return -ENODEV;
>+
>+	adapter = netdev_priv(dev);
>+
>+	if(!adapter)
>+		return -ENODEV;

It Seems space is needed after if.
 
>+
>+	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
>+		return -ENODEV;
>+
>+	return 0;
>+}
>+
> static int netxen_netdev_event(struct notifier_block *this,
> 				 unsigned long event, void *ptr)
> {
>@@ -3260,18 +3279,27 @@ recheck:
> 		goto recheck;
> 	}
>
>-	if (!is_netxen_netdev(dev))
>-		goto done;
>-
>-	adapter = netdev_priv(dev);
>-
>-	if (!adapter)
>-		goto done;
>+	/* If this is a bonding device, look for netxen-based slaves*/
>+	if (dev->priv_flags & IFF_BONDING) {
>+		struct net_device *slave;
>
>-	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
>-		goto done;
>+		rcu_read_lock();
>+		for_each_netdev_in_bond_rcu(dev, slave) {
>+			if (netxen_config_checkdev(slave) < 0)
>+				continue;
>+
>+			adapter = netdev_priv(slave);
>+			netxen_config_indev_addr(adapter, orig_dev, event);
>+		}
>+		rcu_read_unlock();
>
>-	netxen_config_indev_addr(adapter, orig_dev, event);
>+	} else {
>+		if (netxen_config_checkdev(dev) < 0)
>+			goto done;
>+
>+		adapter = netdev_priv(dev);
>+		netxen_config_indev_addr(adapter, orig_dev, event);
>+	}
> done:
> 	return NOTIFY_DONE;
> }
>@@ -3296,30 +3324,57 @@ recheck:
> 		goto recheck;
> 	}
>
>-	if (!is_netxen_netdev(dev))
>-		goto done;
>+	/* If this is a bonding device, look for netxen-based slaves*/
>+	if (dev->priv_flags & IFF_BONDING) {
>+		struct net_device *slave;
>
>-	adapter = netdev_priv(dev);
>+		rcu_read_lock();
>+		for_each_netdev_in_bond_rcu(dev, slave) {
>+			if (netxen_config_checkdev(slave) < 0)
>+				continue;
>
>-	if (!adapter || !netxen_destip_supported(adapter))
>-		goto done;
>+			adapter = netdev_priv(slave);
>
>-	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
>-		goto done;
>+			if (!netxen_destip_supported(adapter))
>+				continue;
>
>-	switch (event) {
>-	case NETDEV_UP:
>-		netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP);
>-		netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
>-		break;
>-	case NETDEV_DOWN:
>-		netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN);
>-		netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
>-		break;
>-	default:
>-		break;
>-	}
>+			switch (event) {
>+			case NETDEV_UP:
>+				netxen_config_ipaddr(adapter, ifa->ifa_address,
>NX_IP_UP);
>+				netxen_list_config_vlan_ip(adapter, ifa,
>NX_IP_UP);
>+				break;
>+			case NETDEV_DOWN:
>+				netxen_config_ipaddr(adapter, ifa->ifa_address,
>NX_IP_DOWN);
>+				netxen_list_config_vlan_ip(adapter, ifa,
>NX_IP_DOWN);
>+				break;
>+			default:
>+				break;
>+			}
>+		}
>+		rcu_read_unlock();
>
>+	} else {
>+		if (netxen_config_checkdev(dev) < 0)
>+			goto done;
>+
>+		adapter = netdev_priv(dev);
>+
>+		if (!netxen_destip_supported(adapter))
>+			goto done;
>+
>+		switch (event) {
>+		case NETDEV_UP:
>+			netxen_config_ipaddr(adapter, ifa->ifa_address,
>NX_IP_UP);
>+			netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
>+			break;
>+		case NETDEV_DOWN:
>+			netxen_config_ipaddr(adapter, ifa->ifa_address,
>NX_IP_DOWN);
>+			netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
>+			break;
>+		default:
>+			break;
>+		}
>+	}
> done:
> 	return NOTIFY_DONE;
> }
>diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>index 59dc05f3..463bb40 100644
>--- a/include/linux/netdevice.h
>+++ b/include/linux/netdevice.h
>@@ -1578,6 +1578,9 @@ extern rwlock_t
>	dev_base_lock;		/* Device list lock */
> 		list_for_each_entry_continue(d, &(net)->dev_base_head,
>dev_list)
> #define for_each_netdev_continue_rcu(net, d)		\
> 	list_for_each_entry_continue_rcu(d, &(net)->dev_base_head,
>dev_list)
>+#define for_each_netdev_in_bond_rcu(bond, slave)	\
>+	for_each_netdev_rcu(&init_net, slave)		\
>+		if (slave->master == bond)
> #define net_device_entry(lh)	list_entry(lh, struct net_device,
>dev_list)
>
> static inline struct net_device *next_net_device(struct net_device
>*dev)
>--
>1.7.11.4
>

It seems at some places line is over 80 characters.

^ permalink raw reply

* Re: pull request: batman-adv 2012-09-25
From: Antonio Quartulli @ 2012-09-25 16:01 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1348588637-18441-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>

Hello David,

here are some instructions to solve the conflict you will hit while merging net
with net-next.

Thank you,
	Antonio




++<<<<<<< HEAD
++=======
+ 	int if_num;
++>>>>>>> 7caf69f... batman-adv: Fix symmetry check / route flapping in multi interface setups


resolves to:
========
	int if_num;
>>>>>>>>




++<<<<<<< HEAD
 +		sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
++=======
+ 		if_num = router->if_incoming->if_num;
+ 		sum_orig = orig_node_tmp->bcast_own_sum[if_num];
++>>>>>>> 7caf69f... batman-adv: Fix symmetry check / route flapping in multi interface setups

resolves to:
=======
		if_num = router->if_incoming->if_num;
		sum_orig = orig_node_tmp->bcast_own_sum[if_num];
>>>>>>>





++<<<<<<< HEAD
 +		sum_neigh = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
++=======
+ 		if_num = neigh_node->if_incoming->if_num;
+ 		sum_neigh = orig_node_tmp->bcast_own_sum[if_num];
++>>>>>>> 7caf69f... batman-adv: Fix symmetry check / route flapping in multi interface setups

resolves to:
=======
		if_num = neigh_node->if_incoming->if_num;
		sum_neigh = orig_node_tmp->bcast_own_sum[if_num];
>>>>>>

^ permalink raw reply

* [PATCH linux-next] nf_defrag_ipv6: fix oops on module unloading
From: Konstantin Khlebnikov @ 2012-09-25 16:07 UTC (permalink / raw)
  Cc: netdev, Amerigo Wang, David S. Miller

fix copy-paste error introduced in linux-next commit
"ipv6: add a new namespace for nf_conntrack_reasm"

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Amerigo Wang <amwang@redhat.com>
Cc: David S. Miller <davem@davemloft.net>

---

[    1.958698] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
[    1.962639] IP: [<ffffffffa1d521e3>] nf_ct_net_exit+0x24/0x79 [nf_defrag_ipv6]
[    1.962639] PGD 0
[    1.962639] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
[    1.962639] Modules linked in: dib3000mc dibx000_common rng_core whci umc nop_usb_xceiv eni videocodec orinoco pcmcia pcmcia_core xfrm_algo spi_bitbang ppp_generic videobuf_vmalloc nf_nat s5h1420 scsi_dh cs5535_mfgpt speakup(C) nf_defrag_ipv6(-) pmbus_core ptp pps_core scsi_transport_sas videobuf2_vmalloc videobuf2_memops videobuf2_core scsi_transport_iscsi i8042 sound suni serio phonet usbip_core(C) sir_dev irda dvb_usb dvb_core slhc udc_core atm snd_mpu401_uart snd_ac97_codec ac97_bus snd_rawmidi uio comedi(C) rt2x00pci rt2x00lib crc_itu_t snd_soc_core snd_compress btcx_risc tveeprom videobuf_dma_sg videobuf_core v4l2_common rc_core videodev media regmap_i2c wusbcore uwb ni_tio(C) x_tables industrialio nf_conntrack p54common mac80211 cfg80211 crc_ccitt led_class b1 kernelcapi ppdev lp
  bnep rfcomm
[    1.962639]  bluetooth rfkill uinput fuse nfsd auth_rpcgss nfs_acl nfs lockd sunrpc af_packet ipv6 loop evbug evdev mac_hid snd_hda_codec_realtek snd_hda_intel snd_hda_codec nouveau snd_hwdep snd_pcm powernow_k8 mxm_wmi snd_page_alloc freq_table wmi video kvm_amd ttm snd_seq kvm drm_kms_helper snd_seq_device snd_timer drm agpgart i2c_algo_bit cfbfillrect cfbimgblt snd cfbcopyarea backlight fb edac_core fbdev edac_mce_amd soundcore firmware_class pcspkr k8temp hid_generic parport_pc parport rtc_cmos 8250_pnp i2c_nforce2 processor thermal_sys button hwmon i2c_core ext4 crc16 jbd2 mbcache btrfs crc32c libcrc32c zlib_deflate usbhid hid sd_mod crc_t10dif ide_cd_mod cdrom ohci_hcd ata_generic pata_acpi pata_amd ehci_hcd sata_nv amd74xx forcedeth usbcore libata usb_common scsi_mod ide_pci_gene
 ric ide_core
[    1.962639]  unix [last unloaded: nf_defrag_ipv4]
[    1.962639] CPU 1
[    1.962639] Pid: 12431, comm: rmmod Tainted: P    B   WC   3.6.0-rc6-next-20120921-00009-g0383d9a #563 Gigabyte Technology Co., Ltd. M52S-S3P/M52S-S3P
[    1.962639] RIP: 0010:[<ffffffffa1d521e3>]  [<ffffffffa1d521e3>] nf_ct_net_exit+0x24/0x79 [nf_defrag_ipv6]
[    1.962639] RSP: 0018:ffff8800539ade18  EFLAGS: 00010203
[    1.962639] RAX: ffffffff82529ab0 RBX: ffffffff82529a40 RCX: ffffffffa1d552d0
[    1.962639] RDX: ffff8800539ade68 RSI: ffff8800539ade68 RDI: 0000000000000000
[    1.962639] RBP: ffff8800539ade28 R08: ffff8800539ade68 R09: ffffffff8167c7c0
[    1.962639] R10: ffff88007d010240 R11: ffff88007d010240 R12: ffffffffa1d552d0
[    1.962639] R13: ffff8800539ade68 R14: 00007fad18abf170 R15: 0000000000000800
[    1.962639] FS:  00007fad18887700(0000) GS:ffff88007d000000(0000) knlGS:0000000000000000
[    1.962639] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[    1.962639] CR2: 0000000000000020 CR3: 0000000055278000 CR4: 00000000000007e0
[    1.962639] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    1.962639] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    1.962639] Process rmmod (pid: 12431, threadinfo ffff8800539ac000, task ffff880056820000)
[    1.962639] Stack:
[    1.962639]  ffffffff82529a40 ffffffffa1d552d0 ffff8800539ade58 ffffffff81554af3
[    1.962639]  ffff8800539ade68 ffffffffa1d552d0 ffffffff8252ab30 ffff8800539ade68
[    1.962639]  ffff8800539ade98 ffffffff81555031 ffffffff82529ab0 ffffffff82529ab0
[    1.962639] Call Trace:
[    1.962639]  [<ffffffff81554af3>] ops_exit_list+0x4e/0x83
[    1.962639]  [<ffffffff81555031>] unregister_pernet_operations+0x84/0xe0
[    1.962639]  [<ffffffff8155512b>] unregister_pernet_subsys+0x32/0x50
[    1.962639]  [<ffffffffa1d5392e>] nf_ct_frag6_cleanup+0x1c/0x3a [nf_defrag_ipv6]
[    1.962639]  [<ffffffffa1d53974>] nf_defrag_fini+0x28/0x31 [nf_defrag_ipv6]
[    1.962639]  [<ffffffff8110ec5a>] sys_delete_module+0x328/0x3d2
[    1.962639]  [<ffffffff8168be58>] tracesys+0xe1/0xe6
[    1.962639] Code: 05 bb 4b 00 00 5d c3 66 66 66 66 90 55 48 ff 05 f4 4e 00 00 48 ff 05 0d 4f 00 00 48 89 e5 41 54 53 48 89 fb 48 8b bf 88 0b 00 00 <4c> 8b 67 20 e8 0d 8f 8e df 48 ff 05 f5 4e 00 00 48 81 fb 40 9a
[    1.962639] RIP  [<ffffffffa1d521e3>] nf_ct_net_exit+0x24/0x79 [nf_defrag_ipv6]
[    1.962639]  RSP <ffff8800539ade18>
[    1.962639] CR2: 0000000000000020
---
 net/ipv6/netfilter/nf_conntrack_reasm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 1af12fde..18bd9bb 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -106,7 +106,7 @@ static int __net_init nf_ct_frag6_sysctl_register(struct net *net)
 	if (hdr == NULL)
 		goto err_reg;
 
-	net->ipv6.sysctl.frags_hdr = hdr;
+	net->nf_frag.sysctl.frags_hdr = hdr;
 	return 0;
 
 err_reg:

^ permalink raw reply related

* Re: [PATCH net-next] netxen: write IP address to firmware when using bonding
From: Nikolay Aleksandrov @ 2012-09-25 16:43 UTC (permalink / raw)
  To: sony.chacko; +Cc: netdev, agospoda, rajesh.borundia, davem
In-Reply-To: <1348562883-14780-1-git-send-email-nikolay@redhat.com>

On 25/09/12 10:48, Nikolay Aleksandrov wrote:
> From: Nikolay Aleksandrov<naleksan@redhat.com>
>
> This patch allows LRO aggregation on bonded devices that contain an NX3031
> device. It also adds a for_each_netdev_in_bond_rcu(bond, slave) macro
> which executes for each slave that has bond as master.
>
> Signed-off-by: Andy Gospodarek<agospoda@redhat.com>
> Signed-off-by: Nikolay Aleksandrov<nikolay@redhat.com>
> ---
>   .../net/ethernet/qlogic/netxen/netxen_nic_main.c   | 113 +++++++++++++++------
>   include/linux/netdevice.h                          |   3 +
>   2 files changed, 87 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
> index e2a4858..aaf6cf7 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
> @@ -3244,6 +3244,25 @@ netxen_restore_indev_addr(struct net_device *netdev, unsigned long event)
>   	}
>   }
>
> +static inline int
> +netxen_config_checkdev(struct net_device *dev)
> +{
> +	struct netxen_adapter *adapter;
> +
> +	if (!is_netxen_netdev(dev))
> +		return -ENODEV;
> +	
> +	adapter = netdev_priv(dev);
> +
> +	if(!adapter)
> +		return -ENODEV;
> +
> +	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +
>   static int netxen_netdev_event(struct notifier_block *this,
>   				 unsigned long event, void *ptr)
>   {
> @@ -3260,18 +3279,27 @@ recheck:
>   		goto recheck;
>   	}
>
> -	if (!is_netxen_netdev(dev))
> -		goto done;
> -
> -	adapter = netdev_priv(dev);
> -
> -	if (!adapter)
> -		goto done;
> +	/* If this is a bonding device, look for netxen-based slaves*/
> +	if (dev->priv_flags&  IFF_BONDING) {
> +		struct net_device *slave;
>
> -	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
> -		goto done;
> +		rcu_read_lock();
> +		for_each_netdev_in_bond_rcu(dev, slave) {
> +			if (netxen_config_checkdev(slave)<  0)
> +				continue;
> +			
> +			adapter = netdev_priv(slave);
> +			netxen_config_indev_addr(adapter, orig_dev, event);
> +		}
> +		rcu_read_unlock();
>
> -	netxen_config_indev_addr(adapter, orig_dev, event);
> +	} else {
> +		if (netxen_config_checkdev(dev)<  0)
> +			goto done;
> +		
> +		adapter = netdev_priv(dev);
> +		netxen_config_indev_addr(adapter, orig_dev, event);
> +	}
>   done:
>   	return NOTIFY_DONE;
>   }
> @@ -3296,30 +3324,57 @@ recheck:
>   		goto recheck;
>   	}
>
> -	if (!is_netxen_netdev(dev))
> -		goto done;
> +	/* If this is a bonding device, look for netxen-based slaves*/
> +	if (dev->priv_flags&  IFF_BONDING) {
> +		struct net_device *slave;
>
> -	adapter = netdev_priv(dev);
> +		rcu_read_lock();
> +		for_each_netdev_in_bond_rcu(dev, slave) {
> +			if (netxen_config_checkdev(slave)<  0)
> +				continue;
>
> -	if (!adapter || !netxen_destip_supported(adapter))
> -		goto done;
> +			adapter = netdev_priv(slave);
>
> -	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
> -		goto done;
> +			if (!netxen_destip_supported(adapter))
> +				continue;
>
> -	switch (event) {
> -	case NETDEV_UP:
> -		netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP);
> -		netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
> -		break;
> -	case NETDEV_DOWN:
> -		netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN);
> -		netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
> -		break;
> -	default:
> -		break;
> -	}
> +			switch (event) {
> +			case NETDEV_UP:
> +				netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP);
> +				netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
> +				break;
> +			case NETDEV_DOWN:
> +				netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN);
> +				netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
> +				break;
> +			default:
> +				break;
> +			}
> +		}
> +		rcu_read_unlock();
>
> +	} else {
> +		if (netxen_config_checkdev(dev)<  0)
> +			goto done;
> +
> +		adapter = netdev_priv(dev);
> +
> +		if (!netxen_destip_supported(adapter))
> +			goto done;
> +
> +		switch (event) {
> +		case NETDEV_UP:
> +			netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP);
> +			netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
> +			break;
> +		case NETDEV_DOWN:
> +			netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN);
> +			netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
> +			break;
> +		default:
> +			break;
> +		}
> +	}
>   done:
>   	return NOTIFY_DONE;
>   }
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 59dc05f3..463bb40 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1578,6 +1578,9 @@ extern rwlock_t				dev_base_lock;		/* Device list lock */
>   		list_for_each_entry_continue(d,&(net)->dev_base_head, dev_list)
>   #define for_each_netdev_continue_rcu(net, d)		\
>   	list_for_each_entry_continue_rcu(d,&(net)->dev_base_head, dev_list)
> +#define for_each_netdev_in_bond_rcu(bond, slave)	\
> +	for_each_netdev_rcu(&init_net, slave)		\
> +		if (slave->master == bond)
>   #define net_device_entry(lh)	list_entry(lh, struct net_device, dev_list)
>
>   static inline struct net_device *next_net_device(struct net_device *dev)
Ah yes, you're correct. I'll fix the cosmetic issues and re-post it.
I would like to know if the patch is acceptable otherwise, and if
there are any comments about the implementation so I will
wait a little bit to see if anything else comes up.
Thank you for the review.

Best regards,
  Nikolay Aleksandrov

^ permalink raw reply

* [PATCH] ipv6: raw: fix icmpv6_filter()
From: Eric Dumazet @ 2012-09-25 17:03 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

icmpv6_filter() should not modify its input, or else its caller
would need to recompute ipv6_hdr() if skb->head is reallocated.

Use skb_header_pointer() instead of pskb_may_pull() and
change the prototype to make clear both sk and skb are const.

Also, if icmpv6 header cannot be found, do not deliver the packet,
as we do in IPv4.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
Note: another patch is needed in mip6_mh_filter()

 net/ipv6/raw.c |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index ef0579d..4a5f78b 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -107,21 +107,20 @@ found:
  *	0 - deliver
  *	1 - block
  */
-static __inline__ int icmpv6_filter(struct sock *sk, struct sk_buff *skb)
+static int icmpv6_filter(const struct sock *sk, const struct sk_buff *skb)
 {
-	struct icmp6hdr *icmph;
-	struct raw6_sock *rp = raw6_sk(sk);
-
-	if (pskb_may_pull(skb, sizeof(struct icmp6hdr))) {
-		__u32 *data = &rp->filter.data[0];
-		int bit_nr;
+	struct icmp6hdr *_hdr;
+	const struct icmp6hdr *hdr;
 
-		icmph = (struct icmp6hdr *) skb->data;
-		bit_nr = icmph->icmp6_type;
+	hdr = skb_header_pointer(skb, skb_transport_offset(skb),
+				 sizeof(_hdr), &_hdr);
+	if (hdr) {
+		const __u32 *data = &raw6_sk(sk)->filter.data[0];
+		unsigned int type = hdr->icmp6_type;
 
-		return (data[bit_nr >> 5] & (1 << (bit_nr & 31))) != 0;
+		return (data[type >> 5] & (1U << (type & 31))) != 0;
 	}
-	return 0;
+	return 1;
 }
 
 #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)

^ permalink raw reply related

* Re: [PATCH net-next] tcp: avoid tcp loop connection on lo device
From: David Miller @ 2012-09-25 17:04 UTC (permalink / raw)
  To: shanwei88; +Cc: netdev
In-Reply-To: <50616772.8040704@gmail.com>

From: Shan Wei <shanwei88@gmail.com>
Date: Tue, 25 Sep 2012 16:12:34 +0800

> Tcp supports simultaneous Connection, but we meat odd phenomenon
> that tcp client can receive what send by itself. tcp client and tcp
> server communicate through loop device. tcp server selects port
> 40000 to listen which is in local port range. But after tcp server
> program is killed, tcp client still can connect successfully.

This is expected behavior and we're not special casing this after
it being this way for 20+ years.

^ permalink raw reply

* Re: [PATCH] net: sh-eth: fix sleeping in atomic context
From: David Miller @ 2012-09-25 17:08 UTC (permalink / raw)
  To: g.liakhovetski; +Cc: linux-sh, lethal, netdev
In-Reply-To: <Pine.LNX.4.64.1209251143210.9446@axis700.grange>

From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Date: Tue, 25 Sep 2012 12:38:59 +0200 (CEST)

> I'm not sure, whether this is the correct fix, i.e., whether this function 
> is guaranteed to be called on a resumed device, but at least this fixes 
> this specific issue in 3.6-rc7, but leaves another BUG open:

Someone added the runtime PM calls for a reason.

I cannot seriously consider your change until you are able to adequately
consider that aspect.

^ permalink raw reply

* Re: [PATCH] ipv6: raw: fix icmpv6_filter()
From: David Miller @ 2012-09-25 17:23 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1348592620.26828.3215.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 25 Sep 2012 19:03:40 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> icmpv6_filter() should not modify its input, or else its caller
> would need to recompute ipv6_hdr() if skb->head is reallocated.
> 
> Use skb_header_pointer() instead of pskb_may_pull() and
> change the prototype to make clear both sk and skb are const.
> 
> Also, if icmpv6 header cannot be found, do not deliver the packet,
> as we do in IPv4.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> Note: another patch is needed in mip6_mh_filter()

A rather pervasive issues, it appears.

Applied and queued up for -stable, thanks Eric.

^ permalink raw reply

* Re: [PATCH] ipconfig: fix trivial build error
From: David Miller @ 2012-09-25 17:23 UTC (permalink / raw)
  To: andriy.shevchenko; +Cc: netdev, linux-next, chf.fritz
In-Reply-To: <1348560598-21233-1-git-send-email-andriy.shevchenko@linux.intel.com>

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Tue, 25 Sep 2012 11:09:58 +0300

> The commit 5e953778a2aab04929a5e7b69f53dc26e39b079e ("ipconfig: add nameserver
> IPs to kernel-parameter ip=") introduces ic_nameservers_predef() that defined
> only for BOOTP. However it is used by ip_auto_config_setup() as well. This
> patch moves it outside of #ifdef BOOTP.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied, thanks.

^ permalink raw reply

* Re: pull request: batman-adv 2012-09-25
From: David Miller @ 2012-09-25 17:25 UTC (permalink / raw)
  To: ordex-GaUfNO9RBHfsrOwW+9ziJQ
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1348588637-18441-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>

From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Date: Tue, 25 Sep 2012 17:57:15 +0200

> here are two fixes (the last set) we would to propose for net/linux-3.6.
> 
> The one from Def fixes a wrong behaviour of batman-adv in case of virtual
> interface mac address change, while the other from Linüs fixes a problem in the
> route selection which can lead to a continuous route flapping under certain
> conditions.
> 
> We would also like to enqueue both patches for sending to stable-3.5.
> 
> During merge with net/master you will hit a conflict. I'm going to send some
> instructions on how to solve it.
 ...
>   git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

Pulled, thanks.

^ permalink raw reply

* Re: [PATCH] net: sh-eth: fix sleeping in atomic context
From: Guennadi Liakhovetski @ 2012-09-25 17:27 UTC (permalink / raw)
  To: David Miller; +Cc: linux-sh, lethal, netdev
In-Reply-To: <20120925.130831.369798738695859924.davem@davemloft.net>

Hi David

On Tue, 25 Sep 2012, David Miller wrote:

> From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Date: Tue, 25 Sep 2012 12:38:59 +0200 (CEST)
> 
> > I'm not sure, whether this is the correct fix, i.e., whether this function 
> > is guaranteed to be called on a resumed device, but at least this fixes 
> > this specific issue in 3.6-rc7, but leaves another BUG open:
> 
> Someone added the runtime PM calls for a reason.

Sure they did.

> I cannot seriously consider your change until you are able to adequately
> consider that aspect.

I did too - as adequately as I could:-) My understanding is the following: 
assuming the networking stack is right, calling .ndo_get_stats() under a 
lock, I see 2 possibilities: (1) the method is only called during a 
running IO, i.e. the hardware cannot possibly be runtime-suspended at that 
time, so, no need to resume it; (2) the method can be called at any time, 
also when the hardware is suspended, then no IO shall be perdormed there, 
because it might involve having to wait for hardware to wake up from 
suspend. My patch fixes the former case, in the latter case statistics has 
to be collected outside of that method and inside it it only has to be 
atomically returned. This is a bigger change, if this indeed is the case, 
of course, my patch is wrong and an alternative, likely, more complex 
solution has to be found.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply

* [PATCH] qlcnic - Fix scheduling while atomic bug
From: Narendra_K @ 2012-09-25 17:53 UTC (permalink / raw)
  To: netdev; +Cc: sony.chacko, jitendra.kalsaria, john.r.fastabend

From: Narendra K <narendra_k@dell.com>

In the device close path, 'qlcnic_fw_destroy_ctx' and
'qlcnic_poll_rsp' call msleep. But  'qlcnic_fw_destroy_ctx' and
'qlcnic_poll_rsp' are called with 'adapter->tx_clean_lock' spin lock
held resulting in scheduling while atomic bug causing the following
trace.

I observed that the commit 012dc19a45b2b9cc2ebd14aaa401cf782c2abba4
from John Fastabend addresses a similar issue in ixgbevf driver.
Adopting the same approach used in the commit, this patch uses mdelay
to address the issue.

[79884.999115] BUG: scheduling while atomic: ip/30846/0x00000002
[79885.005562] INFO: lockdep is turned off.
[79885.009958] Modules linked in: qlcnic fuse nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE bnep bluetooth rfkill ip6table_mangle ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables iptable_nat nf_nat iptable_mangle ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack iptable_filter ip_tables dcdbas coretemp kvm_intel kvm iTCO_wdt ixgbe iTCO_vendor_support crc32c_intel ghash_clmulni_intel nfsd microcode sb_edac pcspkr edac_core dca bnx2x shpchp auth_rpcgss nfs_acl lpc_ich mfd_core mdio lockd libcrc32c wmi acpi_pad acpi_power_meter sunrpc uinput sd_mod sr_mod cdrom crc_t10dif ahci libahci libata megaraid_sas usb_storage dm_mirror dm_region_hash dm_log dm_mod [last unloaded: qlcnic]
[79885.083608] Pid: 30846, comm: ip Tainted: G        W  O 3.6.0-rc7+ #1
[79885.090805] Call Trace:
[79885.093569]  [<ffffffff816764d8>] __schedule_bug+0x68/0x76
[79885.099699]  [<ffffffff8168358e>] __schedule+0x99e/0xa00
[79885.105634]  [<ffffffff81683929>] schedule+0x29/0x70
[79885.111186]  [<ffffffff81680def>] schedule_timeout+0x16f/0x350
[79885.117724]  [<ffffffff811afb7a>] ? init_object+0x4a/0x90
[79885.123770]  [<ffffffff8107c190>] ? __internal_add_timer+0x140/0x140
[79885.130873]  [<ffffffff81680fee>] schedule_timeout_uninterruptible+0x1e/0x20
[79885.138773]  [<ffffffff8107e830>] msleep+0x20/0x30
[79885.144159]  [<ffffffffa04c7fbf>] qlcnic_issue_cmd+0xef/0x290 [qlcnic]
[79885.151478]  [<ffffffffa04c8265>] qlcnic_fw_cmd_destroy_rx_ctx+0x55/0x90 [qlcnic]
[79885.159868]  [<ffffffffa04c92fd>] qlcnic_fw_destroy_ctx+0x2d/0xa0 [qlcnic]
[79885.167576]  [<ffffffffa04bf2ed>] __qlcnic_down+0x11d/0x180 [qlcnic]
[79885.174708]  [<ffffffffa04bf6f8>] qlcnic_close+0x18/0x20 [qlcnic]
[79885.181547]  [<ffffffff8153b4c5>] __dev_close_many+0x95/0xe0
[79885.187899]  [<ffffffff8153b548>] __dev_close+0x38/0x50
[79885.193761]  [<ffffffff81545101>] __dev_change_flags+0xa1/0x180
[79885.200419]  [<ffffffff81545298>] dev_change_flags+0x28/0x70
[79885.206779]  [<ffffffff815531b8>] do_setlink+0x378/0xa00
[79885.212731]  [<ffffffff81354fe1>] ? nla_parse+0x31/0xe0
[79885.218612]  [<ffffffff815558ee>] rtnl_newlink+0x37e/0x560
[79885.224768]  [<ffffffff812cfa19>] ? selinux_capable+0x39/0x50
[79885.231217]  [<ffffffff812cbf98>] ? security_capable+0x18/0x20
[79885.237765]  [<ffffffff81555114>] rtnetlink_rcv_msg+0x114/0x2f0
[79885.244412]  [<ffffffff81551f87>] ? rtnl_lock+0x17/0x20
[79885.250280]  [<ffffffff81551f87>] ? rtnl_lock+0x17/0x20
[79885.256148]  [<ffffffff81555000>] ? __rtnl_unlock+0x20/0x20
[79885.262413]  [<ffffffff81570fc1>] netlink_rcv_skb+0xa1/0xb0
[79885.268661]  [<ffffffff81551fb5>] rtnetlink_rcv+0x25/0x40
[79885.274727]  [<ffffffff815708bd>] netlink_unicast+0x19d/0x220
[79885.281146]  [<ffffffff81570c45>] netlink_sendmsg+0x305/0x3f0
[79885.287595]  [<ffffffff8152b188>] ? sock_update_classid+0x148/0x2e0
[79885.294650]  [<ffffffff81525c2c>] sock_sendmsg+0xbc/0xf0
[79885.300600]  [<ffffffff8152600c>] __sys_sendmsg+0x3ac/0x3c0
[79885.306853]  [<ffffffff8109be23>] ? up_read+0x23/0x40
[79885.312510]  [<ffffffff816896cc>] ? do_page_fault+0x2bc/0x570
[79885.318968]  [<ffffffff81191854>] ? sys_brk+0x44/0x150
[79885.324715]  [<ffffffff811c458c>] ? fget_light+0x24c/0x520
[79885.330875]  [<ffffffff815286f9>] sys_sendmsg+0x49/0x90
[79885.336707]  [<ffffffff8168e429>] system_call_fastpath+0x16/0x1b

Signed-off-by: Narendra K <narendra_k@dell.com>
---
The patch applies to latest mainline kernel version 3.6-rc7

 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index b8ead69..2a179d0 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -15,7 +15,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter)
 
 	do {
 		/* give atleast 1ms for firmware to respond */
-		msleep(1);
+		mdelay(1);
 
 		if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT)
 			return QLCNIC_CDRP_RSP_TIMEOUT;
@@ -601,7 +601,7 @@ void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter)
 		qlcnic_fw_cmd_destroy_tx_ctx(adapter);
 
 		/* Allow dma queues to drain after context reset */
-		msleep(20);
+		mdelay(20);
 	}
 }
 
-- 
1.7.10.2

-- 
With regards,
Narendra K

^ permalink raw reply related

* RE: ixgbe unstable performance at 1Gb/s
From: Tantilov, Emil S @ 2012-09-25 17:58 UTC (permalink / raw)
  To: Charles, netdev@vger.kernel.org
In-Reply-To: <loom.20120924T193212-646@post.gmane.org>

>-----Original Message-----
>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On
>Behalf Of Charles
>Sent: Monday, September 24, 2012 10:47 AM
>To: netdev@vger.kernel.org
>Subject: ixgbe unstable performance at 1Gb/s
>
>Hi,
>
>I hope I am posting on the right mailing-list. If not, sorry; please
>redirect me
>to the right place. Thanks.
>
>I have a new motherboard with integrated Intel X540 10GBase-T. For now, I
>want
>to use it at 1Gb/s.
>
>The bandwidth is only of ~300 Mbit/s (with Iperf). It's actually very
>unstable
>(always varies between 100 to 800 Mbit/s during the transfer).

Do you by any chance have CONFIG_IXGBE_PTP set in your kernel config?

If so, try disabling it and see if it fixes your performance. 

Thanks,
Emil

^ permalink raw reply

* RE: [PATCH net-next] netxen: write IP address to firmware when using bonding
From: Rajesh Borundia @ 2012-09-25 18:28 UTC (permalink / raw)
  To: Nikolay Aleksandrov, Sony Chacko
  Cc: netdev, agospoda@redhat.com, David Miller
In-Reply-To: <5061DF4D.60708@redhat.com>



>-----Original Message-----
>From: Nikolay Aleksandrov [mailto:nikolay@redhat.com]
>Sent: Tuesday, September 25, 2012 10:14 PM
>To: Sony Chacko
>Cc: netdev; agospoda@redhat.com; Rajesh Borundia; David Miller
>Subject: Re: [PATCH net-next] netxen: write IP address to firmware when
>using bonding
>
>On 25/09/12 10:48, Nikolay Aleksandrov wrote:
>> From: Nikolay Aleksandrov<naleksan@redhat.com>
>>
>> This patch allows LRO aggregation on bonded devices that contain an
>NX3031
>> device. It also adds a for_each_netdev_in_bond_rcu(bond, slave) macro
>> which executes for each slave that has bond as master.
>>
>> Signed-off-by: Andy Gospodarek<agospoda@redhat.com>
>> Signed-off-by: Nikolay Aleksandrov<nikolay@redhat.com>
>> ---
>>   .../net/ethernet/qlogic/netxen/netxen_nic_main.c   | 113
>+++++++++++++++------
>>   include/linux/netdevice.h                          |   3 +
>>   2 files changed, 87 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
>b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
>> index e2a4858..aaf6cf7 100644
>> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
>> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
>> @@ -3244,6 +3244,25 @@ netxen_restore_indev_addr(struct net_device
>*netdev, unsigned long event)
>>   	}
>>   }
>>
>> +static inline int
>> +netxen_config_checkdev(struct net_device *dev)
>> +{
>> +	struct netxen_adapter *adapter;
>> +
>> +	if (!is_netxen_netdev(dev))
>> +		return -ENODEV;
>> +
>> +	adapter = netdev_priv(dev);
>> +
>> +	if(!adapter)
>> +		return -ENODEV;
>> +
>> +	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
>> +		return -ENODEV;
>> +
>> +	return 0;
>> +}
>> +
>>   static int netxen_netdev_event(struct notifier_block *this,
>>   				 unsigned long event, void *ptr)
>>   {
>> @@ -3260,18 +3279,27 @@ recheck:
>>   		goto recheck;
>>   	}
>>
>> -	if (!is_netxen_netdev(dev))
>> -		goto done;
>> -
>> -	adapter = netdev_priv(dev);
>> -
>> -	if (!adapter)
>> -		goto done;
>> +	/* If this is a bonding device, look for netxen-based slaves*/
>> +	if (dev->priv_flags&  IFF_BONDING) {
>> +		struct net_device *slave;
>>
>> -	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
>> -		goto done;
>> +		rcu_read_lock();
>> +		for_each_netdev_in_bond_rcu(dev, slave) {
>> +			if (netxen_config_checkdev(slave)<  0)
>> +				continue;
>> +
>> +			adapter = netdev_priv(slave);
>> +			netxen_config_indev_addr(adapter, orig_dev, event);
>> +		}
>> +		rcu_read_unlock();
>>
>> -	netxen_config_indev_addr(adapter, orig_dev, event);
>> +	} else {
>> +		if (netxen_config_checkdev(dev)<  0)
>> +			goto done;
>> +
>> +		adapter = netdev_priv(dev);
>> +		netxen_config_indev_addr(adapter, orig_dev, event);
>> +	}
>>   done:
>>   	return NOTIFY_DONE;
>>   }
>> @@ -3296,30 +3324,57 @@ recheck:
>>   		goto recheck;
>>   	}
>>
>> -	if (!is_netxen_netdev(dev))
>> -		goto done;
>> +	/* If this is a bonding device, look for netxen-based slaves*/
>> +	if (dev->priv_flags&  IFF_BONDING) {
>> +		struct net_device *slave;
>>
>> -	adapter = netdev_priv(dev);
>> +		rcu_read_lock();
>> +		for_each_netdev_in_bond_rcu(dev, slave) {
>> +			if (netxen_config_checkdev(slave)<  0)
>> +				continue;
>>
>> -	if (!adapter || !netxen_destip_supported(adapter))
>> -		goto done;
>> +			adapter = netdev_priv(slave);
>>
>> -	if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
>> -		goto done;
>> +			if (!netxen_destip_supported(adapter))
>> +				continue;
>>
>> -	switch (event) {
>> -	case NETDEV_UP:
>> -		netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP);
>> -		netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
>> -		break;
>> -	case NETDEV_DOWN:
>> -		netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN);
>> -		netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
>> -		break;
>> -	default:
>> -		break;
>> -	}
>> +			switch (event) {
>> +			case NETDEV_UP:
>> +				netxen_config_ipaddr(adapter, ifa->ifa_address,
>NX_IP_UP);
>> +				netxen_list_config_vlan_ip(adapter, ifa,
>NX_IP_UP);
>> +				break;
>> +			case NETDEV_DOWN:
>> +				netxen_config_ipaddr(adapter, ifa->ifa_address,
>NX_IP_DOWN);
>> +				netxen_list_config_vlan_ip(adapter, ifa,
>NX_IP_DOWN);
>> +				break;
>> +			default:
>> +				break;
>> +			}
>> +		}
>> +		rcu_read_unlock();
>>
>> +	} else {
>> +		if (netxen_config_checkdev(dev)<  0)
>> +			goto done;
>> +
>> +		adapter = netdev_priv(dev);
>> +
>> +		if (!netxen_destip_supported(adapter))
>> +			goto done;
>> +
>> +		switch (event) {
>> +		case NETDEV_UP:
>> +			netxen_config_ipaddr(adapter, ifa->ifa_address,
>NX_IP_UP);
>> +			netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
>> +			break;
>> +		case NETDEV_DOWN:
>> +			netxen_config_ipaddr(adapter, ifa->ifa_address,
>NX_IP_DOWN);
>> +			netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
>> +			break;
>> +		default:
>> +			break;
>> +		}
>> +	}
>>   done:
>>   	return NOTIFY_DONE;
>>   }
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index 59dc05f3..463bb40 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -1578,6 +1578,9 @@ extern rwlock_t
>	dev_base_lock;		/* Device list lock */
>>   		list_for_each_entry_continue(d,&(net)->dev_base_head,
>dev_list)
>>   #define for_each_netdev_continue_rcu(net, d)		\
>>   	list_for_each_entry_continue_rcu(d,&(net)->dev_base_head,
>dev_list)
>> +#define for_each_netdev_in_bond_rcu(bond, slave)	\
>> +	for_each_netdev_rcu(&init_net, slave)		\
>> +		if (slave->master == bond)
>>   #define net_device_entry(lh)	list_entry(lh, struct net_device,
>dev_list)
>>
>>   static inline struct net_device *next_net_device(struct net_device
>*dev)
>Ah yes, you're correct. I'll fix the cosmetic issues and re-post it.
>I would like to know if the patch is acceptable otherwise, and if
>there are any comments about the implementation so I will
>wait a little bit to see if anything else comes up.

You need to add bond interface ip again after adapter is reset.
netxen_restore_indev_addr() function does this for normal as well as vlan interface.
Is there an API where we could find that interface has a master bond interface and
we could program the ip of that bond interface ?
Otherwise we may have to cache the ip address like we do for vlan interfaces in this function
netxen_list_config_vlan_ip() and program that in netxen_restore_indev_addr().

>Thank you for the review.
>
>Best regards,
>  Nikolay Aleksandrov
>

^ permalink raw reply

* Re: [PATCH NEXT V3] rtlwifi: rtl8192c: rtl8192ce: Add support for B-CUT version of RTL8188CE
From: John W. Linville @ 2012-09-25 19:57 UTC (permalink / raw)
  To: Larry Finger
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA, Anisse Astier, Li Chaoming
In-Reply-To: <1347982168-10601-1-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>

On Tue, Sep 18, 2012 at 10:29:28AM -0500, Larry Finger wrote:
> Realtek devices with designation RTL8188CE-VL have the so-called B-cut
> of the wireless chip. This patch adds the special programming needed by
> these devices. In addition, a variable that was static has been moved into
> the private data area as it is now needed in two different routines. This
> change also fixes a minor bug that would be present if a system had more
> than one RTL81{88,92}CE devices. Other drivers in the rtlwifi family had
> already made this change, thus the variable already exists in the private
> data structure.
> 
> Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
> Cc: Anisse Astier <anisse-fwwRqrJYcP2HXe+LvDLADg@public.gmane.org>
> Cc: Li Chaoming <chaoming_li-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>
> ---
>  rtl8192c/phy_common.c |   21 +++++++++++++++++
>  rtl8192ce/def.h       |    3 ++
>  rtl8192ce/hw.c        |   60 +++++++++++++++++++++++++++++++++++++++++++++-----
>  rtl8192ce/phy.c       |    2 +
>  rtl8192ce/sw.c        |    6 +----
>  rtl8192ce/trx.c       |    4 +--
>  6 files changed, 85 insertions(+), 11 deletions(-)
> ---
> V1 => V2	Remove extraneous white space.
> V2 => V3	A change that is not part of the B-cut change and was introduced
> 		in V2 is moved to a separate patch. 

/home/linville/git/wireless-next
[linville-8530p.local]:> git am -s updates.mbox 
Applying: rtlwifi: rtl8192c: rtl8192ce: Add support for B-CUT version of RTL8188CE
error: patch failed: drivers/net/wireless/rtlwifi/rtl8192ce/def.h:116
error: drivers/net/wireless/rtlwifi/rtl8192ce/def.h: patch does not apply
error: patch failed: drivers/net/wireless/rtlwifi/rtl8192ce/hw.c:1004
error: drivers/net/wireless/rtlwifi/rtl8192ce/hw.c: patch does not apply
error: patch failed: drivers/net/wireless/rtlwifi/rtl8192ce/sw.c:162
error: drivers/net/wireless/rtlwifi/rtl8192ce/sw.c: patch does not apply
Patch failed at 0001 rtlwifi: rtl8192c: rtl8192ce: Add support for B-CUT version of RTL8188CE
The copy of the patch that failed is found in:
   /home/linville/git/wireless-next/.git/rebase-apply/patch
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

-- 
John W. Linville		Someday the world will need a hero, and you
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org			might be all we have.  Be ready.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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

* [PATCH] ipv6: mip6: fix mip6_mh_filter()
From: Eric Dumazet @ 2012-09-25 20:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

mip6_mh_filter() should not modify its input, or else its caller
would need to recompute ipv6_hdr() if skb->head is reallocated.

Use skb_header_pointer() instead of pskb_may_pull()

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/mip6.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 5b087c3..0f9bdc5 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -86,28 +86,30 @@ static int mip6_mh_len(int type)
 
 static int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
 {
-	struct ip6_mh *mh;
+	struct ip6_mh _hdr;
+	const struct ip6_mh *mh;
 
-	if (!pskb_may_pull(skb, (skb_transport_offset(skb)) + 8) ||
-	    !pskb_may_pull(skb, (skb_transport_offset(skb) +
-				 ((skb_transport_header(skb)[1] + 1) << 3))))
+	mh = skb_header_pointer(skb, skb_transport_offset(skb),
+				sizeof(_hdr), &_hdr);
+	if (!mh)
 		return -1;
 
-	mh = (struct ip6_mh *)skb_transport_header(skb);
+	if (((mh->ip6mh_hdrlen + 1) << 3) > skb->len)
+		return -1;
 
 	if (mh->ip6mh_hdrlen < mip6_mh_len(mh->ip6mh_type)) {
 		LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH message too short: %d vs >=%d\n",
 			       mh->ip6mh_hdrlen, mip6_mh_len(mh->ip6mh_type));
-		mip6_param_prob(skb, 0, ((&mh->ip6mh_hdrlen) -
-					 skb_network_header(skb)));
+		mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_hdrlen) +
+				skb_network_header_len(skb));
 		return -1;
 	}
 
 	if (mh->ip6mh_proto != IPPROTO_NONE) {
 		LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n",
 			       mh->ip6mh_proto);
-		mip6_param_prob(skb, 0, ((&mh->ip6mh_proto) -
-					 skb_network_header(skb)));
+		mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_proto) +
+				skb_network_header_len(skb));
 		return -1;
 	}
 

^ permalink raw reply related

* Re: [PATCH] ipv6: mip6: fix mip6_mh_filter()
From: David Miller @ 2012-09-25 20:05 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1348603288.26828.3398.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 25 Sep 2012 22:01:28 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> mip6_mh_filter() should not modify its input, or else its caller
> would need to recompute ipv6_hdr() if skb->head is reallocated.
> 
> Use skb_header_pointer() instead of pskb_may_pull()
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable, thanks Eric.

^ permalink raw reply

* [PATCH] net: phy: smsc: Implement PHY config_init for LAN87xx
From: Marek Vasut @ 2012-09-25 20:17 UTC (permalink / raw)
  To: netdev
  Cc: Marek Vasut, Christian Hohnstaedt, David S. Miller, Fabio Estevam,
	Giuseppe Cavallaro, Otavio Salvador

The LAN8710/LAN8720 chips do have broken the "FlexPWR" smart power-saving
capability. Enabling it leads to the PHY not being able to detect Link when
cold-started without cable connected. Thus, make sure this is disabled.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Christian Hohnstaedt <chohnstaedt@innominate.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
---
 drivers/net/phy/smsc.c |   28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 6d61923..88e3991 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -56,6 +56,32 @@ static int smsc_phy_config_init(struct phy_device *phydev)
 	return smsc_phy_ack_interrupt (phydev);
 }
 
+static int lan87xx_config_init(struct phy_device *phydev)
+{
+	/*
+	 * Make sure the EDPWRDOWN bit is NOT set. Setting this bit on
+	 * LAN8710/LAN8720 PHY causes the PHY to misbehave, likely due
+	 * to a bug on the chip.
+	 *
+	 * When the system is powered on with the network cable being
+	 * disconnected all the way until after ifconfig ethX up is
+	 * issued for the LAN port with this PHY, connecting the cable
+	 * afterwards does not cause LINK change detection, while the
+	 * expected behavior is the Link UP being detected.
+	 */
+	int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
+	if (rc < 0)
+		return rc;
+
+	rc &= ~MII_LAN83C185_EDPWRDOWN;
+
+	rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc);
+	if (rc < 0)
+		return rc;
+
+	return smsc_phy_ack_interrupt(phydev);
+}
+
 static int lan911x_config_init(struct phy_device *phydev)
 {
 	return smsc_phy_ack_interrupt(phydev);
@@ -162,7 +188,7 @@ static struct phy_driver smsc_phy_driver[] = {
 	/* basic functions */
 	.config_aneg	= genphy_config_aneg,
 	.read_status	= genphy_read_status,
-	.config_init	= smsc_phy_config_init,
+	.config_init	= lan87xx_config_init,
 
 	/* IRQ related */
 	.ack_interrupt	= smsc_phy_ack_interrupt,
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH] 8139too: add 1013:1211 PCI ID for a strange SMC1211TX.
From: W. Trevor King @ 2012-09-25 20:35 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Jason Wang, Ben Greear, Joe Perches,
	linux-kernel

The FCC ID on the board is HEDEN1207DTXR01, which belongs to Accton
Technology Corporation.  This matches the expected 1113 ID.  Perhaps
my board just has a dying EEPROM?

Signed-off-by: W. Trevor King <wking@tremily.us>
---
I'm not sure if this qualifies as a patch-able issue, but I thought
I'd send it in in case someone else gets bitten by this.

 drivers/net/ethernet/realtek/8139too.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index 1d83565..b7cf947 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -238,6 +238,7 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
 	{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
 	{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
 	{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
+	{0x1013, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
 	{0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
 	{0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
 	{0x1186, 0x1300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
-- 
1.7.8.6

^ permalink raw reply related

* Re: [PATCH V3 0/8] ipvs: IPv6 fragment handling for IPVS
From: Julian Anastasov @ 2012-09-25 20:48 UTC (permalink / raw)
  To: Jesper Dangaard Brouer
  Cc: Hans Schillstrom, Hans Schillstrom, netdev, Patrick McHardy,
	Pablo Neira Ayuso, lvs-devel, Thomas Graf, Wensong Zhang,
	netfilter-devel, Simon Horman
In-Reply-To: <1348578674.2689.15.camel@localhost>


	Hello,

On Tue, 25 Sep 2012, Jesper Dangaard Brouer wrote:

> > 	Some comments:
> > 
> > - About patch 4: ip_vs_icmp_xmit_v6 already calls skb_make_writable
> > before ip_vs_nat_icmp_v6, that is why we provide 'offset'.
> 
> I see, that call path is correct, BUT I was talking about another call
> path of ip_vs_nat_icmp_v6(), via handle_response_icmp() (which also
> calls skb_make_writable).  That call path is triggered, if the
> real-server, have shutdown its service and send back an ICMPv6 packet.

	Yes, currently, both ip_vs_nat_icmp_v6 callers use
skb_make_writable before calling it.

> Hmm, testing it again, I cannot trigger this issue.  Perhaps I was
> confusing my self and were using my test script that added IPv6 exthdrs
> to the packet.  Adding print statements to the code, also show the
> correct offset now.
> I'm dropping this patch-4, and I'll adjust/fix patch-5 ("ipvs: fix
> faulty IPv6 extension header handling in IPVS") accordingly.  And I'll
> double check patch-5, that exthdr have been accounted for (in the offset
> used by skb_make_writable() before calling ip_vs_nat_icmp_v6()).

	Yes, patch-4 is not needed.

> > - May be we can provide the offset of ICMPv6 header
> > from ip_vs_in_icmp_v6 to ip_vs_icmp_xmit_v6 as additional
> > argument (icmp_offset) and then to ip_vs_nat_icmp_v6. By this
> > way we can avoid the two ipv6_find_hdr calls if we also provide
> > the iph argument from ip_vs_icmp_xmit_v6 to ip_vs_nat_icmp_v6,
> > its ->len points to the ports. ip_vs_in_icmp_v6 provides
> > also protocol in this ciph, so may be we have everything.
> 
> Is this comment for the API patch-7 ("ipvs: API change to avoid rescan
> of IPv6 exthdr") ?

	No, this comment is for patch-5 where 2 ipv6_find_hdr
calls are added to ip_vs_nat_icmp_v6. But we can change it
later in followup patch as an optimization.

> The API patch is going to save 19 calls to ipv6_find_hdr ().
> 
> 
> > - in ip_vs_in_icmp_v6 there must be 'offs_ciph = ciph.len;'
> > just before this line:
> > 
> > if (IPPROTO_TCP == ciph.protocol || IPPROTO_UDP == ciph.protocol ||
> > 
> 
> It would be a lot easier for me, if you commented directly on the
> patches.

	Sorry, this is for patch-5, its purpose is for
skb_make_writable in ip_vs_icmp_xmit_v6, not for debug.

> I can see that 'offs_ciph = ciph.len;' is set earlier in this patch, but
> that value is primarily used by IP_VS_DBG_PKT.  And offs_ciph, needs to
> be updated, again, with the value of ciph.len after the call to
> ipv6_find_hdr().  So, yes you are right ;-)
> 
> I'll rename offs_ciph to "writable" to emphasize what we are using this
> value for.

	Good idea, this is its purpose.

> > 	The idea is that we linearize for writing the inner
> > IP header and optionally the 2 ports. That is why old
> > logic was 'offset += 2 * sizeof(__u16);'
> 
> The port logic was kept.  But I'll make it more clear whats happening,
> and keep the "+=" coding style.

	Yes, it was in this way at 2 places before your changes,
one in handle_response_icmp and another in ip_vs_in_icmp_v6.

> > - initially, ip_vs_fill_iph_skb fills iphdr->flags from
> > current fragment, later ip_vs_out_icmp_v6 uses the same
> > ipvsh when calling ipv6_find_hdr. Should we initialize
> > ipvsh->flags to 0 before calling ipv6_find_hdr because
> > it is I/O argument?

	For the record, this is patch-7

> As we don't use the flag, after this point, we can just give
> ipv6_find_hdr() a NULL value instead.

	Agreed, NULL for flags looks fine.

> But I must give you, that it's a little confusing the way we reuse the
> ipvsh variable (in ip_vs_out_icmp_v6()).  Think, this needs to be
> rewritten to use a separate variable, like in ip_vs_in_icmp_v6().

	The initialization is risky but saves stack. So,
it is up to you to decide whether we need local ipvsh_stack
var as before patch-7.

Regards

--
Julian Anastasov <ja@ssi.bg>

^ permalink raw reply

* [PATCHv3 net-next 4/4] tunnel: drop packet if ECN present with not-ECT
From: Stephen Hemminger @ 2012-09-25 21:02 UTC (permalink / raw)
  To: Chris Wright, davem; +Cc: netdev
In-Reply-To: <20120925041259.337491375@vyatta.com>

Linux tunnels were written before RFC6040 and therefore never
implemented the corner case of ECN getting set in the outer header
and the inner header not being ready for it.

Section 4.2.  Default Tunnel Egress Behaviour.
 o If the inner ECN field is Not-ECT, the decapsulator MUST NOT
      propagate any other ECN codepoint onwards.  This is because the
      inner Not-ECT marking is set by transports that rely on dropped
      packets as an indication of congestion and would not understand or
      respond to any other ECN codepoint [RFC4774].  Specifically:

      *  If the inner ECN field is Not-ECT and the outer ECN field is
         CE, the decapsulator MUST drop the packet.

      *  If the inner ECN field is Not-ECT and the outer ECN field is
         Not-ECT, ECT(0), or ECT(1), the decapsulator MUST forward the
         outgoing packet with the ECN field cleared to Not-ECT.

This patch moves the ECN decap logic out of the individual tunnels
into a common place.

It also adds logging to allow detecting broken systems that
set ECN bits incorrectly when tunneling (or an intermediate
router might be changing the header).

Overloads rx_frame_error to keep track of ECN related error.

Thanks to Chris Wright who caught this while reviewing the new VXLAN
tunnel.

This code was tested by injecting faulty logic in other end GRE
to send incorrectly encapsulated packets.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
v3 - add common code and logging for ECN broken encapsulation
v2 - supersedes earlier GRE only version

 include/net/inet_ecn.h |   76 +++++++++++++++++++++++++++++++++++++++++++++++++
 net/ipv4/ip_gre.c      |   38 ++++++++++++++----------
 net/ipv4/ipip.c        |   42 ++++++++++++++++-----------
 net/ipv6/ip6_gre.c     |   54 +++++++++++++++-------------------
 4 files changed, 147 insertions(+), 63 deletions(-)

--- a/net/ipv4/ip_gre.c	2012-09-25 08:37:13.995876570 -0700
+++ b/net/ipv4/ip_gre.c	2012-09-25 11:00:46.918340181 -0700
@@ -120,6 +120,10 @@
    Alexey Kuznetsov.
  */
 
+static bool log_ecn_error = true;
+module_param(log_ecn_error, bool, 0644);
+MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
+
 static struct rtnl_link_ops ipgre_link_ops __read_mostly;
 static int ipgre_tunnel_init(struct net_device *dev);
 static void ipgre_tunnel_setup(struct net_device *dev);
@@ -204,7 +208,9 @@ static struct rtnl_link_stats64 *ipgre_g
 	tot->rx_crc_errors = dev->stats.rx_crc_errors;
 	tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
 	tot->rx_length_errors = dev->stats.rx_length_errors;
+	tot->rx_frame_errors = dev->stats.rx_frame_errors;
 	tot->rx_errors = dev->stats.rx_errors;
+
 	tot->tx_fifo_errors = dev->stats.tx_fifo_errors;
 	tot->tx_carrier_errors = dev->stats.tx_carrier_errors;
 	tot->tx_dropped = dev->stats.tx_dropped;
@@ -587,17 +593,6 @@ static void ipgre_err(struct sk_buff *sk
 	t->err_time = jiffies;
 }
 
-static inline void ipgre_ecn_decapsulate(const struct iphdr *iph, struct sk_buff *skb)
-{
-	if (INET_ECN_is_ce(iph->tos)) {
-		if (skb->protocol == htons(ETH_P_IP)) {
-			IP_ECN_set_ce(ip_hdr(skb));
-		} else if (skb->protocol == htons(ETH_P_IPV6)) {
-			IP6_ECN_set_ce(ipv6_hdr(skb));
-		}
-	}
-}
-
 static inline u8
 ipgre_ecn_encapsulate(u8 tos, const struct iphdr *old_iph, struct sk_buff *skb)
 {
@@ -620,6 +615,7 @@ static int ipgre_rcv(struct sk_buff *skb
 	struct ip_tunnel *tunnel;
 	int    offset = 4;
 	__be16 gre_proto;
+	int    err;
 
 	if (!pskb_may_pull(skb, 16))
 		goto drop;
@@ -723,17 +719,27 @@ static int ipgre_rcv(struct sk_buff *skb
 			skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
 		}
 
+		__skb_tunnel_rx(skb, tunnel->dev);
+
+		skb_reset_network_header(skb);
+		err = IP_ECN_decapsulate(iph, skb);
+		if (unlikely(err)) {
+			if (log_ecn_error)
+				net_info_ratelimited("non-ECT from %pI4 with TOS=%#x\n",
+						     &iph->saddr, iph->tos);
+			if (err > 1) {
+				++tunnel->dev->stats.rx_frame_errors;
+				++tunnel->dev->stats.rx_errors;
+				goto drop;
+			}
+		}
+
 		tstats = this_cpu_ptr(tunnel->dev->tstats);
 		u64_stats_update_begin(&tstats->syncp);
 		tstats->rx_packets++;
 		tstats->rx_bytes += skb->len;
 		u64_stats_update_end(&tstats->syncp);
 
-		__skb_tunnel_rx(skb, tunnel->dev);
-
-		skb_reset_network_header(skb);
-		ipgre_ecn_decapsulate(iph, skb);
-
 		netif_rx(skb);
 
 		return 0;
--- a/net/ipv4/ipip.c	2012-09-25 08:37:14.791868701 -0700
+++ b/net/ipv4/ipip.c	2012-09-25 11:01:41.733794349 -0700
@@ -120,6 +120,10 @@
 #define HASH_SIZE  16
 #define HASH(addr) (((__force u32)addr^((__force u32)addr>>4))&0xF)
 
+static bool log_ecn_error = true;
+module_param(log_ecn_error, bool, 0644);
+MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
+
 static int ipip_net_id __read_mostly;
 struct ipip_net {
 	struct ip_tunnel __rcu *tunnels_r_l[HASH_SIZE];
@@ -400,28 +404,18 @@ out:
 	return err;
 }
 
-static inline void ipip_ecn_decapsulate(const struct iphdr *outer_iph,
-					struct sk_buff *skb)
-{
-	struct iphdr *inner_iph = ip_hdr(skb);
-
-	if (INET_ECN_is_ce(outer_iph->tos))
-		IP_ECN_set_ce(inner_iph);
-}
-
 static int ipip_rcv(struct sk_buff *skb)
 {
 	struct ip_tunnel *tunnel;
 	const struct iphdr *iph = ip_hdr(skb);
+	int err;
 
 	tunnel = ipip_tunnel_lookup(dev_net(skb->dev), iph->saddr, iph->daddr);
 	if (tunnel != NULL) {
 		struct pcpu_tstats *tstats;
 
-		if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
-			kfree_skb(skb);
-			return 0;
-		}
+		if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
+			goto drop;
 
 		secpath_reset(skb);
 
@@ -430,21 +424,35 @@ static int ipip_rcv(struct sk_buff *skb)
 		skb->protocol = htons(ETH_P_IP);
 		skb->pkt_type = PACKET_HOST;
 
+		__skb_tunnel_rx(skb, tunnel->dev);
+
+		err = IP_ECN_decapsulate(iph, skb);
+		if (unlikely(err)) {
+			if (log_ecn_error)
+				net_info_ratelimited("non-ECT from %pI4 with TOS=%#x\n",
+						     &iph->saddr, iph->tos);
+			if (err > 1) {
+				++tunnel->dev->stats.rx_frame_errors;
+				++tunnel->dev->stats.rx_errors;
+				goto drop;
+			}
+		}
+
 		tstats = this_cpu_ptr(tunnel->dev->tstats);
 		u64_stats_update_begin(&tstats->syncp);
 		tstats->rx_packets++;
 		tstats->rx_bytes += skb->len;
 		u64_stats_update_end(&tstats->syncp);
 
-		__skb_tunnel_rx(skb, tunnel->dev);
-
-		ipip_ecn_decapsulate(iph, skb);
-
 		netif_rx(skb);
 		return 0;
 	}
 
 	return -1;
+
+drop:
+	kfree_skb(skb);
+	return 0;
 }
 
 /*
--- a/net/ipv6/ip6_gre.c	2012-09-25 08:37:13.995876570 -0700
+++ b/net/ipv6/ip6_gre.c	2012-09-25 11:00:35.478454105 -0700
@@ -56,6 +56,10 @@
 #include <net/ip6_tunnel.h>
 
 
+static bool log_ecn_error = true;
+module_param(log_ecn_error, bool, 0644);
+MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
+
 #define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK)
 #define IPV6_TCLASS_SHIFT 20
 
@@ -149,7 +153,9 @@ static struct rtnl_link_stats64 *ip6gre_
 	tot->rx_crc_errors = dev->stats.rx_crc_errors;
 	tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
 	tot->rx_length_errors = dev->stats.rx_length_errors;
+	tot->rx_frame_errors = dev->stats.rx_frame_errors;
 	tot->rx_errors = dev->stats.rx_errors;
+
 	tot->tx_fifo_errors = dev->stats.tx_fifo_errors;
 	tot->tx_carrier_errors = dev->stats.tx_carrier_errors;
 	tot->tx_dropped = dev->stats.tx_dropped;
@@ -489,28 +495,6 @@ static void ip6gre_err(struct sk_buff *s
 	t->err_time = jiffies;
 }
 
-static inline void ip6gre_ecn_decapsulate_ipv4(const struct ip6_tnl *t,
-		const struct ipv6hdr *ipv6h, struct sk_buff *skb)
-{
-	__u8 dsfield = ipv6_get_dsfield(ipv6h) & ~INET_ECN_MASK;
-
-	if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
-		ipv4_change_dsfield(ip_hdr(skb), INET_ECN_MASK, dsfield);
-
-	if (INET_ECN_is_ce(dsfield))
-		IP_ECN_set_ce(ip_hdr(skb));
-}
-
-static inline void ip6gre_ecn_decapsulate_ipv6(const struct ip6_tnl *t,
-		const struct ipv6hdr *ipv6h, struct sk_buff *skb)
-{
-	if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
-		ipv6_copy_dscp(ipv6_get_dsfield(ipv6h), ipv6_hdr(skb));
-
-	if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h)))
-		IP6_ECN_set_ce(ipv6_hdr(skb));
-}
-
 static int ip6gre_rcv(struct sk_buff *skb)
 {
 	const struct ipv6hdr *ipv6h;
@@ -522,6 +506,7 @@ static int ip6gre_rcv(struct sk_buff *sk
 	struct ip6_tnl *tunnel;
 	int    offset = 4;
 	__be16 gre_proto;
+	int err;
 
 	if (!pskb_may_pull(skb, sizeof(struct in6_addr)))
 		goto drop;
@@ -625,20 +610,29 @@ static int ip6gre_rcv(struct sk_buff *sk
 			skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
 		}
 
+		__skb_tunnel_rx(skb, tunnel->dev);
+
+		skb_reset_network_header(skb);
+
+		err = IP6_ECN_decapsulate(ipv6h, skb);
+		if (unlikely(err)) {
+			if (log_ecn_error)
+				net_info_ratelimited("non-ECT from %pI6 with dsfield=%#x\n",
+						     &ipv6h->saddr,
+						     ipv6_get_dsfield(ipv6h));
+			if (err > 1) {
+				++tunnel->dev->stats.rx_frame_errors;
+				++tunnel->dev->stats.rx_errors;
+				goto drop;
+			}
+		}
+
 		tstats = this_cpu_ptr(tunnel->dev->tstats);
 		u64_stats_update_begin(&tstats->syncp);
 		tstats->rx_packets++;
 		tstats->rx_bytes += skb->len;
 		u64_stats_update_end(&tstats->syncp);
 
-		__skb_tunnel_rx(skb, tunnel->dev);
-
-		skb_reset_network_header(skb);
-		if (skb->protocol == htons(ETH_P_IP))
-			ip6gre_ecn_decapsulate_ipv4(tunnel, ipv6h, skb);
-		else if (skb->protocol == htons(ETH_P_IPV6))
-			ip6gre_ecn_decapsulate_ipv6(tunnel, ipv6h, skb);
-
 		netif_rx(skb);
 
 		return 0;
--- a/include/net/inet_ecn.h	2012-08-15 08:59:22.766706151 -0700
+++ b/include/net/inet_ecn.h	2012-09-25 10:50:45.408313935 -0700
@@ -15,6 +15,8 @@ enum {
 	INET_ECN_MASK = 3,
 };
 
+extern int sysctl_tunnel_ecn_log;
+
 static inline int INET_ECN_is_ce(__u8 dsfield)
 {
 	return (dsfield & INET_ECN_MASK) == INET_ECN_CE;
@@ -145,4 +147,78 @@ static inline int INET_ECN_set_ce(struct
 	return 0;
 }
 
+/*
+ * RFC 6080 4.2
+ *  To decapsulate the inner header at the tunnel egress, a compliant
+ *  tunnel egress MUST set the outgoing ECN field to the codepoint at the
+ *  intersection of the appropriate arriving inner header (row) and outer
+ *  header (column) in Figure 4
+ *
+ *      +---------+------------------------------------------------+
+ *      |Arriving |            Arriving Outer Header               |
+ *      |   Inner +---------+------------+------------+------------+
+ *      |  Header | Not-ECT | ECT(0)     | ECT(1)     |     CE     |
+ *      +---------+---------+------------+------------+------------+
+ *      | Not-ECT | Not-ECT |Not-ECT(!!!)|Not-ECT(!!!)| <drop>(!!!)|
+ *      |  ECT(0) |  ECT(0) | ECT(0)     | ECT(1)     |     CE     |
+ *      |  ECT(1) |  ECT(1) | ECT(1) (!) | ECT(1)     |     CE     |
+ *      |    CE   |      CE |     CE     |     CE(!!!)|     CE     |
+ *      +---------+---------+------------+------------+------------+
+ *
+ *             Figure 4: New IP in IP Decapsulation Behaviour
+ *
+ *  returns 0 on success
+ *          1 if something is broken and should be logged (!!! above)
+ *          2 if packet should be dropped
+ */
+static inline int INET_ECN_decapsulate(struct sk_buff *skb,
+				       __u8 outer, __u8 inner)
+{
+	if (INET_ECN_is_not_ect(inner)) {
+		switch (outer & INET_ECN_MASK) {
+		case INET_ECN_NOT_ECT:
+			return 0;
+		case INET_ECN_ECT_0:
+		case INET_ECN_ECT_1:
+			return 1;
+		case INET_ECN_CE:
+			return 2;
+		}
+	}
+
+	if (INET_ECN_is_ce(outer))
+		INET_ECN_set_ce(skb);
+
+	return 0;
+}
+
+static inline int IP_ECN_decapsulate(const struct iphdr *oiph,
+				     struct sk_buff *skb)
+{
+	__u8 inner;
+
+	if (skb->protocol == htons(ETH_P_IP))
+		inner = ip_hdr(skb)->tos;
+	else if (skb->protocol == htons(ETH_P_IPV6))
+		inner = ipv6_get_dsfield(ipv6_hdr(skb));
+	else
+		return 0;
+
+	return INET_ECN_decapsulate(skb, oiph->tos, inner);
+}
+
+static inline int IP6_ECN_decapsulate(const struct ipv6hdr *oipv6h,
+				      struct sk_buff *skb)
+{
+	__u8 inner;
+
+	if (skb->protocol == htons(ETH_P_IP))
+		inner = ip_hdr(skb)->tos;
+	else if (skb->protocol == htons(ETH_P_IPV6))
+		inner = ipv6_get_dsfield(ipv6_hdr(skb));
+	else
+		return 0;
+
+	return INET_ECN_decapsulate(skb, ipv6_get_dsfield(oipv6h), inner);
+}
 #endif

^ permalink raw reply


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