Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 09/28] Remove ATHEROS_AR231X
From: Sergey Ryazanov @ 2014-02-12 10:50 UTC (permalink / raw)
  To: John W. Linville
  Cc: Oleksij Rempel, Richard Weinberger, Jonathan Bither,
	OpenWrt Development List, Hauke Mehrtens, Jiri Slaby,
	Nick Kossifidis, Luis R. Rodriguez,
	open list:ATHEROS ATH5K WIR..., open list:ATHEROS ATH5K WIR...,
	open, list@hauke-m.de:NETWORKING DRIVERS, open list,
	antonynpavlov@gmail.com, Florian Fainelli
In-Reply-To: <CAHNKnsRACSo=DfOyiHxqV3acv_wfZmz4tMnYAW0wo4OCibwdfA@mail.gmail.com>

2014-02-11 3:43 GMT+04:00 Sergey Ryazanov <ryazanov.s.a@gmail.com>:
> 2014-02-11 2:37 GMT+04:00 Florian Fainelli <florian@openwrt.org>:
>> 2014-02-10 4:38 GMT-08:00 Sergey Ryazanov <ryazanov.s.a@gmail.com>:
>>> 2014-02-10 16:17 GMT+04:00 Oleksij Rempel <linux@rempel-privat.de>:
>>>> Am 10.02.2014 13:05, schrieb Sergey Ryazanov:
>>>>> 2014-02-10 0:03 GMT+04:00 Richard Weinberger <richard@nod.at>:
>>>>>> Am 09.02.2014 20:18, schrieb Hauke Mehrtens:
>>>>>>> On 02/09/2014 07:47 PM, Richard Weinberger wrote:
>>>>>>>> The symbol is an orphan, get rid of it.
>>>>>>>>
>>>>>>>> Signed-off-by: Richard Weinberger <richard@nod.at>
>>>>>>>> ---
>>>>>>>>  drivers/net/wireless/ath/ath5k/Kconfig | 10 +++++-----
>>>>>>>>  drivers/net/wireless/ath/ath5k/ath5k.h | 28 ----------------------------
>>>>>>>>  drivers/net/wireless/ath/ath5k/base.c  | 14 --------------
>>>>>>>>  drivers/net/wireless/ath/ath5k/led.c   |  7 -------
>>>>>>>>  4 files changed, 5 insertions(+), 54 deletions(-)
>>>>>>>>
>>>>>>>
>>>>>>> This code is used in OpenWrt with an out of tree arch code for the
>>>>>>> Atheros 231x/531x SoC. [0] I do not think anyone is working on adding
>>>>>>> this code to mainline Linux kernel, because of lack of time/interest.
>>>>>>
>>>>>> Sorry, we don't maintain out of tree code.
>>>>>>
>>>>>
>>>>> Oleksij, Jonathan do you still working to make ar231x devices work
>>>>> with upstream, since your posts [1, 2]? Or may be someone from OpenWRT
>>>>> team would like to add upstream support?
>>>>>
>>>>> 1. https://lkml.org/lkml/2013/5/13/321
>>>>> 2. https://lkml.org/lkml/2013/5/13/358
>>>>>
>>>>
>>>> Hi,
>>>> my current target was to provide barebox and openocd support.
>>>> - ar2313 is already upstream on barebox.
>>>> - ar2315-2318 (barebox) awaiting review by Anthony Pavlov.
>>>> - openocd (EJTAG) support is ready and i'll push it ASUP.
>>>>
>>> WOW, Impressive.
>>
>> That's a nice toy project, although since there are is an existing
>> bootloader with sources, I would have shifted the priority towards
>> getting the kernel support merged such that the bootloader can be used
>> for something. BTW I sent a few devices to Jonathan, not sure if he
>> ever got those...
>>
>>>
>>>> I hope Jonathan do kernel part. If not, i can provide some work, since i
>>>> have testing boards and expiriance on this hardware.
>>>>
>>> If you need, I can test kernel part, or even do some porting work. I
>>> have some AR231x based boards, e.g. Ubnt LS2 and NS2.
>>
>> I guess you could start splitting the OpenWrt patches into a format
>> that makes them suitable for being merged upstream and starting with
>> the MIPS parts. There might be a bunch of checkpatch.pl cleanup work
>> to do before getting those submitted.
>
> I will do that if Jonathan does not have a working solution, which he
> would like to push upstream. So, let's wait for his reply.
>

John, can you delay the merging of this patch for a few months, I will
try to prepare the necessary patches to add AR231x architecture to the
kernel and send them to linux-mips.

-- 
BR,
Sergey

^ permalink raw reply

* [PATCH 3/3] be2net: refactor multi-channel config code for Skyhawk-R chip
From: Somnath Kotur @ 2014-02-12 10:39 UTC (permalink / raw)
  To: netdev; +Cc: davem, Vasundhara Volam, Sathya Perla, Somnath Kotur

From: Vasundhara Volam <vasundhara.volam@emulex.com>

Currently multi-channel configuration is read via the QUERY_FW_CONFIG cmd.
This method has been deprecated by the Skyhawk-R FW. Instead,
GET_PROFILE_CONFIG::port-desc must be used to query this configuration.

This patch also:
a) introduces a few macros to identify certain categories of multi-channel
configs
2) re-factors the be_cmd_set_profile_config() code to be able to read any kind
of desc (and not just the nic-desc.)

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be.h      |   12 +++-
 drivers/net/ethernet/emulex/benet/be_cmds.c |   20 ++++++
 drivers/net/ethernet/emulex/benet/be_cmds.h |   36 +++++++++---
 drivers/net/ethernet/emulex/benet/be_hw.h   |    4 +-
 drivers/net/ethernet/emulex/benet/be_main.c |   87 ++++++++++++++++++++------
 5 files changed, 127 insertions(+), 32 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 6c05f57..a150401 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -88,7 +88,6 @@ static inline char *nic_name(struct pci_dev *pdev)
 #define BE_MIN_MTU		256
 
 #define BE_NUM_VLANS_SUPPORTED	64
-#define BE_UMC_NUM_VLANS_SUPPORTED	15
 #define BE_MAX_EQD		128u
 #define	BE_MAX_TX_FRAG_COUNT	30
 
@@ -293,7 +292,7 @@ struct be_rx_compl_info {
 	u8 ip_csum;
 	u8 l4_csum;
 	u8 ipv6;
-	u8 vtm;
+	u8 qnq;
 	u8 pkt_type;
 	u8 ip_frag;
 };
@@ -465,6 +464,7 @@ struct be_adapter {
 
 	u32 port_num;
 	bool promiscuous;
+	u8 mc_type;
 	u32 function_mode;
 	u32 function_caps;
 	u32 rx_fc;		/* Rx flow control */
@@ -534,6 +534,14 @@ static inline u16 be_max_qs(struct be_adapter *adapter)
 	return min_t(u16, num, num_online_cpus());
 }
 
+/* Is BE in pvid_tagging mode */
+#define be_pvid_tagging_enabled(adapter)	(adapter->pvid)
+
+/* Is BE in QNQ multi-channel mode */
+#define be_is_qnq_mode(adapter)		(adapter->mc_type == FLEX10 ||  \
+					 adapter->mc_type == vNIC1 ||	\
+					 adapter->mc_type == UFP)
+
 #define lancer_chip(adapter)	(adapter->pdev->device == OC_DEVICE_ID3 || \
 				 adapter->pdev->device == OC_DEVICE_ID4)
 
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index a8106b3..72bde5d 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -3296,6 +3296,21 @@ static struct be_pcie_res_desc *be_get_pcie_desc(u8 devfn, u8 *buf,
 	return NULL;
 }
 
+static struct be_port_res_desc *be_get_port_desc(u8 *buf, u32 desc_count)
+{
+	struct be_res_desc_hdr *hdr = (struct be_res_desc_hdr *)buf;
+	int i;
+
+	for (i = 0; i < desc_count; i++) {
+		if (hdr->desc_type == PORT_RESOURCE_DESC_TYPE_V1)
+			return (struct be_port_res_desc *)hdr;
+
+		hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0;
+		hdr = (void *)hdr + hdr->desc_len;
+	}
+	return NULL;
+}
+
 static void be_copy_nic_desc(struct be_resources *res,
 			     struct be_nic_res_desc *desc)
 {
@@ -3439,6 +3454,7 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
 {
 	struct be_cmd_resp_get_profile_config *resp;
 	struct be_pcie_res_desc *pcie;
+	struct be_port_res_desc *port;
 	struct be_nic_res_desc *nic;
 	struct be_queue_info *mccq = &adapter->mcc_obj.q;
 	struct be_dma_mem cmd;
@@ -3466,6 +3482,10 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
 	if (pcie)
 		res->max_vfs = le16_to_cpu(pcie->num_vfs);
 
+	port = be_get_port_desc(resp->func_param, desc_count);
+	if (port)
+		adapter->mc_type = port->mc_type;
+
 	nic = be_get_nic_desc(resp->func_param, desc_count);
 	if (nic)
 		be_copy_nic_desc(res, nic);
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 3959566..d0ab980 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1098,14 +1098,6 @@ struct be_cmd_resp_query_fw_cfg {
 	u32 function_caps;
 };
 
-/* Is BE in a multi-channel mode */
-static inline bool be_is_mc(struct be_adapter *adapter)
-{
-	return adapter->function_mode & FLEX10_MODE ||
-		adapter->function_mode & VNIC_MODE ||
-		adapter->function_mode & UMC_ENABLED;
-}
-
 /******************** RSS Config ****************************************/
 /* RSS type		Input parameters used to compute RX hash
  * RSS_ENABLE_IPV4	SRC IPv4, DST IPv4
@@ -1828,6 +1820,7 @@ struct be_cmd_req_set_ext_fat_caps {
 #define NIC_RESOURCE_DESC_TYPE_V0		0x41
 #define PCIE_RESOURCE_DESC_TYPE_V1		0x50
 #define NIC_RESOURCE_DESC_TYPE_V1		0x51
+#define PORT_RESOURCE_DESC_TYPE_V1		0x55
 #define MAX_RESOURCE_DESC			264
 
 /* QOS unit number */
@@ -1891,6 +1884,33 @@ struct be_nic_res_desc {
 	u32 rsvd8[7];
 } __packed;
 
+/************ Multi-Channel type ***********/
+enum mc_type {
+	MC_NONE = 0x01,
+	UMC = 0x02,
+	FLEX10 = 0x03,
+	vNIC1 = 0x04,
+	nPAR = 0x05,
+	UFP = 0x06,
+	vNIC2 = 0x07
+};
+
+struct be_port_res_desc {
+	struct be_res_desc_hdr hdr;
+	u8 rsvd0;
+	u8 flags;
+	u8 rsvd1;
+	u8 mc_type;
+	u16 rsvd2;
+	u32 rsvd3[20];
+} __packed;
+
+/* Is BE in a multi-channel mode */
+static inline bool be_is_mc(struct be_adapter *adapter)
+{
+	return adapter->mc_type > MC_NONE;
+}
+
 struct be_cmd_req_get_func_config {
 	struct be_cmd_req_hdr hdr;
 };
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index effa272..28ac8dd 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -368,7 +368,7 @@ struct amap_eth_rx_compl_v0 {
 	u8 numfrags[3];		/* dword 1 */
 	u8 rss_flush;		/* dword 2 */
 	u8 cast_enc[2];		/* dword 2 */
-	u8 vtm;			/* dword 2 */
+	u8 qnq;			/* dword 2 */
 	u8 rss_bank;		/* dword 2 */
 	u8 rsvd1[23];		/* dword 2 */
 	u8 lro_pkt;		/* dword 2 */
@@ -401,7 +401,7 @@ struct amap_eth_rx_compl_v1 {
 	u8 numfrags[3];		/* dword 1 */
 	u8 rss_flush;		/* dword 2 */
 	u8 cast_enc[2];		/* dword 2 */
-	u8 vtm;			/* dword 2 */
+	u8 qnq;			/* dword 2 */
 	u8 rss_bank;		/* dword 2 */
 	u8 port[2];		/* dword 2 */
 	u8 vntagp;		/* dword 2 */
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 816d67b..a8cf03e 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -945,9 +945,9 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,
 	}
 
 	/* If vlan tag is already inlined in the packet, skip HW VLAN
-	 * tagging in UMC mode
+	 * tagging in pvid-tagging mode
 	 */
-	if ((adapter->function_mode & UMC_ENABLED) &&
+	if (be_pvid_tagging_enabled(adapter) &&
 	    veh->h_vlan_proto == htons(ETH_P_8021Q))
 			*skip_hw_vlan = true;
 
@@ -1660,7 +1660,7 @@ static void be_parse_rx_compl_v1(struct be_eth_rx_compl *compl,
 	rxcp->rss_hash =
 		AMAP_GET_BITS(struct amap_eth_rx_compl_v1, rsshash, compl);
 	if (rxcp->vlanf) {
-		rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vtm,
+		rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, qnq,
 					  compl);
 		rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag,
 					       compl);
@@ -1690,7 +1690,7 @@ static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl,
 	rxcp->rss_hash =
 		AMAP_GET_BITS(struct amap_eth_rx_compl_v0, rsshash, compl);
 	if (rxcp->vlanf) {
-		rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vtm,
+		rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, qnq,
 					  compl);
 		rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag,
 					       compl);
@@ -1723,9 +1723,11 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
 		rxcp->l4_csum = 0;
 
 	if (rxcp->vlanf) {
-		/* vlanf could be wrongly set in some cards.
-		 * ignore if vtm is not set */
-		if ((adapter->function_mode & FLEX10_MODE) && !rxcp->vtm)
+		/* In QNQ modes, if qnq bit is not set, then the packet was
+		 * tagged only with the transparent outer vlan-tag and must
+		 * not be treated as a vlan packet by host
+		 */
+		if (be_is_qnq_mode(adapter) && !rxcp->qnq)
 			rxcp->vlanf = 0;
 
 		if (!lancer_chip(adapter))
@@ -3109,6 +3111,22 @@ err:
 	return status;
 }
 
+/* Converting function_mode bits on BE3 to SH mc_type enums */
+
+static u8 be_convert_mc_type(u32 function_mode)
+{
+	if (function_mode & VNIC_MODE && function_mode & FLEX10_MODE)
+		return vNIC1;
+	else if (function_mode & FLEX10_MODE)
+		return FLEX10;
+	else if (function_mode & VNIC_MODE)
+		return vNIC2;
+	else if (function_mode & UMC_ENABLED)
+		return UMC;
+	else
+		return MC_NONE;
+}
+
 /* On BE2/BE3 FW does not suggest the supported limits */
 static void BEx_get_resources(struct be_adapter *adapter,
 			      struct be_resources *res)
@@ -3129,12 +3147,23 @@ static void BEx_get_resources(struct be_adapter *adapter,
 	else
 		res->max_uc_mac = BE_VF_UC_PMAC_COUNT;
 
-	if (adapter->function_mode & FLEX10_MODE)
-		res->max_vlans = BE_NUM_VLANS_SUPPORTED/8;
-	else if (adapter->function_mode & UMC_ENABLED)
-		res->max_vlans = BE_UMC_NUM_VLANS_SUPPORTED;
-	else
+	adapter->mc_type = be_convert_mc_type(adapter->function_mode);
+
+	if (be_is_mc(adapter)) {
+		/* Assuming that there are 4 channels per port,
+		 * when multi-channel is enabled
+		 */
+		if (be_is_qnq_mode(adapter))
+			res->max_vlans = BE_NUM_VLANS_SUPPORTED/8;
+		else
+			/* In a non-qnq multichannel mode, the pvid
+			 * takes up one vlan entry
+			 */
+			res->max_vlans = (BE_NUM_VLANS_SUPPORTED / 4) - 1;
+	} else {
 		res->max_vlans = BE_NUM_VLANS_SUPPORTED;
+	}
+
 	res->max_mcast_mac = BE_MAX_MC;
 
 	/* For BE3 1Gb ports, F/W does not properly support multiple TXQs */
@@ -4417,14 +4446,32 @@ static bool be_reset_required(struct be_adapter *adapter)
 
 static char *mc_name(struct be_adapter *adapter)
 {
-	if (adapter->function_mode & FLEX10_MODE)
-		return "FLEX10";
-	else if (adapter->function_mode & VNIC_MODE)
-		return "vNIC";
-	else if (adapter->function_mode & UMC_ENABLED)
-		return "UMC";
-	else
-		return "";
+	char *str = "";	/* default */
+
+	switch (adapter->mc_type) {
+	case UMC:
+		str = "UMC";
+		break;
+	case FLEX10:
+		str = "FLEX10";
+		break;
+	case vNIC1:
+		str = "vNIC-1";
+		break;
+	case nPAR:
+		str = "nPAR";
+		break;
+	case UFP:
+		str = "UFP";
+		break;
+	case vNIC2:
+		str = "vNIC-2";
+		break;
+	default:
+		str = "";
+	}
+
+	return str;
 }
 
 static inline char *func_name(struct be_adapter *adapter)
-- 
1.5.6.1

^ permalink raw reply related

* [PATCH 2/3] be2net: Update copyright year
From: Somnath Kotur @ 2014-02-12 10:39 UTC (permalink / raw)
  To: netdev; +Cc: davem, Vasundhara Volam, Sathya Perla, Somnath Kotur

From: Vasundhara Volam <vasundhara.volam@emulex.com>

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be.h         |    2 +-
 drivers/net/ethernet/emulex/benet/be_cmds.c    |    2 +-
 drivers/net/ethernet/emulex/benet/be_cmds.h    |    2 +-
 drivers/net/ethernet/emulex/benet/be_ethtool.c |    2 +-
 drivers/net/ethernet/emulex/benet/be_hw.h      |    2 +-
 drivers/net/ethernet/emulex/benet/be_main.c    |    2 +-
 drivers/net/ethernet/emulex/benet/be_roce.c    |    2 +-
 drivers/net/ethernet/emulex/benet/be_roce.h    |    2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 8d09615..6c05f57 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 48076a6..a8106b3 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index fc4e076..3959566 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index e775ba0..507177a 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index dc88782..effa272 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 7057545..816d67b 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/net/ethernet/emulex/benet/be_roce.c b/drivers/net/ethernet/emulex/benet/be_roce.c
index 9cd5415..a5dae4a 100644
--- a/drivers/net/ethernet/emulex/benet/be_roce.c
+++ b/drivers/net/ethernet/emulex/benet/be_roce.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/net/ethernet/emulex/benet/be_roce.h b/drivers/net/ethernet/emulex/benet/be_roce.h
index 2cd1129..a3ef8f8 100644
--- a/drivers/net/ethernet/emulex/benet/be_roce.h
+++ b/drivers/net/ethernet/emulex/benet/be_roce.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005 - 2013 Emulex
+ * Copyright (C) 2005 - 2014 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
-- 
1.5.6.1

^ permalink raw reply related

* [PATCH 1/3] be2net: Log a kernel message when UE is detected in BE & Skyhawk
From: Somnath Kotur @ 2014-02-12 10:37 UTC (permalink / raw)
  To: netdev; +Cc: davem, Somnath Kotur

This patch logs a kernel message when a HW error(SLIPORT_ERROR in Lancer and UE
in BEx/Skyhawk) is detected. The log message for BE3 was missing earlier.
This patch also refactors the code by segregating error-detection and reporting
code for Lancer and BEx/SH.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c |   82 +++++++++++++-------------
 1 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 04ac9c6..7057545 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2423,6 +2423,9 @@ void be_detect_error(struct be_adapter *adapter)
 	u32 ue_lo = 0, ue_hi = 0, ue_lo_mask = 0, ue_hi_mask = 0;
 	u32 sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0;
 	u32 i;
+	bool error_detected = false;
+	struct device *dev = &adapter->pdev->dev;
+	struct net_device *netdev = adapter->netdev;
 
 	if (be_hw_error(adapter))
 		return;
@@ -2434,6 +2437,21 @@ void be_detect_error(struct be_adapter *adapter)
 					SLIPORT_ERROR1_OFFSET);
 			sliport_err2 = ioread32(adapter->db +
 					SLIPORT_ERROR2_OFFSET);
+			adapter->hw_error = true;
+			/* Do not log error messages if its a FW reset */
+			if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 &&
+			    sliport_err2 == SLIPORT_ERROR_FW_RESET2) {
+				dev_info(dev, "Firmware update in progress\n");
+			} else {
+				error_detected = true;
+				dev_err(dev, "Error detected in the card\n");
+				dev_err(dev, "ERR: sliport status 0x%x\n",
+					sliport_status);
+				dev_err(dev, "ERR: sliport error1 0x%x\n",
+					sliport_err1);
+				dev_err(dev, "ERR: sliport error2 0x%x\n",
+					sliport_err2);
+			}
 		}
 	} else {
 		pci_read_config_dword(adapter->pdev,
@@ -2447,51 +2465,33 @@ void be_detect_error(struct be_adapter *adapter)
 
 		ue_lo = (ue_lo & ~ue_lo_mask);
 		ue_hi = (ue_hi & ~ue_hi_mask);
-	}
-
-	/* On certain platforms BE hardware can indicate spurious UEs.
-	 * Allow the h/w to stop working completely in case of a real UE.
-	 * Hence not setting the hw_error for UE detection.
-	 */
-	if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
-		adapter->hw_error = true;
-		/* Do not log error messages if its a FW reset */
-		if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 &&
-		    sliport_err2 == SLIPORT_ERROR_FW_RESET2) {
-			dev_info(&adapter->pdev->dev,
-				 "Firmware update in progress\n");
-			return;
-		} else {
-			dev_err(&adapter->pdev->dev,
-				"Error detected in the card\n");
-		}
-	}
 
-	if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
-		dev_err(&adapter->pdev->dev,
-			"ERR: sliport status 0x%x\n", sliport_status);
-		dev_err(&adapter->pdev->dev,
-			"ERR: sliport error1 0x%x\n", sliport_err1);
-		dev_err(&adapter->pdev->dev,
-			"ERR: sliport error2 0x%x\n", sliport_err2);
-	}
-
-	if (ue_lo) {
-		for (i = 0; ue_lo; ue_lo >>= 1, i++) {
-			if (ue_lo & 1)
-				dev_err(&adapter->pdev->dev,
-				"UE: %s bit set\n", ue_status_low_desc[i]);
-		}
-	}
+		/* On certain platforms BE hardware can indicate spurious UEs.
+		 * Allow HW to stop working completely in case of a real UE.
+		 * Hence not setting the hw_error for UE detection.
+		 */
 
-	if (ue_hi) {
-		for (i = 0; ue_hi; ue_hi >>= 1, i++) {
-			if (ue_hi & 1)
-				dev_err(&adapter->pdev->dev,
-				"UE: %s bit set\n", ue_status_hi_desc[i]);
+		if (ue_lo || ue_hi) {
+			error_detected = true;
+			dev_err(dev,
+				"Unrecoverable Error detected in the adapter");
+			dev_err(dev, "Please reboot server to recover");
+			if (skyhawk_chip(adapter))
+				adapter->hw_error = true;
+			for (i = 0; ue_lo; ue_lo >>= 1, i++) {
+				if (ue_lo & 1)
+					dev_err(dev, "UE: %s bit set\n",
+						ue_status_low_desc[i]);
+			}
+			for (i = 0; ue_hi; ue_hi >>= 1, i++) {
+				if (ue_hi & 1)
+					dev_err(dev, "UE: %s bit set\n",
+						ue_status_hi_desc[i]);
+			}
 		}
 	}
-
+	if (error_detected)
+		netif_carrier_off(netdev);
 }
 
 static void be_msix_disable(struct be_adapter *adapter)
-- 
1.5.6.1

^ permalink raw reply related

* [PATCH net-next] be2net patches
From: Somnath Kotur @ 2014-02-12 10:37 UTC (permalink / raw)
  To: netdev; +Cc: davem, Somnath Kotur

Please apply.

Somnath Kotur (1):
  be2net: This patch logs a kernel message when a HW
    error(SLIPORT_ERROR in Lancer and UE in BEx/Skyhawk)

Vasundhara Volam (2):
  be2net: Update copyright year
  be2net: refactor multi-channel config code for Skyhawk-R chip

 drivers/net/ethernet/emulex/benet/be.h         |   14 ++-
 drivers/net/ethernet/emulex/benet/be_cmds.c    |   22 +++-
 drivers/net/ethernet/emulex/benet/be_cmds.h    |   38 ++++--
 drivers/net/ethernet/emulex/benet/be_ethtool.c |    2 +-
 drivers/net/ethernet/emulex/benet/be_hw.h      |    6 +-
 drivers/net/ethernet/emulex/benet/be_main.c    |  171 +++++++++++++++---------
 drivers/net/ethernet/emulex/benet/be_roce.c    |    2 +-
 drivers/net/ethernet/emulex/benet/be_roce.h    |    2 +-
 8 files changed, 176 insertions(+), 81 deletions(-)

^ permalink raw reply

* pull-request: can 2014-02-12
From: Marc Kleine-Budde @ 2014-02-12 10:35 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

this is a pull request with one patch for net/master, for the current release
cycle. Olivier Sobrie noticed and fixed that the kvaser_usb driver doesn't
check the number of channels value from the hardware, which may result in
writing over the bounds of an array in the driver.

regards,
Marc

---

The following changes since commit 738b52bb9845da183b6ff46a8f685b56a63379d1:

  Merge tag 'microblaze-3.14-rc3' of git://git.monstr.eu/linux-2.6-microblaze (2014-02-11 12:24:35 -0800)

are available in the git repository at:


  git://gitorious.org/linux-can/linux-can.git tags/linux-can-fixes-for-3.14-20140212

for you to fetch changes up to 862474f8b46f6c1e600d4934e40ba40646c696ec:

  can: kvaser_usb: check number of channels returned by HW (2014-02-12 10:42:02 +0100)

----------------------------------------------------------------
linux-can-fixes-for-3.14-20140212

----------------------------------------------------------------
Olivier Sobrie (1):
      can: kvaser_usb: check number of channels returned by HW

 drivers/net/can/usb/kvaser_usb.c | 2 ++
 1 file changed, 2 insertions(+)

^ permalink raw reply

* [PATCH] can: kvaser_usb: check number of channels returned by HW
From: Marc Kleine-Budde @ 2014-02-12 10:35 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Olivier Sobrie, linux-stable,
	Marc Kleine-Budde
In-Reply-To: <1392201340-6909-1-git-send-email-mkl@pengutronix.de>

From: Olivier Sobrie <olivier@sobrie.be>

It is needed to check the number of channels returned by the HW because it
cannot be greater than MAX_NET_DEVICES otherwise it will crash.

Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/kvaser_usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 6c859bb..e77d110 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -473,6 +473,8 @@ static int kvaser_usb_get_card_info(struct kvaser_usb *dev)
 		return err;
 
 	dev->nchannels = msg.u.cardinfo.nchannels;
+	if (dev->nchannels > MAX_NET_DEVICES)
+		return -EINVAL;
 
 	return 0;
 }
-- 
1.8.5.3


^ permalink raw reply related

* pull-request: can-next 2014-02-12
From: Marc Kleine-Budde @ 2014-02-12 10:15 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, linux-can@vger.kernel.org, kernel@pengutronix.de

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

Hello David,

this is a pull request of eight patches for net-next/master.

Florian Vaussard contributed a series that merged the sja1000 of_platform
into the platform driver. The of_platform driver is finally removed.
Stephane Grosjean supplied a patch to allocate CANFD skbs. In a patch
by Uwe Kleine-König another missing copyright information was added to
a userspace header. And a patch by Yoann DI RUZZA that adds listen only
mode to the at91_can driver.

regards,
Marc
---
The following changes since commit 77d143de75812596a58d126606f42d1214e09dde:

  Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml (2014-01-26 11:06:16 -0800)

are available in the git repository at:


  git://gitorious.org/linux-can/linux-can-next.git tags/linux-can-next-for-3.15-20140212

for you to fetch changes up to 17a50ee4bd47bdba94546e0526fc9ce93dc77d5e:

  can: at91_can: add listen only mode (2014-02-11 09:55:44 +0100)

----------------------------------------------------------------
linux-can-next-for-3.15-20140212

----------------------------------------------------------------
Florian Vaussard (5):
      can: sja1000: convert printk to use netdev API
      can: sja1000: platform: use devm_* APIs
      can: sja1000: fuse of_platform into platform
      Documentation: devicetree: sja1000: add reg-io-width binding
      can: sja1000: of: add reg-io-width property for 8, 16 and 32-bit register access

Stephane Grosjean (1):
      can: add ability to allocate CANFD frame in skb data

Uwe Kleine-König (1):
      can: add explicit copyrights to can userspace header

Yoann DI RUZZA (1):
      can: at91_can: add listen only mode

 .../devicetree/bindings/net/can/sja1000.txt        |   4 +
 drivers/net/can/at91_can.c                         |   9 +-
 drivers/net/can/dev.c                              |  24 +++
 drivers/net/can/sja1000/Kconfig                    |  13 +-
 drivers/net/can/sja1000/Makefile                   |   1 -
 drivers/net/can/sja1000/sja1000.c                  |   3 +-
 drivers/net/can/sja1000/sja1000_of_platform.c      | 220 ---------------------
 drivers/net/can/sja1000/sja1000_platform.c         | 194 ++++++++++++------
 include/linux/can/dev.h                            |   2 +
 include/uapi/linux/can.h                           |  32 +++
 10 files changed, 206 insertions(+), 296 deletions(-)
 delete mode 100644 drivers/net/can/sja1000/sja1000_of_platform.c

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

^ permalink raw reply

* Re: [PATCH] USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Device Driver Support
From: Thierry Reding @ 2014-02-12 10:12 UTC (permalink / raw)
  To: liujunliang_ljl
  Cc: davem, horms, joe, romieu, gregkh, netdev, linux-usb,
	linux-kernel, sunhecheng
In-Reply-To: <1392010419-5217-1-git-send-email-liujunliang_ljl@163.com>

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

On Mon, Feb 10, 2014 at 01:33:39PM +0800, liujunliang_ljl@163.com wrote:
> From: Liu Junliang <liujunliang_ljl@163.com>
> 
> 
> Signed-off-by: Liu Junliang <liujunliang_ljl@163.com>
> ---
>  drivers/net/usb/Kconfig  |   16 +
>  drivers/net/usb/Makefile |    1 +
>  drivers/net/usb/sr9800.c |  873 ++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/net/usb/sr9800.h |  202 +++++++++++
>  4 files changed, 1092 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/net/usb/sr9800.c
>  create mode 100644 drivers/net/usb/sr9800.h
> 
> diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
> index 47b0f73..2551bf6 100644
> --- a/drivers/net/usb/Kconfig
> +++ b/drivers/net/usb/Kconfig
> @@ -291,6 +291,22 @@ config USB_NET_SR9700
>  	  This option adds support for CoreChip-sz SR9700 based USB 1.1
>  	  10/100 Ethernet adapters.
>  
> +config USB_NET_SR9800
> +	tristate "CoreChip-sz SR9800 based USB 2.0 10/100 ethernet devices"
> +	depends on USB_USBNET
> +	select CRC32
> +	default y

Why is this selected by default? I can see that some of the other USB
network drivers are also selected by default, but not all of them. Is
there some rule of thumb as to which should default to y and which
shouldn't?

Thierry

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

^ permalink raw reply

* Re: [PATCH V2 5/6] vhost_net: poll vhost queue after marking DMA is done
From: Jason Wang @ 2014-02-12 10:06 UTC (permalink / raw)
  To: Qin Chuanyu, virtualization, netdev, linux-kernel; +Cc: kvm, mst
In-Reply-To: <52FB24EA.3060001@huawei.com>

On 02/12/2014 03:38 PM, Qin Chuanyu wrote:
> On 2013/8/30 12:29, Jason Wang wrote:
>> We used to poll vhost queue before making DMA is done, this is racy
>> if vhost
>> thread were waked up before marking DMA is done which can result the
>> signal to
>> be missed. Fix this by always poll the vhost thread before DMA is done.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>>   drivers/vhost/net.c |    9 +++++----
>>   1 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index ff60c2a..d09c17c 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -308,6 +308,11 @@ static void vhost_zerocopy_callback(struct
>> ubuf_info *ubuf, bool success)
>>       struct vhost_virtqueue *vq = ubufs->vq;
>>       int cnt = atomic_read(&ubufs->kref.refcount);
>>
>> +    /* set len to mark this desc buffers done DMA */
>> +    vq->heads[ubuf->desc].len = success ?
>> +        VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;
>> +    vhost_net_ubuf_put(ubufs);
>> +
>>       /*
>>        * Trigger polling thread if guest stopped submitting new buffers:
>>        * in this case, the refcount after decrement will eventually
>> reach 1
>> @@ -318,10 +323,6 @@ static void vhost_zerocopy_callback(struct
>> ubuf_info *ubuf, bool success)
>>        */
>>       if (cnt <= 2 || !(cnt % 16))
>>           vhost_poll_queue(&vq->poll);
>> -    /* set len to mark this desc buffers done DMA */
>> -    vq->heads[ubuf->desc].len = success ?
>> -        VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;
>> -    vhost_net_ubuf_put(ubufs);
>>   }
>>
>>   /* Expects to be always run from workqueue - which acts as
>>
> with this change, vq would lose protection that provided by ubufs->kref.
> if another thread is waiting at vhost_net_ubuf_put_and_wait called by
> vhost_net_release, then after vhost_net_ubuf_put, vq would been free
> by vhost_net_release soon, vhost_poll_queue(&vq->poll) may cause NULL
> pointer Exception.
>

Good catch.
> another question is that vhost_zerocopy_callback is called by kfree_skb,
> it may called in different thread context.
> vhost_poll_queue is called decided by ubufs->kref.refcount, this may
> cause there isn't any thread call  vhost_poll_queue, but at least one
> is needed. and this cause network break.
> We could repeat it by using 8 netperf thread in guest to xmit tcp to
> its host.
>
> I think if using atomic_read to decide while do vhost_poll_queue or not,
> at least a spink_lock is needed.

Then you need another ref count to protect that spinlock? Care to send
patches?

Thanks
>
> -- 
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [Patch net] macvlan: add NETIF_F_NETNS_LOCAL flag
From: Nicolas Dichtel @ 2014-02-12 10:03 UTC (permalink / raw)
  To: Eric Dumazet, Cong Wang
  Cc: Hannes Frederic Sowa, Cong Wang, netdev, Patrick McHardy,
	David S. Miller
In-Reply-To: <1392097099.6615.74.camel@edumazet-glaptop2.roam.corp.google.com>

Le 11/02/2014 06:38, Eric Dumazet a écrit :
> On Mon, 2014-02-10 at 21:37 -0800, Eric Dumazet wrote:
>
>>
>> Simple patch would be :
>>
>> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
>> index 048dc8d183aa..31bbba34fd1e 100644
>> --- a/net/core/rtnetlink.c
>> +++ b/net/core/rtnetlink.c
>> @@ -963,6 +963,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
>>   	    nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) ||
>>   #endif
>>   	    (dev->ifindex != dev->iflink &&
>> +	     __dev_get_by_index(dev_net(dev), dev->iflink) &&
>>   	     nla_put_u32(skb, IFLA_LINK, dev->iflink)) ||
>>   	    (upper_dev &&
>>   	     nla_put_u32(skb, IFLA_MASTER, upper_dev->ifindex)) ||
>>
>
> Hmm, not enough.
>
> We probably need to keep a pointer to iflink net structure.
This is also used in ip tunnels, but when i/o device is not in the same netns
that the tunnel device, the userland can not interpret that IFLA_LINK attribute
(userland don't have necessary information to access another netns, maybe they
will be able to do it in the future ;-)).

The goal of your patch was to avoid filling this attribute when iflink is
into a netns != from dev_net(dev)?

If yes, I agree that we need to keep a pointer to the net structure of iflink.
This information is already available in ip tunnels (struct ip_tunnel->net,
struct ip6_tnl->net) but is not generic. Maybe we can move it to struct
net_device?

^ permalink raw reply

* [PATCH] netfilter: nft_meta: fix typo "CONFIG_NET_CLS_ROUTE"
From: Paul Bolle @ 2014-02-12  9:53 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik,
	David S. Miller
  Cc: Richard Weinberger, netfilter-devel, netfilter, coreteam, netdev,
	linux-kernel

There are two checks for CONFIG_NET_CLS_ROUTE, but the corresponding
Kconfig symbol was dropped in v2.6.39. Since the code guards access to
dst_entry.tclassid it seems CONFIG_IP_ROUTE_CLASSID should be used
instead.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
Untested! I don't use CONFIG_NF_TABLES in my .config (yet). Besides, I
would have no clue how to runtime test this.

And, yes, typo is stretching it a bit.

 net/netfilter/nft_meta.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c
index e8254ad..425cf39 100644
--- a/net/netfilter/nft_meta.c
+++ b/net/netfilter/nft_meta.c
@@ -116,7 +116,7 @@ static void nft_meta_get_eval(const struct nft_expr *expr,
 				 skb->sk->sk_socket->file->f_cred->fsgid);
 		read_unlock_bh(&skb->sk->sk_callback_lock);
 		break;
-#ifdef CONFIG_NET_CLS_ROUTE
+#ifdef CONFIG_IP_ROUTE_CLASSID
 	case NFT_META_RTCLASSID: {
 		const struct dst_entry *dst = skb_dst(skb);
 
@@ -199,7 +199,7 @@ static int nft_meta_init_validate_get(uint32_t key)
 	case NFT_META_OIFTYPE:
 	case NFT_META_SKUID:
 	case NFT_META_SKGID:
-#ifdef CONFIG_NET_CLS_ROUTE
+#ifdef CONFIG_IP_ROUTE_CLASSID
 	case NFT_META_RTCLASSID:
 #endif
 #ifdef CONFIG_NETWORK_SECMARK
-- 
1.8.5.3

^ permalink raw reply related

* Re: [Patch net] macvlan: add NETIF_F_NETNS_LOCAL flag
From: Nicolas Dichtel @ 2014-02-12  9:47 UTC (permalink / raw)
  To: Eric Dumazet, Hannes Frederic Sowa
  Cc: Cong Wang, Cong Wang, netdev, Patrick McHardy, David S. Miller
In-Reply-To: <1392092120.6615.64.camel@edumazet-glaptop2.roam.corp.google.com>

Le 11/02/2014 05:15, Eric Dumazet a écrit :
> On Tue, 2014-02-11 at 03:40 +0100, Hannes Frederic Sowa wrote:
>
>> Setting up a macvlan and moving it into another namespace without moving
>> the parent device is a nice feature. I am not an administrator, so I don't
>> use that stuff often, but given you can easily spawn namespaces and put
>> applications into them, one of the easiest things to connect those to
>> local network without routing over veth and such is the macvlan interface.
>
> Exactly.

I also agree.

^ permalink raw reply

* The kmemleak detector reports about leaked "struct net"
From: Andrey Wagin @ 2014-02-12  9:42 UTC (permalink / raw)
  To: netdev

A kernel is compiled from Linus' tree without additional changes.
[root@jenkins ~]# uname -a
Linux jenkins.criu.org 3.14.0-rc2 #162 SMP Tue Feb 11 01:09:33 MSK
2014 x86_64 x86_64 x86_64 GNU/Linux

Sometimes I have found reports from the kmemleak detector about leaked
"struct net".

Here is a script to reproduce these leaks:
[root@jenkins ~]# cat test_net_ns.sh
ip net add test &&
ip link add name veth0 type veth peer name veth1 &&
ip link set dev veth1 netns test &&
ip net exec test ip link set up dev veth1 &&
ip link set up dev veth0 &&
brctl addif br0 veth0 &&
ip net exec test dhclient -4 veth1 -pf test.dhcp.pid -lf test.dhcp.lease &&
ip net exec test ip a
ip net exec test dhclient -r -pf test.dhcp.pid -lf test.dhcp.lease &&
ip net delete test &&
true || echo FAIL

This script creates a network namespace and a veth pair. One veth
device is attached to a bridge, another one is moved in namespace. The
dhclient gets ip address for the veth device in the test network
namespace. The final action is destroying the test network namespace.

[root@jenkins ~]# echo clear > /sys/kernel/debug/kmemleak
[root@jenkins ~]# bash -x test_net_ns.sh
+ ip net add test
+ ip link add name veth0 type veth peer name veth1
+ ip link set dev veth1 netns test
+ ip net exec test ip link set up dev veth1
+ ip link set up dev veth0
+ brctl addif br0 veth0
+ ip net exec test dhclient -4 veth1 -pf test.dhcp.pid -lf test.dhcp.lease
+ ip net exec test ip a
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
23: veth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP group default qlen 1000
    link/ether ae:f9:75:20:9c:92 brd ff:ff:ff:ff:ff:ff
    inet 10.30.24.229/16 brd 10.30.255.255 scope global dynamic veth1
       valid_lft 3558sec preferred_lft 3558sec
    inet6 fe80::acf9:75ff:fe20:9c92/64 scope link
       valid_lft forever preferred_lft forever
+ ip net exec test ip r
default via 10.30.0.1 dev veth1
10.30.0.0/16 dev veth1  proto kernel  scope link  src 10.30.24.229
+ ip net exec test dhclient -r -pf test.dhcp.pid -lf test.dhcp.lease
+ ip net delete test
+ true
[root@jenkins ~]# echo scan > /sys/kernel/debug/kmemleak
[root@jenkins ~]# cat /sys/kernel/debug/kmemleak
[root@jenkins ~]# echo scan > /sys/kernel/debug/kmemleak
[root@jenkins ~]# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff88009bfc3c80 (size 128):
  comm "ip", pid 25985, jiffies 4346037464 (age 4507.484s)
  hex dump (first 32 bytes):
    0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 b0 53 eb 0e 01 88 ff ff  .........S......
  backtrace:
    [<ffffffff8176858e>] kmemleak_alloc+0x5e/0xc0
    [<ffffffff811f6d3f>] __kmalloc+0x1bf/0x2e0
    [<ffffffff81636351>] net_alloc_generic+0x21/0x30
    [<ffffffff81636855>] copy_net_ns+0x45/0x160
    [<ffffffff810b4c91>] create_new_namespaces+0x101/0x1b0
    [<ffffffff810b4dc5>] unshare_nsproxy_namespaces+0x85/0xe0
    [<ffffffff810810eb>] SyS_unshare+0x1ab/0x350
    [<ffffffff8177bfe9>] system_call_fastpath+0x16/0x1b
    [<ffffffffffffffff>] 0xffffffffffffffff
unreferenced object 0xffff88006b3a92c0 (size 4416):
  comm "ip", pid 25985, jiffies 4346037464 (age 4507.484s)
  hex dump (first 32 bytes):
    02 00 00 00 00 00 00 00 08 08 00 00 ad 4e ad de  .............N..
    ff ff ff ff 00 00 00 00 ff ff ff ff ff ff ff ff  ................
  backtrace:
    [<ffffffff8176858e>] kmemleak_alloc+0x5e/0xc0
    [<ffffffff811f5f47>] kmem_cache_alloc+0x217/0x2a0
    [<ffffffff81636875>] copy_net_ns+0x65/0x160
    [<ffffffff810b4c91>] create_new_namespaces+0x101/0x1b0
    [<ffffffff810b4dc5>] unshare_nsproxy_namespaces+0x85/0xe0
    [<ffffffff810810eb>] SyS_unshare+0x1ab/0x350
    [<ffffffff8177bfe9>] system_call_fastpath+0x16/0x1b
    [<ffffffffffffffff>] 0xffffffffffffffff

[root@jenkins ~]# lsmod
Module                  Size  Used by
veth                   13604  0
binfmt_misc            17392  0
ip6table_filter        12815  0
ip6_tables             26677  1 ip6table_filter
tun                    32328  0
netlink_diag           12658  0
af_packet_diag         12604  0
udp_diag               12794  0
tcp_diag               12591  0
inet_diag              18278  2 tcp_diag,udp_diag
unix_diag              12594  0
bridge                116990  0
stp                    12989  1 bridge
llc                    14094  2 stp,bridge
btrfs                 933081  1
xor                    21366  1 btrfs
raid6_pq               96781  1 btrfs
joydev                 17642  0
microcode              19962  0
i2c_piix4              22148  0
virtio_net             28194  0
i2c_core               38545  1 i2c_piix4
virtio_balloon         13451  0
pcspkr                 12718  0
virtio_blk             18030  6
virtio_pci             17713  0
virtio_ring            19923  4 virtio_blk,virtio_net,virtio_pci,virtio_balloon
virtio                 14207  4 virtio_blk,virtio_net,virtio_pci,virtio_balloon
floppy                 73436  0

^ permalink raw reply

* Re: [PATCH net] net: Clear local_df only if crossing namespace.
From: Nicolas Dichtel @ 2014-02-12  9:32 UTC (permalink / raw)
  To: Pravin Shelar, David Miller, netdev, Templin, Fred L,
	Steffen Klassert
In-Reply-To: <CALnjE+r5zUs0GKUESoum2YumjbfU2XKhDjjcoWUv2D8yiGEYkA@mail.gmail.com>

Le 12/02/2014 05:26, Pravin Shelar a écrit :
> On Mon, Feb 10, 2014 at 6:11 PM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
>> On Mon, Feb 10, 2014 at 01:00:14PM -0800, Pravin Shelar wrote:
>>> On Fri, Feb 7, 2014 at 4:58 PM, Hannes Frederic Sowa
>>> <hannes@stressinduktion.org> wrote:
>>>> May I know because of wich vport, vxlan or gre, you did this change?
>>>>
>>> It affects both gre and vxlan.
>>
>> Ok, thanks.
>>
>>>> I am feeling a bit uncomfortable handling remote and local packets that
>>>> differently on lower tunnel output (local_df is mostly set on locally
>>>> originating packets).
>>>
>>> For ip traffic it make sense to turn on local_df only for local
>>> traffic, since for remote case we can send icmp (frag-needed) back to
>>> source. No such thing exist for OVS tunnels. ICMP packet are not
>>> returned to source for the tunnels. That is why to be on safe side,
>>> local_df is turned on for tunnels in OVS.
>>
>> I have a proposal:
>>
>> I don't like it that much because of the many arguments. But I currently
>> don't see another easy solution. Maybe we should make bool xnet an enum and
>> test with bitops?
>>
>> I left the clearing of local_df in skb_scrub_packet as we need it for the
>> dev_forward_skb case and it should be done that in any case.
>>
>> This diff is slightly compile tested. ;)
>>
>> I can test and make proper submit if you agree.
>>
>> What do you think?
>>
>
> I am not sure why the caller can not just set skb->local_df before
> calling iptunnel_xmit() rather than passing extra arg to this
> function?
> There are not that many caller of this function.
The benefit is that it ensures that future callers will think about this point
;-)

Steffen is reworking vti code and will use skb_scrub_packet(), I CC'ed him in
case he has some comment about this change.


Regards,
Nicolas

^ permalink raw reply

* [PATCH -next] gre: return more precise errno value when adding tunnel fails
From: Florian Westphal @ 2014-02-12  9:28 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal

Currently this always returns ENOBUFS, because the return value of
__ip_tunnel_create is discarded.

A more common failure is a duplicate name (EEXIST).  Propagate the real
error code so userspace can display a more meaningful error message.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/ipv4/ip_tunnel.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 90ff957..ef43356 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -393,7 +393,7 @@ static struct ip_tunnel *ip_tunnel_create(struct net *net,
 	fbt = netdev_priv(itn->fb_tunnel_dev);
 	dev = __ip_tunnel_create(net, itn->fb_tunnel_dev->rtnl_link_ops, parms);
 	if (IS_ERR(dev))
-		return NULL;
+		return (void *) dev;
 
 	dev->mtu = ip_tunnel_bind_dev(dev);
 
@@ -732,9 +732,13 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd)
 
 		t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type);
 
-		if (!t && (cmd == SIOCADDTUNNEL))
+		if (!t && (cmd == SIOCADDTUNNEL)) {
 			t = ip_tunnel_create(net, itn, p);
-
+			if (IS_ERR(t)) {
+				err = PTR_ERR(t);
+				break;
+			}
+		}
 		if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) {
 			if (t != NULL) {
 				if (t->dev != dev) {
@@ -761,8 +765,9 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd)
 		if (t) {
 			err = 0;
 			ip_tunnel_update(itn, t, dev, p, true);
-		} else
-			err = (cmd == SIOCADDTUNNEL ? -ENOBUFS : -ENOENT);
+		} else {
+			err = -ENOENT;
+		}
 		break;
 
 	case SIOCDELTUNNEL:
-- 
1.8.1.5

^ permalink raw reply related

* [PATCH net-next] socket: replace some printk with pr_*
From: Yang Yingliang @ 2014-02-12  9:09 UTC (permalink / raw)
  To: netdev; +Cc: davem

Prefer pr_*(...) to printk(KERN_* ...).

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 net/socket.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 879933a..840cffb 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -593,7 +593,7 @@ void sock_release(struct socket *sock)
 	}
 
 	if (rcu_dereference_protected(sock->wq, 1)->fasync_list)
-		printk(KERN_ERR "sock_release: fasync list not empty!\n");
+		pr_err("%s: fasync list not empty!\n", __func__);
 
 	if (test_bit(SOCK_EXTERNALLY_ALLOCATED, &sock->flags))
 		return;
@@ -1265,8 +1265,8 @@ int __sock_create(struct net *net, int family, int type, int protocol,
 		static int warned;
 		if (!warned) {
 			warned = 1;
-			printk(KERN_INFO "%s uses obsolete (PF_INET,SOCK_PACKET)\n",
-			       current->comm);
+			pr_info("%s uses obsolete (PF_INET,SOCK_PACKET)\n",
+				current->comm);
 		}
 		family = PF_PACKET;
 	}
@@ -2595,8 +2595,7 @@ int sock_register(const struct net_proto_family *ops)
 	int err;
 
 	if (ops->family >= NPROTO) {
-		printk(KERN_CRIT "protocol %d >= NPROTO(%d)\n", ops->family,
-		       NPROTO);
+		pr_crit("protocol %d >= NPROTO(%d)\n", ops->family, NPROTO);
 		return -ENOBUFS;
 	}
 
@@ -2610,7 +2609,7 @@ int sock_register(const struct net_proto_family *ops)
 	}
 	spin_unlock(&net_family_lock);
 
-	printk(KERN_INFO "NET: Registered protocol family %d\n", ops->family);
+	pr_info("NET: Registered protocol family %d\n", ops->family);
 	return err;
 }
 EXPORT_SYMBOL(sock_register);
@@ -2638,7 +2637,7 @@ void sock_unregister(int family)
 
 	synchronize_rcu();
 
-	printk(KERN_INFO "NET: Unregistered protocol family %d\n", family);
+	pr_info("NET: Unregistered protocol family %d\n", family);
 }
 EXPORT_SYMBOL(sock_unregister);
 
-- 
1.8.0

^ permalink raw reply related

* Re: [PATCH V3] net/dt: Add support for overriding phy configuration from device tree
From: Gerlando Falauto @ 2014-02-12  8:57 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Matthew Garrett, netdev, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Kishon Vijay Abraham I
In-Reply-To: <CAGVrzca7CV1SM0PfV2o=02Zd8z-65002kq6e-fhG6gWdkCadGA@mail.gmail.com>

Hi Florian,

On 02/11/2014 06:43 PM, Florian Fainelli wrote:
> Hi Gerlando,
>
> 2014-02-11 1:09 GMT-08:00 Gerlando Falauto <gerlando.falauto@keymile.com>:
>> Hi Florian,
>>
>> first of all, thank you for your answer.
>>
>>
>> On 02/10/2014 06:09 PM, Florian Fainelli wrote:
>>>
>>> Hi Gerlando,
>>>
>>> Le lundi 10 février 2014, 17:14:59 Gerlando Falauto a écrit :
>>>>
>>>> Hi,
>>>>
>>>> I'm currently trying to fix an issue for which this patch provides a
>>>> partial solution, so apologies in advance for jumping into the
>>>> discussion for my own purposes...
>>>>
>>>> On 02/04/2014 09:39 PM, Florian Fainelli wrote:> 2014-01-17 Matthew
>>>>
>>>> Garrett <matthew.garrett@nebula.com>:
>>>>    >> Some hardware may be broken in interesting and board-specific ways,
>>>> such
>>>>    >> that various bits of functionality don't work. This patch provides a
>>>>    >> mechanism for overriding mii registers during init based on the
>>>>
>>>> contents of
>>>>
>>>>    >> the device tree data, allowing board-specific fixups without having
>>>> to
>>>>    >> pollute generic code.
>>>>    >
>>>>    > It would be good to explain exactly how your hardware is broken
>>>>    > exactly. I really do not think that such a fine-grained setting where
>>>>    > you could disable, e.g: 100BaseT_Full, but allow 100BaseT_Half to
>>>>    > remain usable makes that much sense. In general, Gigabit might be
>>>>    > badly broken, but 100 and 10Mbits/sec should work fine. How about the
>>>>    > MASTER-SLAVE bit, is overriding it really required?
>>>>    >
>>>>    > Is not a PHY fixup registered for a specific OUI the solution you are
>>>>    > looking for? I am also concerned that this creates PHY
>>>> troubleshooting
>>>>    > issues much harder to debug than before as we may have no idea about
>>>>    > how much information has been put in Device Tree to override that.
>>>>    >
>>>>    > Finally, how about making this more general just like the BCM87xx PHY
>>>>    > driver, which is supplied value/reg pairs directly? There are 16
>>>>    > common MII registers, and 16 others for vendor specific registers,
>>>>    > this is just covering for about 2% of the possible changes.
>>>>
>>>> Good point. That would easily help me with my current issue, which
>>>> requires autoneg to be disabled to begin with (by clearing BMCR_ANENABLE
>>>> from register 0).
>>>
>>>
>>> Is there a point in time (e.g: after some specific initial configuration
>>> has
>>> been made) where BMCR_ANENABLE can be used?
>>
>>
>> What do you mean? In my case, for some HW-related reason (due to the PHY
>> counterpart I guess) autoneg needs to be disabled.
>> This is currently done by the bootloader code (which clears the bit).
>> What I'm looking for is some way for the kernel to either reinforce this
>> setting, or just take that into account and skip autoneg.
>> On top of that, there's a HW errata about that particular PHY, which
>> requires certain operations to be performed on the PHY as a workaround *WHEN
>> AUTONEG IS DISABLED*. That I'd implement on a PHY-specif driver.
>
> Ok.
>
>>
>>
>>>> This would not however fix it entirely (I tried a quick hardwired
>>>> implementation), as the whole PHY machinery would not take that into
>>>> account and would re-enable autoneg anyway.
>>>> I also tried changing the patch so that phydev->support gets updated
>>>
>>>
>>> There are multiple things that you could try doing here:
>>>
>>> - override the PHY state machine in your read_status callback to make sure
>>> that you always set phydev->autoneg set to AUTONEG_ENABLE
>>
>>
>> [you mean AUTONEG_DISABLE, right?]
>
> Right, I fat fingered here.
>
>> Uhm, but I don't want to implement a driver for that PHY that always
>> disables autoneg. I only want to disable autoneg for that particular board.
>> I figure I might register a fixup for that board, but that kindof makes
>> everything more complicated and less clear. Plus, what should be the
>> criterion to determine whether we're running on that particular hardware?
>
> of_machine_is_compatible() plus reading the specific PHY OUI should
> provide you with with an unique machine + PHY tuple. If your machine
> name is too generic.

Uhm, actually, my machine name ("model") is specific, but the compatible 
string is indeed generic so this would mean adding an extra string 
there. Not that it's a big issue, but it just seems too complicated and 
hard to follow. After all, we wanted device tree in the first place to 
get rid of board-sepcific files. To me, filtering by machine name looks 
like a big step backwards, especially if it's all about a "pretty 
standard feature" like disabling autoneg.

>
>>
>>
>>> - clear the SUPPORTED_Autoneg bits from phydev->supported right after PHY
>>> registration and before the call to phy_start()
>>
>>
>> I actually tried clearing it by tweaking the patch on this thread, but the
>> end result is that it does not produce any effect (see further comments
>> below). Only thing that seems to play a role here is explictly setting
>> phydev->autoneg = AUTONEG_DISABLE.
>>
>>
>>> - set the PHY_HAS_MAGICANEG bit in your PHY driver flag
>>
>>
>> Again, this seems to play no role whatsoever here:
>>
>>                          } else if (0 == phydev->link_timeout--) {
>>                                  needs_aneg = 1;
>>                                  /* If we have the magic_aneg bit,
>>                                   * we try again */
>>                                  if (phydev->drv->flags & PHY_HAS_MAGICANEG)
>>                                          break;
>>                          }
>>                          break;
>>                  case PHY_NOLINK:
>>
>> This code might have made sense when it was written in 2006 -- back then,
>> the break statement was skipping some fallback code. But now it seems to do
>> nothing.
>>
>>
>>>
>>>>
>>>> (instead of phydev->advertising):
>>>>    >> +               if (!of_property_read_u32(np, override->prop, &tmp))
>>>> {
>>>>    >> +                       if (tmp) {
>>>>    >> +                               *val |= override->value;
>>>>    >> +                               phydev->advertising |=
>>>>
>>>> override->supported;
>>>>
>>>>    >> +                       } else {
>>>>    >> +                               phydev->advertising &=
>>>>
>>>> ~(override->supported);
>>>>
>>>>    >> +                       }
>>>>    >> +
>>>>    >> +                       *mask |= override->value;
>>>>
>>>> What I find weird is that the only way phydev->autoneg could ever be set
>>>> to disabled is from here (phy.c):
>>>>
>>>> static void phy_sanitize_settings(struct phy_device *phydev)
>>>> {
>>>>          u32 features = phydev->supported;
>>>>          int idx;
>>>>
>>>>          /* Sanitize settings based on PHY capabilities */
>>>>          if ((features & SUPPORTED_Autoneg) == 0)
>>>>                  phydev->autoneg = AUTONEG_DISABLE;
>>>>
>>>> which is in turn only called when phydev->autoneg is set to
>>>> AUTONEG_DISABLE to begin with:
>>>>
>>>> int phy_start_aneg(struct phy_device *phydev)
>>>> {
>>>>          int err;
>>>>
>>>>          mutex_lock(&phydev->lock);
>>>>
>>>>          if (AUTONEG_DISABLE == phydev->autoneg)
>>>>                  phy_sanitize_settings(phydev);
>>>>
>>>> So could someone please help me figure out what I'm missing here?
>>>
>>>
>>> At first glance it looks like the PHY driver should be reading the phydev-
>>>>
>>>> autoneg value when the PHY driver config_aneg() callback is called to be
>>>
>>> allowed to set the forced speed and settings.
>>>
>>> The way phy_sanitize_settings() is coded does not make it return a mask of
>>> features, but only the forced supported speed and duplex. Then when the
>>> link
>>> is forced but we are having some issues getting a link status, libphy
>>> tries
>>> lower speeds and this function is used again to provide the next
>>> speed/duplex
>>> pair to try.
>>>
>>
>> What I was trying to say is that phy_sanitize_settings() is only called when
>> phydev->autoneg == AUTONEG_DISABLE, and in turn it's the only generic
>> function setting phydev->autoneg = AUTONEG_DISABLE.
>> So perhaps the condition should read:
>>
>> -       if (AUTONEG_DISABLE == phydev->autoneg)
>> +       if ((features & SUPPORTED_Autoneg) == 0)
>>                  phy_sanitize_settings(phydev);
>>
>> Or else, some other parts of the generic code should take care of setting it
>> to AUTONEG_DISABLE, depending on whether the feature is supported or not.
>> What I found weird is explicitly setting a value (phydev->autoneg =
>> AUTONEG_DISABLE), from a static function which is only called when that
>> condition is already true.
>
> I do not think that this change is correct either, let me cook a patch
> for you to allow disabling autoneg from the start.

Oh, OK, that would be great, thank you!
FWIW, I've already spent quite some time trying to overcome this -- my 
understanding is that you somehow need to set phydev->autoneg to 
AUTONEG_DISABLE at a very early stage (and that could of course be done 
as a consequence of SUPPORTED_Autoneg being unset), otherwise the whole 
software phy state machine and speed-matching algorithms will get confused.

>>
>> BTW, I feel like disabling autoneg from the start has never been a use case
>> before, am I right?
>
> Not really no, and that is because most hardware does not need quirks
> to work correctly.

To be honest with you, I'm not long experienced on MII/PHY, but I've 
already seen two completely unrelated cases where autoneg needs to be 
disabled in order for the hardware to work correctly. Of course I'm only 
talking about in-board connections (e.g. not PHYs connected to an RJ-45 
jack), still...
In this particular hardware configuration, not only does autoneg need to 
be disabled in the first place (otherwise link won't work at all), but 
the phy HW is also buggy so that when autoneg is disabled, it may still 
occasionally not work (like 0.1% of the times).

Thank you so much!
Gerlando

^ permalink raw reply

* Re: [PATCH net-next] net: remove useless if check from register_netdevice()
From: Denis Kirjanov @ 2014-02-12  8:47 UTC (permalink / raw)
  To: Ding Tianhong; +Cc: davem, netdev
In-Reply-To: <52FB2FBF.7050907@huawei.com>

On 2/12/14, Ding Tianhong <dingtianhong@huawei.com> wrote:
> On 2014/2/12 15:45, Denis Kirjanov wrote:
>> remove useless if check from register_netdevice()
>>
>> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
>> ---
>>  net/core/dev.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 4ad1b78..4be9a37 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -5876,8 +5876,7 @@ int register_netdevice(struct net_device *dev)
>>  	if (dev->netdev_ops->ndo_init) {
>>  		ret = dev->netdev_ops->ndo_init(dev);
>>  		if (ret) {
>> -			if (ret > 0)
>> -				ret = -EIO;
>> +            ret = -EIO;
>
> and:
> some ndo_init() will return -ENOMEM, not only -EIO
>
>
>>  			goto out;
>>  		}
>>  	}
>>

Yes, I was thinking about that. The return code may contain everything.
Probably it's better to propagate return value back to
register_netdevice. On the other hand the return value -ENOTSUPP for
register_netdevice return value looks odd...

>

^ permalink raw reply

* [PATCH net-next] tipc: explicitly include core.h in addr.h
From: andreas.bofjall @ 2014-02-12  8:34 UTC (permalink / raw)
  To: netdev; +Cc: tipc-discussion, maloy, Andreas Bofjäll

From: Andreas Bofjäll <andreas.bofjall@ericsson.com>

The inline functions in addr.h uses tipc_own_addr which is exported by
core.h, but addr.h never actually includes it. It works because it is
explicitly included where this is used, but it looks a bit strange.

Include core.h in addr.h explicitly to make the dependency clearer.

Signed-off-by: Andreas Bofjäll <andreas.bofjall@ericsson.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/addr.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index 60b00ab..a74acf9 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -37,6 +37,8 @@
 #ifndef _TIPC_ADDR_H
 #define _TIPC_ADDR_H
 
+#include "core.h"
+
 #define TIPC_ZONE_MASK		0xff000000u
 #define TIPC_CLUSTER_MASK	0xfffff000u
 
-- 
1.8.5.2

^ permalink raw reply related

* Re: [PATCH net-next] net: remove useless if check from register_netdevice()
From: Ding Tianhong @ 2014-02-12  8:24 UTC (permalink / raw)
  To: Denis Kirjanov, davem, netdev
In-Reply-To: <1392191152-24182-1-git-send-email-kda@linux-powerpc.org>

On 2014/2/12 15:45, Denis Kirjanov wrote:
> remove useless if check from register_netdevice()
> 
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
>  net/core/dev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 4ad1b78..4be9a37 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5876,8 +5876,7 @@ int register_netdevice(struct net_device *dev)
>  	if (dev->netdev_ops->ndo_init) {
>  		ret = dev->netdev_ops->ndo_init(dev);
>  		if (ret) {
> -			if (ret > 0)
> -				ret = -EIO;
> +            ret = -EIO;

and:
some ndo_init() will return -ENOMEM, not only -EIO


>  			goto out;
>  		}
>  	}
> 

^ permalink raw reply

* Re: [PATCH net-next] net: remove useless if check from register_netdevice()
From: Ding Tianhong @ 2014-02-12  8:20 UTC (permalink / raw)
  To: Denis Kirjanov, davem, netdev
In-Reply-To: <1392191152-24182-1-git-send-email-kda@linux-powerpc.org>

On 2014/2/12 15:45, Denis Kirjanov wrote:
> remove useless if check from register_netdevice()
> 
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
>  net/core/dev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 4ad1b78..4be9a37 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5876,8 +5876,7 @@ int register_netdevice(struct net_device *dev)
>  	if (dev->netdev_ops->ndo_init) {
>  		ret = dev->netdev_ops->ndo_init(dev);
>  		if (ret) {
> -			if (ret > 0)
> -				ret = -EIO;
> +            ret = -EIO;

pls use checkpatch.pl to check the code.

Ding

>  			goto out;
>  		}
>  	}
> 

^ permalink raw reply

* [PATCH net-next] ipv4: ip_forward: perform skb->pkt_type check at the beginning
From: Denis Kirjanov @ 2014-02-12  8:10 UTC (permalink / raw)
  To: davem, netdev; +Cc: Denis Kirjanov

Packets which have L2 address different from ours should be
already filtered before entering into ip_forward().

Perform that check at the beginning to avoid processing such packets.

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
 net/ipv4/ip_forward.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index e9f1217..1a07056 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -59,6 +59,10 @@ int ip_forward(struct sk_buff *skb)
 	struct rtable *rt;	/* Route we use */
 	struct ip_options *opt	= &(IPCB(skb)->opt);
 
+    /* that should never happen */
+    if (skb->pkt_type != PACKET_HOST)
+        goto drop;
+
 	if (skb_warn_if_lro(skb))
 		goto drop;
 
@@ -68,9 +72,6 @@ int ip_forward(struct sk_buff *skb)
 	if (IPCB(skb)->opt.router_alert && ip_call_ra_chain(skb))
 		return NET_RX_SUCCESS;
 
-	if (skb->pkt_type != PACKET_HOST)
-		goto drop;
-
 	skb_forward_csum(skb);
 
 	/*
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH net-next] net: remove useless if check from register_netdevice()
From: Denis Kirjanov @ 2014-02-12  7:45 UTC (permalink / raw)
  To: davem, netdev; +Cc: Denis Kirjanov

remove useless if check from register_netdevice()

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
 net/core/dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 4ad1b78..4be9a37 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5876,8 +5876,7 @@ int register_netdevice(struct net_device *dev)
 	if (dev->netdev_ops->ndo_init) {
 		ret = dev->netdev_ops->ndo_init(dev);
 		if (ret) {
-			if (ret > 0)
-				ret = -EIO;
+            ret = -EIO;
 			goto out;
 		}
 	}
-- 
1.8.3.2

^ permalink raw reply related

* Re: [PATCH] tun: use netif_receive_skb instead of netif_rx_ni
From: Jason Wang @ 2014-02-12  7:40 UTC (permalink / raw)
  To: Qin Chuanyu, davem
  Cc: Michael S. Tsirkin, Anthony Liguori, KVM list, netdev,
	Eric Dumazet
In-Reply-To: <52FB18B8.4070401@huawei.com>

On 02/12/2014 02:46 PM, Qin Chuanyu wrote:
> On 2014/2/12 13:28, Jason Wang wrote:
>
>> A question: without NAPI weight, could this starve other net devices?
> tap xmit skb use thread context,the poll func of physical nic driver
> could be called in softirq context without change.
>
> I had test it by binding vhost thread and physic nic interrupt on the
> same vcpu, use netperf xmit udp, test model is VM1-Host1-Host2.
>
> if only VM1 xmit skb, the top show as below :
> Cpu1 :0.0%us, 95.0%sy, 0.0%ni, 0.0%id,  0.0%wa, 0.0%hi, 5.0%si,  0.0%st
>
> then use host2 xmit skb to VM1, the top show as below :
> Cpu1 :0.0%us, 41.0%sy, 0.0%ni, 0.0%id,  0.0%wa, 0.0%hi, 59.0%si, 0.0%st
>
> so I think there is no problem with this change.

Yes, I realize it was ok after Eric's comment.

Thanks

^ 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