Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] via-ircc: Pass PCI device pointer to dma_{alloc,free}_coherent()
From: David Miller @ 2011-03-30  7:13 UTC (permalink / raw)
  To: ben; +Cc: netdev, andrewb, samuel, 619450
In-Reply-To: <1301368372.26693.753.camel@localhost>

From: Ben Hutchings <ben@decadent.org.uk>
Date: Tue, 29 Mar 2011 04:12:52 +0100

> via-ircc has been passing a NULL pointer to DMA allocation functions,
> which is completely invalid and results in a BUG on PowerPC.  Now
> that we always have the device pointer available, pass it in.
> 
> Reference: http://bugs.debian.org/619450
> Reported-by: Andrew Buckeridge <andrewb@bgc.com.au>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> Tested-by: Andrew Buckeridge <andrewb@bgc.com.au> [against 2.6.32]

Applied.

^ permalink raw reply

* Re: [PATCH 1/2] via-ircc: Use pci_{get,set}_drvdata() instead of static pointer variable
From: David Miller @ 2011-03-30  7:13 UTC (permalink / raw)
  To: ben; +Cc: netdev, andrewb, samuel
In-Reply-To: <1301368243.26693.751.camel@localhost>

From: Ben Hutchings <ben@decadent.org.uk>
Date: Tue, 29 Mar 2011 04:10:43 +0100

> via-ircc still maintains its own array of device pointers in Linux 2.4
> style.  Worse, it always uses index 0, so it will crash if there are
> multiple suitable devices in the system.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Applied.

^ permalink raw reply

* Re: [PATCH] net: gre: provide multicast mappings for ipv4 and ipv6
From: David Miller @ 2011-03-30  7:11 UTC (permalink / raw)
  To: rdkehn; +Cc: netdev, timo.teras
In-Reply-To: <360171.1620.qm@web39305.mail.mud.yahoo.com>

From: Doug Kehn <rdkehn@yahoo.com>
Date: Tue, 29 Mar 2011 13:26:02 -0700 (PDT)

> 
> --- On Tue, 3/29/11, Timo Teräs <timo.teras@iki.fi> wrote:
> 
>> From: Timo Teräs <timo.teras@iki.fi>
>> Subject: [PATCH] net: gre: provide multicast mappings for ipv4 and ipv6
>> To: netdev@vger.kernel.org
>> Cc: "Doug Kehn" <rdkehn@yahoo.com>, "Timo Teräs" <timo.teras@iki.fi>
>> Date: Tuesday, March 29, 2011, 4:40 AM
>> My commit 6d55cb91a0020ac0 (gre: fix
>> hard header destination
>> address checking) broke multicast.
>> 
>> The reason is that ip_gre used to get ipgre_header() calls
>> with
>> zero destination if we have NOARP or multicast destination.
>> Instead
>> the actual target was decided at ipgre_tunnel_xmit() time
>> based on
>> per-protocol dissection.
>> 
>> Instead of allowing the "abuse" of ->header() calls with
>> invalid
>> destination, this creates multicast mappings for ip_gre.
>> This also
>> fixes "ip neigh show nud noarp" to display the proper
>> multicast
>> mappings used by the gre device.
>> 
>> Reported-by: Doug Kehn <rdkehn@yahoo.com>
>> Signed-off-by: Timo Teräs <timo.teras@iki.fi>
> 
> Acked-by: Doug Kehn <rdkehn@yahoo.com>

Applied.

Timo, if updates are necessary for the ipv4 mapped handling in ipv6,
please send that as a follow-up fix.

Thanks.

^ permalink raw reply

* Re: [PATCH] net: Handle gso packets in dev_forward_skb
From: David Miller @ 2011-03-30  7:06 UTC (permalink / raw)
  To: ebiederm; +Cc: daniel.lezcano, eric.dumazet, netdev, greearb, arnd, kaber
In-Reply-To: <m1aagdhc71.fsf@fess.ebiederm.org>

From: ebiederm@xmission.com (Eric W. Biederman)
Date: Tue, 29 Mar 2011 14:02:58 -0700

> It looks fine to me.  I would resubmit it so that if anyone else has
> complaints they will be jolted into looking at the patch again.
> 
> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

I'm waiting patiently for this resubmission.

^ permalink raw reply

* Re: poll broken (for can)
From: David Miller @ 2011-03-30  7:05 UTC (permalink / raw)
  To: socketcan; +Cc: mkl, wg, socketcan-users, netdev
In-Reply-To: <4D923B00.20500@hartkopp.net>

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: Tue, 29 Mar 2011 22:03:12 +0200

> Hm - the problem could be that people expect their frames to be sent 'in
> time', so if we increase the tx_queue_len, it's not transparent when the
> frames are potentially leaving the system - and if the application data is
> already out-dated when hitting the medium.
> 
> What about having up to three CAN frames in each CAN_RAW socket send buffer
> and e.g.50 frames in the tx_queue_len of the netdevice as a starting point?

Setting tx_queue_len low is bound to cause all kinds of problems.

This poll() peculiarity is just one such problem.

I would suggest increasing it for CAN devices to at least 100.

^ permalink raw reply

* Re: [PATCH] bridge: Fix compilation warning in function br_stp_recalculate_bridge_id()
From: David Miller @ 2011-03-30  6:37 UTC (permalink / raw)
  To: shemminger; +Cc: balajig81, shemminger, bridge, netdev
In-Reply-To: <20110329111038.2928bef7@s6510>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 29 Mar 2011 11:10:38 -0700

> On Tue, 29 Mar 2011 21:50:04 +0530
> "G.Balaji" <balajig81@gmail.com> wrote:
> 
>> net/bridge/br_stp_if.c: In function ‘br_stp_recalculate_bridge_id’:
>> net/bridge/br_stp_if.c:216:3: warning: ‘return’ with no value, in function returning non-void
>> 
>> Signed-off-by: G.Balaji <balajig81@gmail.com>
> 
> Acked-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> (Forget to refresh quilt patch before sending).

Applied.

^ permalink raw reply

* [net-next-2.6 PATCH 4/4] enic: Add support for PORT_REQUEST_PREASSOCIATE_RR
From: Roopa Prabhu @ 2011-03-30  6:36 UTC (permalink / raw)
  To: davem; +Cc: netdev
In-Reply-To: <20110330063533.7187.80458.stgit@savbu-pc100.cisco.com>

From: Roopa Prabhu <roprabhu@cisco.com>

Current enic code only supports ASSOCIATE and DISASSOCIATE port profile
operations. This patch adds enic support for port profile
PORT_REQUEST_PREASSOCIATE_RR operation. The VIC adapter (8021qbh) is capable
of handling port profile requests done in two steps namely PREASSOCIATE_RR
and ASSOCIATE today. The motivation to support PREASSOCIATE_RR comes mainly
from its use as an optimization during VM migration ie, to do resource
reservation on destination host before resources on source host are released.

PREASSOCIATE_RR is a VDP operation and according to the latest at IEEE,
8021qbh will also need to support VDP commands.

In addition to handling the new PORT_REQUEST_PREASSOCIATE_RR operation
this patch also does the below:
- Introduces handlers for PORT_REQUEST operations
- Moves most of the port profile handling code to new files enic_pp.[ch]
- Uses new fw devcmds for port profile operations

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
---
 drivers/net/enic/Makefile    |    2 
 drivers/net/enic/enic.h      |    4 -
 drivers/net/enic/enic_main.c |  196 ++++++++-----------------------
 drivers/net/enic/enic_pp.c   |  264 ++++++++++++++++++++++++++++++++++++++++++
 drivers/net/enic/enic_pp.h   |   27 ++++
 5 files changed, 344 insertions(+), 149 deletions(-)
 create mode 100644 drivers/net/enic/enic_pp.c
 create mode 100644 drivers/net/enic/enic_pp.h


diff --git a/drivers/net/enic/Makefile b/drivers/net/enic/Makefile
index 2e573be..9d4974b 100644
--- a/drivers/net/enic/Makefile
+++ b/drivers/net/enic/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_ENIC) := enic.o
 
 enic-y := enic_main.o vnic_cq.o vnic_intr.o vnic_wq.o \
-	enic_res.o enic_dev.o vnic_dev.o vnic_rq.o vnic_vic.o
+	enic_res.o enic_dev.o enic_pp.o vnic_dev.o vnic_rq.o vnic_vic.o
 
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 3a3c3c8..178b94d 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -32,7 +32,7 @@
 
 #define DRV_NAME		"enic"
 #define DRV_DESCRIPTION		"Cisco VIC Ethernet NIC Driver"
-#define DRV_VERSION		"2.1.1.12"
+#define DRV_VERSION		"2.1.1.13"
 #define DRV_COPYRIGHT		"Copyright 2008-2011 Cisco Systems, Inc"
 
 #define ENIC_BARS_MAX		6
@@ -120,4 +120,6 @@ static inline struct device *enic_get_dev(struct enic *enic)
 	return &(enic->pdev->dev);
 }
 
+void enic_reset_addr_lists(struct enic *enic);
+
 #endif /* _ENIC_H_ */
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 8b9cad5..9a3a027 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -45,6 +45,7 @@
 #include "enic_res.h"
 #include "enic.h"
 #include "enic_dev.h"
+#include "enic_pp.h"
 
 #define ENIC_NOTIFY_TIMER_PERIOD	(2 * HZ)
 #define WQ_ENET_MAX_DESC_LEN		(1 << WQ_ENET_LEN_BITS)
@@ -874,7 +875,7 @@ static struct net_device_stats *enic_get_stats(struct net_device *netdev)
 	return net_stats;
 }
 
-static void enic_reset_addr_lists(struct enic *enic)
+void enic_reset_addr_lists(struct enic *enic)
 {
 	enic->mc_count = 0;
 	enic->uc_count = 0;
@@ -1112,157 +1113,77 @@ static int enic_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
 		return -EINVAL;
 }
 
-static int enic_set_port_profile(struct enic *enic, u8 *mac)
-{
-	struct vic_provinfo *vp;
-	u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
-	u16 os_type = VIC_GENERIC_PROV_OS_TYPE_LINUX;
-	char uuid_str[38];
-	char client_mac_str[18];
-	u8 *client_mac;
-	int err;
-
-	err = enic_vnic_dev_deinit(enic);
-	if (err)
-		return err;
-
-	enic_reset_addr_lists(enic);
-
-	switch (enic->pp.request) {
-
-	case PORT_REQUEST_ASSOCIATE:
-
-		if (!(enic->pp.set & ENIC_SET_NAME) || !strlen(enic->pp.name))
-			return -EINVAL;
-
-		if (!is_valid_ether_addr(mac))
-			return -EADDRNOTAVAIL;
-
-		vp = vic_provinfo_alloc(GFP_KERNEL, oui,
-			VIC_PROVINFO_GENERIC_TYPE);
-		if (!vp)
-			return -ENOMEM;
-
-		vic_provinfo_add_tlv(vp,
-			VIC_GENERIC_PROV_TLV_PORT_PROFILE_NAME_STR,
-			strlen(enic->pp.name) + 1, enic->pp.name);
-
-		if (!is_zero_ether_addr(enic->pp.mac_addr))
-			client_mac = enic->pp.mac_addr;
-		else
-			client_mac = mac;
-
-		vic_provinfo_add_tlv(vp,
-			VIC_GENERIC_PROV_TLV_CLIENT_MAC_ADDR,
-			ETH_ALEN, client_mac);
-
-		sprintf(client_mac_str, "%pM", client_mac);
-		vic_provinfo_add_tlv(vp,
-			VIC_GENERIC_PROV_TLV_CLUSTER_PORT_UUID_STR,
-			sizeof(client_mac_str), client_mac_str);
-
-		if (enic->pp.set & ENIC_SET_INSTANCE) {
-			sprintf(uuid_str, "%pUB", enic->pp.instance_uuid);
-			vic_provinfo_add_tlv(vp,
-				VIC_GENERIC_PROV_TLV_CLIENT_UUID_STR,
-				sizeof(uuid_str), uuid_str);
-		}
-
-		if (enic->pp.set & ENIC_SET_HOST) {
-			sprintf(uuid_str, "%pUB", enic->pp.host_uuid);
-			vic_provinfo_add_tlv(vp,
-				VIC_GENERIC_PROV_TLV_HOST_UUID_STR,
-				sizeof(uuid_str), uuid_str);
-		}
-
-		os_type = htons(os_type);
-		vic_provinfo_add_tlv(vp,
-			VIC_GENERIC_PROV_TLV_OS_TYPE,
-			sizeof(os_type), &os_type);
-
-		err = enic_dev_init_prov(enic, vp);
-		vic_provinfo_free(vp);
-		if (err)
-			return err;
-		break;
-
-	case PORT_REQUEST_DISASSOCIATE:
-		break;
-
-	default:
-		return -EINVAL;
-	}
-
-	/* Set flag to indicate that the port assoc/disassoc
-	 * request has been sent out to fw
-	 */
-	enic->pp.set |= ENIC_PORT_REQUEST_APPLIED;
-
-	return 0;
-}
-
 static int enic_set_vf_port(struct net_device *netdev, int vf,
 	struct nlattr *port[])
 {
 	struct enic *enic = netdev_priv(netdev);
-	struct enic_port_profile new_pp;
-	int err = 0;
+	struct enic_port_profile prev_pp;
+	int err = 0, restore_pp = 1;
 
-	memset(&new_pp, 0, sizeof(new_pp));
+	/* don't support VFs, yet */
+	if (vf != PORT_SELF_VF)
+		return -EOPNOTSUPP;
 
-	if (port[IFLA_PORT_REQUEST]) {
-		new_pp.set |= ENIC_SET_REQUEST;
-		new_pp.request = nla_get_u8(port[IFLA_PORT_REQUEST]);
-	}
+	if (!port[IFLA_PORT_REQUEST])
+		return -EOPNOTSUPP;
+
+	memcpy(&prev_pp, &enic->pp, sizeof(enic->pp));
+	memset(&enic->pp, 0, sizeof(enic->pp));
+
+	enic->pp.set |= ENIC_SET_REQUEST;
+	enic->pp.request = nla_get_u8(port[IFLA_PORT_REQUEST]);
 
 	if (port[IFLA_PORT_PROFILE]) {
-		new_pp.set |= ENIC_SET_NAME;
-		memcpy(new_pp.name, nla_data(port[IFLA_PORT_PROFILE]),
+		enic->pp.set |= ENIC_SET_NAME;
+		memcpy(enic->pp.name, nla_data(port[IFLA_PORT_PROFILE]),
 			PORT_PROFILE_MAX);
 	}
 
 	if (port[IFLA_PORT_INSTANCE_UUID]) {
-		new_pp.set |= ENIC_SET_INSTANCE;
-		memcpy(new_pp.instance_uuid,
+		enic->pp.set |= ENIC_SET_INSTANCE;
+		memcpy(enic->pp.instance_uuid,
 			nla_data(port[IFLA_PORT_INSTANCE_UUID]), PORT_UUID_MAX);
 	}
 
 	if (port[IFLA_PORT_HOST_UUID]) {
-		new_pp.set |= ENIC_SET_HOST;
-		memcpy(new_pp.host_uuid,
+		enic->pp.set |= ENIC_SET_HOST;
+		memcpy(enic->pp.host_uuid,
 			nla_data(port[IFLA_PORT_HOST_UUID]), PORT_UUID_MAX);
 	}
 
-	/* don't support VFs, yet */
-	if (vf != PORT_SELF_VF)
-		return -EOPNOTSUPP;
-
-	if (!(new_pp.set & ENIC_SET_REQUEST))
-		return -EOPNOTSUPP;
-
-	if (new_pp.request == PORT_REQUEST_ASSOCIATE) {
-		/* Special case handling */
-		if (!is_zero_ether_addr(enic->pp.vf_mac))
-			memcpy(new_pp.mac_addr, enic->pp.vf_mac, ETH_ALEN);
+	/* Special case handling: mac came from IFLA_VF_MAC */
+	if (!is_zero_ether_addr(prev_pp.vf_mac))
+		memcpy(enic->pp.mac_addr, prev_pp.vf_mac, ETH_ALEN);
 
 		if (is_zero_ether_addr(netdev->dev_addr))
 			random_ether_addr(netdev->dev_addr);
-	}
 
-	memcpy(&enic->pp, &new_pp, sizeof(struct enic_port_profile));
+	err = enic_process_set_pp_request(enic, &prev_pp, &restore_pp);
+	if (err) {
+		if (restore_pp) {
+			/* Things are still the way they were: Implicit
+			 * DISASSOCIATE failed
+			 */
+			memcpy(&enic->pp, &prev_pp, sizeof(enic->pp));
+		} else {
+			memset(&enic->pp, 0, sizeof(enic->pp));
+			memset(netdev->dev_addr, 0, ETH_ALEN);
+		}
+	} else {
+		/* Set flag to indicate that the port assoc/disassoc
+		 * request has been sent out to fw
+		 */
+		enic->pp.set |= ENIC_PORT_REQUEST_APPLIED;
 
-	err = enic_set_port_profile(enic, netdev->dev_addr);
-	if (err)
-		goto set_port_profile_cleanup;
+		/* If DISASSOCIATE, clean up all assigned/saved macaddresses */
+		if (enic->pp.request == PORT_REQUEST_DISASSOCIATE) {
+			memset(enic->pp.mac_addr, 0, ETH_ALEN);
+			memset(netdev->dev_addr, 0, ETH_ALEN);
+		}
+	}
 
-set_port_profile_cleanup:
 	memset(enic->pp.vf_mac, 0, ETH_ALEN);
 
-	if (err || enic->pp.request == PORT_REQUEST_DISASSOCIATE) {
-		memset(netdev->dev_addr, 0, ETH_ALEN);
-		memset(enic->pp.mac_addr, 0, ETH_ALEN);
-	}
-
 	return err;
 }
 
@@ -1270,34 +1191,15 @@ static int enic_get_vf_port(struct net_device *netdev, int vf,
 	struct sk_buff *skb)
 {
 	struct enic *enic = netdev_priv(netdev);
-	int err, error, done;
 	u16 response = PORT_PROFILE_RESPONSE_SUCCESS;
+	int err;
 
 	if (!(enic->pp.set & ENIC_PORT_REQUEST_APPLIED))
 		return -ENODATA;
 
-	err = enic_dev_init_done(enic, &done, &error);
+	err = enic_process_get_pp_request(enic, enic->pp.request, &response);
 	if (err)
-		error = err;
-
-	switch (error) {
-	case ERR_SUCCESS:
-		if (!done)
-			response = PORT_PROFILE_RESPONSE_INPROGRESS;
-		break;
-	case ERR_EINVAL:
-		response = PORT_PROFILE_RESPONSE_INVALID;
-		break;
-	case ERR_EBADSTATE:
-		response = PORT_PROFILE_RESPONSE_BADSTATE;
-		break;
-	case ERR_ENOMEM:
-		response = PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES;
-		break;
-	default:
-		response = PORT_PROFILE_RESPONSE_ERROR;
-		break;
-	}
+		return err;
 
 	NLA_PUT_U16(skb, IFLA_PORT_REQUEST, enic->pp.request);
 	NLA_PUT_U16(skb, IFLA_PORT_RESPONSE, response);
diff --git a/drivers/net/enic/enic_pp.c b/drivers/net/enic/enic_pp.c
new file mode 100644
index 0000000..ffaa75d
--- /dev/null
+++ b/drivers/net/enic/enic_pp.c
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2011 Cisco Systems, Inc.  All rights reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/rtnetlink.h>
+#include <net/ip.h>
+
+#include "vnic_vic.h"
+#include "enic_res.h"
+#include "enic.h"
+#include "enic_dev.h"
+
+static int enic_set_port_profile(struct enic *enic)
+{
+	struct net_device *netdev = enic->netdev;
+	struct vic_provinfo *vp;
+	const u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
+	const u16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX);
+	char uuid_str[38];
+	char client_mac_str[18];
+	u8 *client_mac;
+	int err;
+
+	if (!(enic->pp.set & ENIC_SET_NAME) || !strlen(enic->pp.name))
+		return -EINVAL;
+
+	vp = vic_provinfo_alloc(GFP_KERNEL, oui,
+		VIC_PROVINFO_GENERIC_TYPE);
+	if (!vp)
+		return -ENOMEM;
+
+	VIC_PROVINFO_ADD_TLV(vp,
+		VIC_GENERIC_PROV_TLV_PORT_PROFILE_NAME_STR,
+		strlen(enic->pp.name) + 1, enic->pp.name);
+
+	if (!is_zero_ether_addr(enic->pp.mac_addr))
+		client_mac = enic->pp.mac_addr;
+	else
+		client_mac = netdev->dev_addr;
+
+	VIC_PROVINFO_ADD_TLV(vp,
+		VIC_GENERIC_PROV_TLV_CLIENT_MAC_ADDR,
+		ETH_ALEN, client_mac);
+
+	snprintf(client_mac_str, sizeof(client_mac_str), "%pM", client_mac);
+	VIC_PROVINFO_ADD_TLV(vp,
+		VIC_GENERIC_PROV_TLV_CLUSTER_PORT_UUID_STR,
+		sizeof(client_mac_str), client_mac_str);
+
+	if (enic->pp.set & ENIC_SET_INSTANCE) {
+		sprintf(uuid_str, "%pUB", enic->pp.instance_uuid);
+		VIC_PROVINFO_ADD_TLV(vp,
+			VIC_GENERIC_PROV_TLV_CLIENT_UUID_STR,
+			sizeof(uuid_str), uuid_str);
+	}
+
+	if (enic->pp.set & ENIC_SET_HOST) {
+		sprintf(uuid_str, "%pUB", enic->pp.host_uuid);
+		VIC_PROVINFO_ADD_TLV(vp,
+			VIC_GENERIC_PROV_TLV_HOST_UUID_STR,
+			sizeof(uuid_str), uuid_str);
+	}
+
+	VIC_PROVINFO_ADD_TLV(vp,
+		VIC_GENERIC_PROV_TLV_OS_TYPE,
+		sizeof(os_type), &os_type);
+
+	err = enic_dev_status_to_errno(enic_dev_init_prov2(enic, vp));
+
+add_tlv_failure:
+	vic_provinfo_free(vp);
+
+	return err;
+}
+
+static int enic_unset_port_profile(struct enic *enic)
+{
+	int err;
+
+	err = enic_vnic_dev_deinit(enic);
+	if (err)
+		return enic_dev_status_to_errno(err);
+
+	enic_reset_addr_lists(enic);
+
+	return 0;
+}
+
+static int enic_are_pp_different(struct enic_port_profile *pp1,
+		struct enic_port_profile *pp2)
+{
+	return strcmp(pp1->name, pp2->name) | !!memcmp(pp1->instance_uuid,
+		pp2->instance_uuid, PORT_UUID_MAX) |
+		!!memcmp(pp1->host_uuid, pp2->host_uuid, PORT_UUID_MAX) |
+		!!memcmp(pp1->mac_addr, pp2->mac_addr, ETH_ALEN);
+}
+
+static int enic_pp_preassociate(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp);
+static int enic_pp_disassociate(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp);
+static int enic_pp_preassociate_rr(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp);
+static int enic_pp_associate(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp);
+
+static int (*enic_pp_handlers[])(struct enic *enic,
+		struct enic_port_profile *prev_state, int *restore_pp) = {
+	[PORT_REQUEST_PREASSOCIATE]	= enic_pp_preassociate,
+	[PORT_REQUEST_PREASSOCIATE_RR]	= enic_pp_preassociate_rr,
+	[PORT_REQUEST_ASSOCIATE]	= enic_pp_associate,
+	[PORT_REQUEST_DISASSOCIATE]	= enic_pp_disassociate,
+};
+
+static const int enic_pp_handlers_count =
+			sizeof(enic_pp_handlers)/sizeof(*enic_pp_handlers);
+
+static int enic_pp_preassociate(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp)
+{
+	return -EOPNOTSUPP;
+}
+
+static int enic_pp_disassociate(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp)
+{
+	return enic_unset_port_profile(enic);
+}
+
+static int enic_pp_preassociate_rr(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp)
+{
+	int err;
+	int active = 0;
+
+	if (enic->pp.request != PORT_REQUEST_ASSOCIATE) {
+		/* If pre-associate is not part of an associate.
+		We always disassociate first */
+		err = enic_pp_handlers[PORT_REQUEST_DISASSOCIATE](enic,
+			prev_pp, restore_pp);
+		if (err)
+			return err;
+
+		*restore_pp = 0;
+	}
+
+	*restore_pp = 0;
+
+	err = enic_set_port_profile(enic);
+	if (err)
+		return err;
+
+	/* If pre-associate is not part of an associate. */
+	if (enic->pp.request != PORT_REQUEST_ASSOCIATE)
+		err = enic_dev_status_to_errno(enic_dev_enable2(enic, active));
+
+	return err;
+}
+
+static int enic_pp_associate(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp)
+{
+	int err;
+	int active = 1;
+
+	/* Check if a pre-associate was called before */
+	if (prev_pp->request != PORT_REQUEST_PREASSOCIATE_RR ||
+		(prev_pp->request == PORT_REQUEST_PREASSOCIATE_RR &&
+			enic_are_pp_different(prev_pp, &enic->pp))) {
+		err = enic_pp_handlers[PORT_REQUEST_DISASSOCIATE](
+			enic, prev_pp, restore_pp);
+		if (err)
+			return err;
+
+		*restore_pp = 0;
+	}
+
+	err = enic_pp_handlers[PORT_REQUEST_PREASSOCIATE_RR](
+			enic, prev_pp, restore_pp);
+	if (err)
+		return err;
+
+	*restore_pp = 0;
+
+	return enic_dev_status_to_errno(enic_dev_enable2(enic, active));
+}
+
+int enic_process_set_pp_request(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp)
+{
+	if (enic->pp.request < enic_pp_handlers_count
+		&& enic_pp_handlers[enic->pp.request])
+		return enic_pp_handlers[enic->pp.request](enic,
+			prev_pp, restore_pp);
+	else
+		return -EOPNOTSUPP;
+}
+
+int enic_process_get_pp_request(struct enic *enic, int request,
+	u16 *response)
+{
+	int err, status = ERR_SUCCESS;
+
+	switch (request) {
+
+	case PORT_REQUEST_PREASSOCIATE_RR:
+	case PORT_REQUEST_ASSOCIATE:
+		err = enic_dev_enable2_done(enic, &status);
+		break;
+
+	case PORT_REQUEST_DISASSOCIATE:
+		err = enic_dev_deinit_done(enic, &status);
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	if (err)
+		status = err;
+
+	switch (status) {
+	case ERR_SUCCESS:
+		*response = PORT_PROFILE_RESPONSE_SUCCESS;
+		break;
+	case ERR_EINVAL:
+		*response = PORT_PROFILE_RESPONSE_INVALID;
+		break;
+	case ERR_EBADSTATE:
+		*response = PORT_PROFILE_RESPONSE_BADSTATE;
+		break;
+	case ERR_ENOMEM:
+		*response = PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES;
+		break;
+	case ERR_EINPROGRESS:
+		*response = PORT_PROFILE_RESPONSE_INPROGRESS;
+		break;
+	default:
+		*response = PORT_PROFILE_RESPONSE_ERROR;
+		break;
+	}
+
+	return 0;
+}
diff --git a/drivers/net/enic/enic_pp.h b/drivers/net/enic/enic_pp.h
new file mode 100644
index 0000000..699e365
--- /dev/null
+++ b/drivers/net/enic/enic_pp.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2011 Cisco Systems, Inc.  All rights reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifndef _ENIC_PP_H_
+#define _ENIC_PP_H_
+
+int enic_process_set_pp_request(struct enic *enic,
+	struct enic_port_profile *prev_pp, int *restore_pp);
+int enic_process_get_pp_request(struct enic *enic, int request,
+	u16 *response);
+
+#endif /* _ENIC_PP_H_ */


^ permalink raw reply related

* [net-next-2.6 PATCH 3/4] enic: Cleanups in port profile helper code
From: Roopa Prabhu @ 2011-03-30  6:36 UTC (permalink / raw)
  To: davem; +Cc: netdev
In-Reply-To: <20110330063533.7187.80458.stgit@savbu-pc100.cisco.com>

From: Roopa Prabhu <roprabhu@cisco.com>

This patch does the following:
- Introduces a new macro VIC_PROVINFO_ADD_TLV
- Adds a new OS type in vic_generic_prov_os_type
- Changes some vic_provinfo* helper routine args to constants

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
---
 drivers/net/enic/vnic_vic.c |    5 +++--
 drivers/net/enic/vnic_vic.h |   13 +++++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)


diff --git a/drivers/net/enic/vnic_vic.c b/drivers/net/enic/vnic_vic.c
index 4725b79..24ef8cd 100644
--- a/drivers/net/enic/vnic_vic.c
+++ b/drivers/net/enic/vnic_vic.c
@@ -23,7 +23,8 @@
 
 #include "vnic_vic.h"
 
-struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type)
+struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui,
+	const u8 type)
 {
 	struct vic_provinfo *vp;
 
@@ -47,7 +48,7 @@ void vic_provinfo_free(struct vic_provinfo *vp)
 }
 
 int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
-	void *value)
+	const void *value)
 {
 	struct vic_provinfo_tlv *tlv;
 
diff --git a/drivers/net/enic/vnic_vic.h b/drivers/net/enic/vnic_vic.h
index f700f5d..9ef81f1 100644
--- a/drivers/net/enic/vnic_vic.h
+++ b/drivers/net/enic/vnic_vic.h
@@ -47,6 +47,7 @@ enum vic_generic_prov_os_type {
 	VIC_GENERIC_PROV_OS_TYPE_ESX = 1,
 	VIC_GENERIC_PROV_OS_TYPE_LINUX = 2,
 	VIC_GENERIC_PROV_OS_TYPE_WINDOWS = 3,
+	VIC_GENERIC_PROV_OS_TYPE_SOLARIS = 4,
 };
 
 struct vic_provinfo {
@@ -61,14 +62,22 @@ struct vic_provinfo {
 	} tlv[0];
 } __packed;
 
+#define VIC_PROVINFO_ADD_TLV(vp, tlvtype, tlvlen, data) \
+	do { \
+		err = vic_provinfo_add_tlv(vp, tlvtype, tlvlen, data); \
+		if (err) \
+			goto add_tlv_failure; \
+	} while (0)
+
 #define VIC_PROVINFO_MAX_DATA		1385
 #define VIC_PROVINFO_MAX_TLV_DATA (VIC_PROVINFO_MAX_DATA - \
 	sizeof(struct vic_provinfo))
 
-struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type);
+struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui,
+	const u8 type);
 void vic_provinfo_free(struct vic_provinfo *vp);
 int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
-	void *value);
+	const void *value);
 size_t vic_provinfo_size(struct vic_provinfo *vp);
 
 #endif	/* _VNIC_VIC_H_ */


^ permalink raw reply related

* [net-next-2.6 PATCH 2/4] enic: Add wrapper routines for new fw devcmds for port profile handling
From: Roopa Prabhu @ 2011-03-30  6:35 UTC (permalink / raw)
  To: davem; +Cc: netdev
In-Reply-To: <20110330063533.7187.80458.stgit@savbu-pc100.cisco.com>

From: Roopa Prabhu <roprabhu@cisco.com>

This patch adds wrapper routines to new port profile related fw devcmds and
removes the old ones

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
---
 drivers/net/enic/enic_dev.c |   62 ++++++++++++++++++++++++++++++++++++++++---
 drivers/net/enic/enic_dev.h |    7 +++--
 2 files changed, 63 insertions(+), 6 deletions(-)


diff --git a/drivers/net/enic/enic_dev.c b/drivers/net/enic/enic_dev.c
index 37ad3a1..90687b1 100644
--- a/drivers/net/enic/enic_dev.c
+++ b/drivers/net/enic/enic_dev.c
@@ -177,24 +177,24 @@ int enic_vnic_dev_deinit(struct enic *enic)
 	return err;
 }
 
-int enic_dev_init_prov(struct enic *enic, struct vic_provinfo *vp)
+int enic_dev_init_prov2(struct enic *enic, struct vic_provinfo *vp)
 {
 	int err;
 
 	spin_lock(&enic->devcmd_lock);
-	err = vnic_dev_init_prov(enic->vdev,
+	err = vnic_dev_init_prov2(enic->vdev,
 		(u8 *)vp, vic_provinfo_size(vp));
 	spin_unlock(&enic->devcmd_lock);
 
 	return err;
 }
 
-int enic_dev_init_done(struct enic *enic, int *done, int *error)
+int enic_dev_deinit_done(struct enic *enic, int *status)
 {
 	int err;
 
 	spin_lock(&enic->devcmd_lock);
-	err = vnic_dev_init_done(enic->vdev, done, error);
+	err = vnic_dev_deinit_done(enic->vdev, status);
 	spin_unlock(&enic->devcmd_lock);
 
 	return err;
@@ -219,3 +219,57 @@ void enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
 	enic_del_vlan(enic, vid);
 	spin_unlock(&enic->devcmd_lock);
 }
+
+int enic_dev_enable2(struct enic *enic, int active)
+{
+	int err;
+
+	spin_lock(&enic->devcmd_lock);
+	err = vnic_dev_enable2(enic->vdev, active);
+	spin_unlock(&enic->devcmd_lock);
+
+	return err;
+}
+
+int enic_dev_enable2_done(struct enic *enic, int *status)
+{
+	int err;
+
+	spin_lock(&enic->devcmd_lock);
+	err = vnic_dev_enable2_done(enic->vdev, status);
+	spin_unlock(&enic->devcmd_lock);
+
+	return err;
+}
+
+int enic_dev_status_to_errno(int devcmd_status)
+{
+	switch (devcmd_status) {
+	case ERR_SUCCESS:
+		return 0;
+	case ERR_EINVAL:
+		return -EINVAL;
+	case ERR_EFAULT:
+		return -EFAULT;
+	case ERR_EPERM:
+		return -EPERM;
+	case ERR_EBUSY:
+		return -EBUSY;
+	case ERR_ECMDUNKNOWN:
+	case ERR_ENOTSUPPORTED:
+		return -EOPNOTSUPP;
+	case ERR_EBADSTATE:
+		return -EINVAL;
+	case ERR_ENOMEM:
+		return -ENOMEM;
+	case ERR_ETIMEDOUT:
+		return -ETIMEDOUT;
+	case ERR_ELINKDOWN:
+		return -ENETDOWN;
+	case ERR_EINPROGRESS:
+		return -EINPROGRESS;
+	case ERR_EMAXRES:
+	default:
+		return (devcmd_status < 0) ? devcmd_status : -1;
+	}
+}
diff --git a/drivers/net/enic/enic_dev.h b/drivers/net/enic/enic_dev.h
index 495f57f..d5f6813 100644
--- a/drivers/net/enic/enic_dev.h
+++ b/drivers/net/enic/enic_dev.h
@@ -35,7 +35,10 @@ int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);
 int enic_dev_enable(struct enic *enic);
 int enic_dev_disable(struct enic *enic);
 int enic_vnic_dev_deinit(struct enic *enic);
-int enic_dev_init_prov(struct enic *enic, struct vic_provinfo *vp);
-int enic_dev_init_done(struct enic *enic, int *done, int *error);
+int enic_dev_init_prov2(struct enic *enic, struct vic_provinfo *vp);
+int enic_dev_deinit_done(struct enic *enic, int *status);
+int enic_dev_enable2(struct enic *enic, int arg);
+int enic_dev_enable2_done(struct enic *enic, int *status);
+int enic_dev_status_to_errno(int devcmd_status);
 
 #endif /* _ENIC_DEV_H_ */


^ permalink raw reply related

* [net-next-2.6 PATCH 1/4] enic: Add support for new fw devcmds for port profile handling
From: Roopa Prabhu @ 2011-03-30  6:35 UTC (permalink / raw)
  To: davem; +Cc: netdev
In-Reply-To: <20110330063533.7187.80458.stgit@savbu-pc100.cisco.com>

From: Roopa Prabhu <roprabhu@cisco.com>

This patch introduces new fw devcmds for port profile handling.
These new commands are similar to the current fw commands for
port profile handling. The only difference being that the new
commands split the existing port profile handling devcmds into multiple
fw commands, giving the driver finer control over port profile operations.

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
---
 drivers/net/enic/vnic_dev.c    |   97 +++++++++++++++++++++++-----------------
 drivers/net/enic/vnic_dev.h    |    6 ++
 drivers/net/enic/vnic_devcmd.h |   57 +++++++++++++++++++++---
 3 files changed, 111 insertions(+), 49 deletions(-)


diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c
index c089b36..68f24ae 100644
--- a/drivers/net/enic/vnic_dev.c
+++ b/drivers/net/enic/vnic_dev.c
@@ -786,48 +786,6 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)
 	return r;
 }
 
-int vnic_dev_init_done(struct vnic_dev *vdev, int *done, int *err)
-{
-	u64 a0 = 0, a1 = 0;
-	int wait = 1000;
-	int ret;
-
-	*done = 0;
-
-	ret = vnic_dev_cmd(vdev, CMD_INIT_STATUS, &a0, &a1, wait);
-	if (ret)
-		return ret;
-
-	*done = (a0 == 0);
-
-	*err = (a0 == 0) ? (int)a1:0;
-
-	return 0;
-}
-
-int vnic_dev_init_prov(struct vnic_dev *vdev, u8 *buf, u32 len)
-{
-	u64 a0, a1 = len;
-	int wait = 1000;
-	dma_addr_t prov_pa;
-	void *prov_buf;
-	int ret;
-
-	prov_buf = pci_alloc_consistent(vdev->pdev, len, &prov_pa);
-	if (!prov_buf)
-		return -ENOMEM;
-
-	memcpy(prov_buf, buf, len);
-
-	a0 = prov_pa;
-
-	ret = vnic_dev_cmd(vdev, CMD_INIT_PROV_INFO, &a0, &a1, wait);
-
-	pci_free_consistent(vdev->pdev, len, prov_buf, prov_pa);
-
-	return ret;
-}
-
 int vnic_dev_deinit(struct vnic_dev *vdev)
 {
 	u64 a0 = 0, a1 = 0;
@@ -927,4 +885,59 @@ err_out:
 	return NULL;
 }
 
+int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len)
+{
+	u64 a0, a1 = len;
+	int wait = 1000;
+	dma_addr_t prov_pa;
+	void *prov_buf;
+	int ret;
+
+	prov_buf = pci_alloc_consistent(vdev->pdev, len, &prov_pa);
+	if (!prov_buf)
+		return -ENOMEM;
 
+	memcpy(prov_buf, buf, len);
+
+	a0 = prov_pa;
+
+	ret = vnic_dev_cmd(vdev, CMD_INIT_PROV_INFO2, &a0, &a1, wait);
+
+	pci_free_consistent(vdev->pdev, len, prov_buf, prov_pa);
+
+	return ret;
+}
+
+int vnic_dev_enable2(struct vnic_dev *vdev, int active)
+{
+	u64 a0, a1 = 0;
+	int wait = 1000;
+
+	a0 = (active ? CMD_ENABLE2_ACTIVE : 0);
+
+	return vnic_dev_cmd(vdev, CMD_ENABLE2, &a0, &a1, wait);
+}
+
+static int vnic_dev_cmd_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
+	int *status)
+{
+	u64 a0 = cmd, a1 = 0;
+	int wait = 1000;
+	int ret;
+
+	ret = vnic_dev_cmd(vdev, CMD_STATUS, &a0, &a1, wait);
+	if (!ret)
+		*status = (int)a0;
+
+	return ret;
+}
+
+int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status)
+{
+	return vnic_dev_cmd_status(vdev, CMD_ENABLE2, status);
+}
+
+int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status)
+{
+	return vnic_dev_cmd_status(vdev, CMD_DEINIT, status);
+}
diff --git a/drivers/net/enic/vnic_dev.h b/drivers/net/enic/vnic_dev.h
index e837546..cf482a2 100644
--- a/drivers/net/enic/vnic_dev.h
+++ b/drivers/net/enic/vnic_dev.h
@@ -108,8 +108,6 @@ int vnic_dev_disable(struct vnic_dev *vdev);
 int vnic_dev_open(struct vnic_dev *vdev, int arg);
 int vnic_dev_open_done(struct vnic_dev *vdev, int *done);
 int vnic_dev_init(struct vnic_dev *vdev, int arg);
-int vnic_dev_init_done(struct vnic_dev *vdev, int *done, int *err);
-int vnic_dev_init_prov(struct vnic_dev *vdev, u8 *buf, u32 len);
 int vnic_dev_deinit(struct vnic_dev *vdev);
 int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg);
 int vnic_dev_hang_reset_done(struct vnic_dev *vdev, int *done);
@@ -122,5 +120,9 @@ int vnic_dev_set_ig_vlan_rewrite_mode(struct vnic_dev *vdev,
 struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
 	void *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar,
 	unsigned int num_bars);
+int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len);
+int vnic_dev_enable2(struct vnic_dev *vdev, int active);
+int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status);
+int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status);
 
 #endif /* _VNIC_DEV_H_ */
diff --git a/drivers/net/enic/vnic_devcmd.h b/drivers/net/enic/vnic_devcmd.h
index d833a07..c5569bf 100644
--- a/drivers/net/enic/vnic_devcmd.h
+++ b/drivers/net/enic/vnic_devcmd.h
@@ -267,17 +267,62 @@ enum vnic_devcmd_cmd {
 
 	/*
 	 * As for BY_BDF except a0 is index of hvnlink subordinate vnic
-	 * or SR-IOV virtual vnic */
+	 * or SR-IOV virtual vnic
+	 */
 	CMD_PROXY_BY_INDEX =    _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 43),
 
 	/*
-	 * in:  (u64)a0=paddr of buffer to put latest VIC VIF-CONFIG-INFO TLV in
-	 *      (u32)a1=length of buffer in a0
-	 * out: (u64)a0=paddr of buffer with latest VIC VIF-CONFIG-INFO TLV
-	 *      (u32)a1=actual length of latest VIC VIF-CONFIG-INFO TLV */
+	 * For HPP toggle:
+	 * adapter-info-get
+	 * in:  (u64)a0=phsical address of buffer passed in from caller.
+	 *      (u16)a1=size of buffer specified in a0.
+	 * out: (u64)a0=phsical address of buffer passed in from caller.
+	 *      (u16)a1=actual bytes from VIF-CONFIG-INFO TLV, or
+	 *              0 if no VIF-CONFIG-INFO TLV was ever received. */
 	CMD_CONFIG_INFO_GET     = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44),
+
+	/* init_prov_info2:
+	 * Variant of CMD_INIT_PROV_INFO, where it will not try to enable
+	 * the vnic until CMD_ENABLE2 is issued.
+	 *     (u64)a0=paddr of vnic_devcmd_provinfo
+	 *     (u32)a1=sizeof provision info */
+	CMD_INIT_PROV_INFO2  = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47),
+
+	/* enable2:
+	 *      (u32)a0=0                  ==> standby
+	 *             =CMD_ENABLE2_ACTIVE ==> active
+	 */
+	CMD_ENABLE2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 48),
+
+	/*
+	 * cmd_status:
+	 *     Returns the status of the specified command
+	 * Input:
+	 *     a0 = command for which status is being queried.
+	 *          Possible values are:
+	 *              CMD_SOFT_RESET
+	 *              CMD_HANG_RESET
+	 *              CMD_OPEN
+	 *              CMD_INIT
+	 *              CMD_INIT_PROV_INFO
+	 *              CMD_DEINIT
+	 *              CMD_INIT_PROV_INFO2
+	 *              CMD_ENABLE2
+	 * Output:
+	 *     if status == STAT_ERROR
+	 *        a0 = ERR_ENOTSUPPORTED - status for command in a0 is
+	 *                                 not supported
+	 *     if status == STAT_NONE
+	 *        a0 = status of the devcmd specified in a0 as follows.
+	 *             ERR_SUCCESS   - command in a0 completed successfully
+	 *             ERR_EINPROGRESS - command in a0 is still in progress
+	 */
+	CMD_STATUS = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 49),
 };
 
+/* CMD_ENABLE2 flags */
+#define CMD_ENABLE2_ACTIVE  0x1
+
 /* flags for CMD_OPEN */
 #define CMD_OPENF_OPROM		0x1	/* open coming from option rom */
 
@@ -315,6 +360,8 @@ enum vnic_devcmd_error {
 	ERR_ETIMEDOUT = 8,
 	ERR_ELINKDOWN = 9,
 	ERR_EMAXRES = 10,
+	ERR_ENOTSUPPORTED = 11,
+	ERR_EINPROGRESS = 12,
 };
 
 /*


^ permalink raw reply related

* [net-next-2.6 PATCH 0/4] enic: updates to version 2.1.1.13
From: Roopa Prabhu @ 2011-03-30  6:35 UTC (permalink / raw)
  To: davem; +Cc: netdev

This patch series implements the following enic driver updates:

01/4 - enic: Add support for new fw devcmds for port profile handling
02/4 - enic: Add wrapper routines for new fw devcmds for port profile handling
03/4 - enic: Cleanups in port profile helper code
04/4 - enic: Add support for PORT_REQUEST_PREASSOCIATE_RR

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>

^ permalink raw reply

* [PATCH] net: Fix warnings caused by MAX_SKB_FRAGS change.
From: David Miller @ 2011-03-30  6:34 UTC (permalink / raw)
  To: anton; +Cc: netdev


After commit a715dea3c8e9ef2771c534e05ee1d36f65987e64 ("net: Always
allocate at least 16 skb frags regardless of page size"), the value
of MAX_SKB_FRAGS can now take on either an "unsigned long" or an
"int" value.

This causes warnings like:

net/packet/af_packet.c: In function ‘tpacket_fill_skb’:
net/packet/af_packet.c:948: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘int’

Fix by forcing the constant to be unsigned long, otherwise we have
a situation where the type of a system wide constant is variable.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/linux/skbuff.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 239083b..d9e52fa 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -126,7 +126,7 @@ struct sk_buff;
  * GRO uses frags we allocate at least 16 regardless of page size.
  */
 #if (65536/PAGE_SIZE + 2) < 16
-#define MAX_SKB_FRAGS 16
+#define MAX_SKB_FRAGS 16UL
 #else
 #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2)
 #endif
-- 
1.7.4.2


^ permalink raw reply related

* Re: ethtool physical identify vs netlink locking?
From: Stephen Hemminger @ 2011-03-30  6:29 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: Ben Hutchings, David Miller, netdev
In-Reply-To: <AANLkTi=um5CecqdXeqBNKHv4nWk7-bZ27aL5=bXFi0SE@mail.gmail.com>

On Wed, 30 Mar 2011 03:35:40 +0200
Michał Mirosław <mirqus@gmail.com> wrote:

> 2011/3/30 Ben Hutchings <bhutchings@solarflare.com>:
> > On Tue, 2011-03-29 at 13:52 -0700, Stephen Hemminger wrote:
> >> Right now if an administrator uses the ethtool function to identify network
> >> interface, the netlink lock can be held indefinitely. In other words, doing
> >> "ethtool -p eth1" will stop all other netlink activity. This is bad, imagine
> >> the case of an operator doing that to find a NIC in a rack, and because of
> >> the netlink lockout all routing daemon activity stops.
> [...]
> >> There are several possible solutions but most involve fixing all the device
> >> drivers (24). Options:
> >>
> >> 1. Have device driver drop and reacquire rtnl() while blinking
> >> 2. Have ethtool core drop rtnl before calling device driver
> >> 3. Add per-device ethtool rtnl lock
> > 4. Define a ethtool operation 'set_id_state' with an argument that sets
> > identification on/off/inactive/active (the last optional, for any driver
> > that really wants to do this differently).  When this is defined, the
> > ethtool core runs the loop and acquires the lock each time it calls this
> > operation.
> 
> 5. Have a driver register a LED class device instead of implementing
> an ethtool op.
> 
> Hmm. This would require changes to userspace ethtool command. I wonder
> if anything else uses this call?

Full LED support is overkill for this I think. Especially if it means creating
24 unique LED drivers.

Ben's idea seams the best so far. 

^ permalink raw reply

* Re: [PATCH] bridge: return value for br_stp_recalculate_bridge_id()
From: Stephen Hemminger @ 2011-03-30  6:27 UTC (permalink / raw)
  To: Dongdong Deng; +Cc: davem, netdev, bridge
In-Reply-To: <1301466207-16770-1-git-send-email-dongdong.deng@windriver.com>

On Wed, 30 Mar 2011 14:23:27 +0800
Dongdong Deng <dongdong.deng@windriver.com> wrote:

> Return 'false' for "user has set a mac addr" case in
> br_stp_recalculate_bridge_id() function.
> 
> and this could address the following build warning:
> 
> net/bridge/br_stp_if.c: In function br_stp_recalculate_bridge_id:
> net/bridge/br_stp_if.c:216: warning: return with no value, in function
> returning non-void
> 
> Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>

Patch has already been submitted and acke'd for this.

^ permalink raw reply

* [PATCH] bridge: return value for br_stp_recalculate_bridge_id()
From: Dongdong Deng @ 2011-03-30  6:23 UTC (permalink / raw)
  To: davem, shemminger; +Cc: netdev, bridge, dongdong.deng

Return 'false' for "user has set a mac addr" case in
br_stp_recalculate_bridge_id() function.

and this could address the following build warning:

net/bridge/br_stp_if.c: In function br_stp_recalculate_bridge_id:
net/bridge/br_stp_if.c:216: warning: return with no value, in function
returning non-void

Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
---
 net/bridge/br_stp_if.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 5593f5a..9b61d09 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -213,7 +213,7 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)
 
 	/* user has chosen a value so keep it */
 	if (br->flags & BR_SET_MAC_ADDR)
-		return;
+		return false;
 
 	list_for_each_entry(p, &br->port_list, list) {
 		if (addr == br_mac_zero ||
-- 
1.6.0.4


^ permalink raw reply related

* Re: [PATCH] netfilter: Fix build failure when ipv6 but xt_tproxy is built in
From: David Miller @ 2011-03-30  5:35 UTC (permalink / raw)
  To: rostedt; +Cc: linux-kernel, hidden, akpm, netfilter-devel, kaber, netdev
In-Reply-To: <1301451199.14261.327.camel@gandalf.stny.rr.com>

From: Steven Rostedt <rostedt@goodmis.org>
Date: Tue, 29 Mar 2011 22:13:19 -0400

> While running ktest.pl doing ranconfigs, the following build error
> occurred:

Is sending netfilter patches to the explicitly listed maintainer in
MAINTAINERS too much to ask Stephen? :-/

CC:'d

> 
> net/built-in.o: In function `tproxy_tg6_v1':
> /home/rostedt/work/autotest/nobackup/linux-test.git/net/netfilter/xt_TPROXY.c:288: undefined reference to `ipv6_find_hdr'
> 
> This happened because the xt_TPROXY code was compiled into the kernel
> proper, but the ipv6 netfilter was compiled as a module. The fix is to
> only enter the code that calls ipv6_find_hdr if ipv6 netfilter is
> compiled into the kernel, or if it is a module, so is the xt_TPROXY
> code.
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> 
> diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c
> index dcfd57e..5915f94 100644
> --- a/net/netfilter/xt_TPROXY.c
> +++ b/net/netfilter/xt_TPROXY.c
> @@ -22,7 +22,13 @@
>  
>  #include <net/netfilter/ipv4/nf_defrag_ipv4.h>
>  
> -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
> +/*
> + * Only include the following if ip6 tables is compiled in
> + * the kernel, or it is a module and this code is also a module.
> + */
> +#if defined(CONFIG_IP6_NF_IPTABLES) || \
> +	(defined(CONFIG_IP6_NF_IPTABLES_MODULE) && \
> +	 defined(CONFIG_NETFILTER_XT_TARGET_TPROXY_MODULE))
>  #define XT_TPROXY_HAVE_IPV6 1
>  #include <net/if_inet6.h>
>  #include <net/addrconf.h>
> 
> 

^ permalink raw reply

* [PATCH] pl25a1_support
From: Simon Wood @ 2011-03-30  3:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Brownell, Simon Wood

Adds support for 'Windows Easy Transfer' cables based around the
Prolific PL-25A1 chip (includes Belkin F5U258 & F5U279)

Patch originally suggested by David Brownell here:
http://www.mail-archive.com/netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg61926.html

Modified to work with latest kernel, tested with F5U279.

Signed-off-by: Simon Wood <simon-wM4F9T/ekXmXDw4h08c5KA@public.gmane.org>
---
 drivers/net/usb/Kconfig |    2 +-
 drivers/net/usb/plusb.c |   33 ++++++++++++++++++++++++++-------
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 6f600cc..85fec06 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -258,7 +258,7 @@ config USB_NET_NET1080
 	  optionally with LEDs that indicate traffic
 
 config USB_NET_PLUSB
-	tristate "Prolific PL-2301/2302 based cables"
+	tristate "Prolific PL-2301/2302/25A1 based cables"
 	# if the handshake/init/reset problems, from original 'plusb',
 	# are ever resolved ... then remove "experimental"
 	depends on USB_USBNET && EXPERIMENTAL
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 08ad269..a20afac 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -45,6 +45,14 @@
  * seems to get wedged under load.  Prolific docs are weak, and
  * don't identify differences between PL2301 and PL2302, much less
  * anything to explain the different PL2302 versions observed.
+ *
+ * NOTE:  pl2501 has several modes, including pl2301 and pl2302
+ * compatibility.   Some docs suggest the difference between 2301
+ * and 2302 is only to make MS-Windows use a different driver...
+ *
+ * pl25a1 glue based on patch from Tony Gibbs.  Prolific "docs" on
+ * this chip are as usual incomplete about what control messages
+ * are supported.
  */
 
 /*
@@ -89,13 +97,17 @@ static int pl_reset(struct usbnet *dev)
 	/* some units seem to need this reset, others reject it utterly.
 	 * FIXME be more like "naplink" or windows drivers.
 	 */
-	(void) pl_set_QuickLink_features(dev,
+	int     status;
+
+        status = pl_set_QuickLink_features(dev,
 		PL_S_EN|PL_RESET_OUT|PL_RESET_IN|PL_PEER_E);
+	if (status != 0 && netif_msg_probe(dev))
+		netif_dbg(dev, link, dev->net, "pl_reset --> %d\n", status);
 	return 0;
 }
 
 static const struct driver_info	prolific_info = {
-	.description =	"Prolific PL-2301/PL-2302",
+	.description =  "Prolific PL-2301/PL-2302/PL-25A1",
 	.flags =	FLAG_NO_SETINT,
 		/* some PL-2302 versions seem to fail usb_set_interface() */
 	.reset =	pl_reset,
@@ -110,7 +122,7 @@ static const struct driver_info	prolific_info = {
  */
 
 static const struct usb_device_id	products [] = {
-
+/* full speed cables */
 {
 	USB_DEVICE(0x067b, 0x0000),	// PL-2301
 	.driver_info =	(unsigned long) &prolific_info,
@@ -118,7 +130,14 @@ static const struct usb_device_id	products [] = {
 	USB_DEVICE(0x067b, 0x0001),	// PL-2302
 	.driver_info =	(unsigned long) &prolific_info,
 },
-
+/* high speed cables */
+{
+	USB_DEVICE(0x067b, 0x25a1),     /* PL-25A1, no eeprom */
+	.driver_info =  (unsigned long) &prolific_info,
+}, {
+	USB_DEVICE(0x050d, 0x258a),     /* Belkin F5U258/F5U279 (PL-25A1) */
+	.driver_info =  (unsigned long) &prolific_info,
+},
 	{ },		// END
 };
 MODULE_DEVICE_TABLE(usb, products);
@@ -134,16 +153,16 @@ static struct usb_driver plusb_driver = {
 
 static int __init plusb_init(void)
 {
- 	return usb_register(&plusb_driver);
+	return usb_register(&plusb_driver);
 }
 module_init(plusb_init);
 
 static void __exit plusb_exit(void)
 {
- 	usb_deregister(&plusb_driver);
+	usb_deregister(&plusb_driver);
 }
 module_exit(plusb_exit);
 
 MODULE_AUTHOR("David Brownell");
-MODULE_DESCRIPTION("Prolific PL-2301/2302 USB Host to Host Link Driver");
+MODULE_DESCRIPTION("Prolific PL-2301/2302/25A1 USB Host to Host Link Driver");
 MODULE_LICENSE("GPL");
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: ping when network down BUG: unable to handle kernel NULL pointer dereference at 000000000000001b
From: Jeff Chua @ 2011-03-30  2:13 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: lkml, Network Development
In-Reply-To: <1301410764.3161.156.camel@edumazet-laptop>

On Tue, Mar 29, 2011 at 10:59 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le mardi 29 mars 2011 à 22:54 +0800, Jeff Chua a écrit :
>> I don't know when this started happening as my network was always up.
>> Just down, I shutdown my network, and ping a known host and
>> encountered this BUG.
> Known problem, should be fixed by
 http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=4910ac6c526d2868adcb5893e0c428473de862b5

Cool. I just git pulled the commit, and it works now!

Thanks,
Jeff

^ permalink raw reply

* Re: ethtool physical identify vs netlink locking?
From: Michał Mirosław @ 2011-03-30  1:35 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Stephen Hemminger, David Miller, netdev
In-Reply-To: <1301443676.10056.57.camel@localhost>

2011/3/30 Ben Hutchings <bhutchings@solarflare.com>:
> On Tue, 2011-03-29 at 13:52 -0700, Stephen Hemminger wrote:
>> Right now if an administrator uses the ethtool function to identify network
>> interface, the netlink lock can be held indefinitely. In other words, doing
>> "ethtool -p eth1" will stop all other netlink activity. This is bad, imagine
>> the case of an operator doing that to find a NIC in a rack, and because of
>> the netlink lockout all routing daemon activity stops.
[...]
>> There are several possible solutions but most involve fixing all the device
>> drivers (24). Options:
>>
>> 1. Have device driver drop and reacquire rtnl() while blinking
>> 2. Have ethtool core drop rtnl before calling device driver
>> 3. Add per-device ethtool rtnl lock
> 4. Define a ethtool operation 'set_id_state' with an argument that sets
> identification on/off/inactive/active (the last optional, for any driver
> that really wants to do this differently).  When this is defined, the
> ethtool core runs the loop and acquires the lock each time it calls this
> operation.

5. Have a driver register a LED class device instead of implementing
an ethtool op.

Hmm. This would require changes to userspace ethtool command. I wonder
if anything else uses this call?

Best Regards,
Michał Mirosław

^ permalink raw reply

* Re: ethtool physical identify vs netlink locking?
From: Stephen Hemminger @ 2011-03-30  0:23 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: David Miller, netdev
In-Reply-To: <1301443676.10056.57.camel@localhost>

On Wed, 30 Mar 2011 01:07:56 +0100
Ben Hutchings <bhutchings@solarflare.com> wrote:

> 4. Define a ethtool operation 'set_id_state' with an argument that sets

I like this way, but the code should return -EINTR if interrupted?

^ permalink raw reply

* Re: [Bugme-new] [Bug 28512] New: IPv6 SLAAC address preferred over static one as source address
From: David Miller @ 2011-03-30  0:20 UTC (permalink / raw)
  To: akpm; +Cc: netdev, bugzilla-daemon, bugme-daemon, ghen
In-Reply-To: <20110207152048.22c51184.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-foundation.org>
Date: Mon, 7 Feb 2011 15:20:48 -0800

>> SLAAC addresses will have a limited preferred lifetime (as defined by the
>> router), static addresses will usually have an unlimited preferred lifetime
>> (0).  So it makes a lot of sense to take this preferred lifetime into account
>> for source address selection (how is it otherwise "preferred"?).

This is debatable.

One could just as easily say that an address with a shorter preferred
lifetime has been revalidated more recently, and therefore is more
likely to be uptodate, valid, and lead to a usable path.

I think the lack of specification for the final tie-breaker in the RFC
was intentional :-)

The specification has to address this, and until the situation is more
clear cut than it is now I don't see any benefit for changing Linux's
behavior.  Especially since there is a configuration based workaround
which works for people in the short-term.

But I'm willing to be convinced, and those wanting to convince me can
post a patch for review to netdev@vger.kernel.org :-)

^ permalink raw reply

* Re: ethtool physical identify vs netlink locking?
From: David Miller @ 2011-03-30  0:13 UTC (permalink / raw)
  To: bhutchings; +Cc: shemminger, netdev
In-Reply-To: <1301443676.10056.57.camel@localhost>

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 30 Mar 2011 01:07:56 +0100

> In the sfc driver, physical ID used to be delegated to the PHY
> operations.  Then I realised that it was pointless to use a PHY's blink
> mode where it was available and a periodic timer on the host where it
> wasn't, when the latter would work for all of them.  So I would propose:
> 
> 4. Define a ethtool operation 'set_id_state' with an argument that sets
> identification on/off/inactive/active (the last optional, for any driver
> that really wants to do this differently).  When this is defined, the
> ethtool core runs the loop and acquires the lock each time it calls this
> operation.
> 
> This requires changes to every driver, though not all at once.  As an
> additional benefit, it should result in consistent behaviour for the
> count = 0 case.

This seems like a good way to solve the problem.

^ permalink raw reply

* Re: ethtool physical identify vs netlink locking?
From: Ben Hutchings @ 2011-03-30  0:07 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20110329135252.116bf5e0@s6510>

On Tue, 2011-03-29 at 13:52 -0700, Stephen Hemminger wrote:
> Right now if an administrator uses the ethtool function to identify network
> interface, the netlink lock can be held indefinitely. In other words, doing
> "ethtool -p eth1" will stop all other netlink activity. This is bad, imagine
> the case of an operator doing that to find a NIC in a rack, and because of
> the netlink lockout all routing daemon activity stops.

Also, glibc can enumerate devices during name lookup now (if I remember
correctly), so new connections to servers that do reverse name lookups
tend to stall immediately.

> There are several possible solutions but most involve fixing all the device
> drivers (24). Options:
> 
> 1. Have device driver drop and reacquire rtnl() while blinking
> 2. Have ethtool core drop rtnl before calling device driver
> 3. Add per-device ethtool rtnl lock
> 
> #1 is the least disruption

but nasty!

> #2 means additional locking maybe required for each device driver
> #3 seems like excessive overhead.

In the sfc driver, physical ID used to be delegated to the PHY
operations.  Then I realised that it was pointless to use a PHY's blink
mode where it was available and a periodic timer on the host where it
wasn't, when the latter would work for all of them.  So I would propose:

4. Define a ethtool operation 'set_id_state' with an argument that sets
identification on/off/inactive/active (the last optional, for any driver
that really wants to do this differently).  When this is defined, the
ethtool core runs the loop and acquires the lock each time it calls this
operation.

This requires changes to every driver, though not all at once.  As an
additional benefit, it should result in consistent behaviour for the
count = 0 case.

The core ethtool function would look something like:

static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
{
	struct ethtool_value id;
	int rc;

	if (!dev->ethtool_ops->phys_id && !dev->ethtool_ops->set_id_led)
		return -EOPNOTSUPP;

	if (copy_from_user(&id, useraddr, sizeof(id)))
		return -EFAULT;

	if (!dev->ethtool_ops->set_id_led)
		/* Do it the old way */
		return dev->ethtool_ops->phys_id(dev, id.data);

	rc = dev->ethtool_ops->set_id_state(dev, ETHTOOL_ID_ACTIVE);
	if (rc && rc != -EINVAL)
		return rc;

	dev_hold(dev);
	rtnl_unlock();

	if (rc == 0) {
		/* Driver will handle this itself */
		schedule_timeout_interruptible(
			id.data ? id.data : MAX_SCHEDULE_TIMEOUT);
	} else {
		/* Driver expects to be called periodically */
		do {
			rtnl_lock();
			rc = dev->ethtool_ops->set_id_state(dev, ETHTOOL_ID_ON);
			rtnl_unlock();
			if (rc)
				break;
			schedule_timeout_interruptible(HZ / 2);

			rtnl_lock();
			rc = dev->ethtool_ops->set_id_state(dev, ETHTOOL_ID_OFF);
			rtnl_unlock();
			if (rc)
				break;
			schedule_timeout_interruptible(HZ / 2);
		} while (!signal_pending(current) &&
			 (id.data == 0 || --id.data != 0));
	}

	rtnl_lock();
	dev_put(dev);

	(void)dev->ethtool_ops->set_id_state(dev, ETHTOOL_ID_INACTIVE);
	return rc;
}

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply

* Re: [PATCH 0/3] igb: cleanup and code deduplication
From: Jeff Kirsher @ 2011-03-30  0:00 UTC (permalink / raw)
  To: Stefan Assmann; +Cc: e1000-devel, netdev
In-Reply-To: <1301404186-20872-1-git-send-email-sassmann@kpanic.de>

On Tue, Mar 29, 2011 at 06:09, Stefan Assmann <sassmann@kpanic.de> wrote:
> Some cleanups for igb.
> First patch is just a simple typo fix.
> Second patch turns igb_update_nvm_checksum and igb_validate_nvm_checksum
> into wrapper functions to deduplicate code.
> Third patch puts the thermal sensor code into a function. This patch could use
> some testing as I couldn't really test it due to lack of hardware.
>
>  Stefan
>
> Stefan Assmann (3):
>  igb: fix typo in igb_validate_nvm_checksum_82580
>  igb: transform igb_{update,validate}_nvm_checksum into wrappers of
>    their *_with_offset equivalents
>  igb: introduce igb_thermal_sensor_event for sensor checking
>
>  drivers/net/igb/e1000_82575.c |   79 ++--------------------------------------
>  drivers/net/igb/e1000_nvm.c   |   38 +++++++++++++++----
>  drivers/net/igb/e1000_nvm.h   |    2 +
>  drivers/net/igb/igb_main.c    |   67 +++++++++++++++++-----------------
>  4 files changed, 70 insertions(+), 116 deletions(-)
>
>

Thanks Stefan, I have added these patches to my igb-queue.

-- 
Cheers,
Jeff

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply

* Re: [PATCH] net: allow shifted address in smsc911x
From: Mathieu Poirier @ 2011-03-29 21:17 UTC (permalink / raw)
  To: David Miller; +Cc: steve.glendinning, netdev, lee.jones, patches, linus.walleij
In-Reply-To: <20110325.143103.25112180.davem@davemloft.net>

My first email bounced on the list, hence sending again.

Please see my comments below.

Thanks,
Mathieu.

On 25 March 2011 15:31, David Miller <davem@davemloft.net> wrote:
> From: mathieu.poirier@linaro.org
> Date: Fri, 25 Mar 2011 15:27:17 -0600
>
>> From: Alessandro Rubini <rubini@gnudd.com>
>>
>> At least one device I'm using needs address shifting to access
>> registers in the LAN9221 device (smsc911x driver).  This patch
>> adds a shift parameter in platform_data. The feature must be
>> enabled at configuration time, because shifting by a pdata
>> parameter makes access slower in those devices where no shift is
>> needed (I tested one, it was 20% slower).
>>
>> If the platform data requests shifted access but the feature is
>> unavailable, the probe method complains to the console. Board
>> config files should set the configuration option when needed.
>>
>> Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
>> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>
> Implement this at run time, keying off of a boolean or similar
> in the platform data.
>
> Implement a set of ops, one to do a PIO read one to do a PIO write,
> and choose the set of ops appropriate for the device depending upon
> the setting found in the platform device.
>

I'm find with this approach but confused on the way to implement it.

I could add the shifted read/write functions in smsc911x.c and choose,
based on a boolean found in the 'smsc911x_platform_config' struct,
which will be used (the original or the shifted methods).  The
drawback with this approach is the new shifted read/write methods are
polluting smsc911x.c, something I'm not so fond of.  It might be
acceptable for one set of OPS but what if there is many more ?

A better approach would be to pass the read/write methods to the
smsc911x core using the 'smsc911x_platform_config' structure.  That
way smsc911x.c is kept clean but we'd have to move 'struct
smsc911x_data' to smsc911x.h to implement the methods from the board
files, something I'm not about do to without some sort of consensus.

'smsc911x_tx_writefifo' and 'smsc911x_rx_readfifo' are also of concern
to me.  I understand the usage of writesl/readsl but it introduces
more challenges.  If we don't want to replace their usage by a while
loop as it is the case when SMSC911X_SWAP_FIFO and SMSC911X_USE_16BIT
are set, we will need to introduce rx_readfifo and rx_writefifo in the
OPS.

Enlightenment is required on the above.

Best regards,
Mathieu.

^ 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