netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes
@ 2010-10-04 14:20 Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 1/8] qlcnic: fix internal loopback test Amit Kumar Salecha
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty

Hi
 Series v2 of 8 patches to fix endianesses for PPC, internal loopback test
 and etc. Accidentally, earlier patch series had a garbage patch.

 Apply these on net-next branch.
-Amit

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCHv2 NEXT 1/8] qlcnic: fix internal loopback test
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats Amit Kumar Salecha
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty

o Loop 10 times with delay of 1 ms to rcv packet.
o Print garbage packet.
o Try send/receive MAX(16) packet, instead of exit from test,
  if a packet is not received.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic_ethtool.c |   26 +++++++++++++++++++-------
 drivers/net/qlcnic/qlcnic_init.c    |   19 ++++++++++++++++++-
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index cb9463b..550cfe9 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -636,6 +636,8 @@ static int qlcnic_get_sset_count(struct net_device *dev, int sset)
 }
 
 #define QLC_ILB_PKT_SIZE 64
+#define QLC_NUM_ILB_PKT	16
+#define QLC_ILB_MAX_RCV_LOOP 10
 
 static void qlcnic_create_loopback_buff(unsigned char *data)
 {
@@ -657,24 +659,34 @@ static int qlcnic_do_ilb_test(struct qlcnic_adapter *adapter)
 	struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx;
 	struct qlcnic_host_sds_ring *sds_ring = &recv_ctx->sds_rings[0];
 	struct sk_buff *skb;
-	int i;
+	int i, loop, cnt = 0;
 
-	for (i = 0; i < 16; i++) {
+	for (i = 0; i < QLC_NUM_ILB_PKT; i++) {
 		skb = dev_alloc_skb(QLC_ILB_PKT_SIZE);
 		qlcnic_create_loopback_buff(skb->data);
 		skb_put(skb, QLC_ILB_PKT_SIZE);
 
 		adapter->diag_cnt = 0;
-
 		qlcnic_xmit_frame(skb, adapter->netdev);
 
-		msleep(5);
-
-		qlcnic_process_rcv_ring_diag(sds_ring);
+		loop = 0;
+		do {
+			msleep(1);
+			qlcnic_process_rcv_ring_diag(sds_ring);
+		} while (loop++ < QLC_ILB_MAX_RCV_LOOP &&
+			 !adapter->diag_cnt);
 
 		dev_kfree_skb_any(skb);
+
 		if (!adapter->diag_cnt)
-			return -1;
+			dev_warn(&adapter->pdev->dev, "ILB Test: %dth packet"
+				" not recevied\n", i + 1);
+		else
+			cnt++;
+	}
+	if (cnt != i) {
+		dev_warn(&adapter->pdev->dev, "ILB Test failed\n");
+		return -1;
 	}
 	return 0;
 }
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 5c33d15..908a25b 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -1693,6 +1693,18 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter,
 	spin_unlock(&rds_ring->lock);
 }
 
+static void dump_skb(struct sk_buff *skb)
+{
+	int i;
+	unsigned char *data = skb->data;
+
+	for (i = 0; i < skb->len; i++) {
+		printk("%02x ", data[i]);
+		if ((i & 0x0f) == 8)
+			printk("\n");
+	}
+}
+
 static struct qlcnic_rx_buffer *
 qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
 		struct qlcnic_host_sds_ring *sds_ring,
@@ -1723,13 +1735,18 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
 	if (!skb)
 		return buffer;
 
-	skb_put(skb, rds_ring->skb_size);
+	if (length > rds_ring->skb_size)
+		skb_put(skb, rds_ring->skb_size);
+	else
+		skb_put(skb, length);
 
 	if (pkt_offset)
 		skb_pull(skb, pkt_offset);
 
 	if (!qlcnic_check_loopback_buff(skb->data))
 		adapter->diag_cnt++;
+	else
+		dump_skb(skb);
 
 	dev_kfree_skb_any(skb);
 	adapter->stats.rx_pkts++;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 1/8] qlcnic: fix internal loopback test Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 3/8] qlcnic: fix diag register Amit Kumar Salecha
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty

Some of the counters are not implemented in fw.
Fw return NOT AVAILABLE VALUE as (0xffffffffffffffff).
Adding these counters, result in invalid value.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h     |   12 ++++++++++++
 drivers/net/qlcnic/qlcnic_ctx.c |   31 ++++++++++++++++++++++---------
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 714ddf4..4667463 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -1169,6 +1169,18 @@ struct qlcnic_esw_func_cfg {
 #define QLCNIC_STATS_ESWITCH		2
 #define QLCNIC_QUERY_RX_COUNTER		0
 #define QLCNIC_QUERY_TX_COUNTER		1
+#define QLCNIC_ESW_STATS_NOT_AVAIL	0xffffffffffffffffULL
+
+#define QLCNIC_ADD_ESW_STATS(VAL1, VAL2)\
+do {	\
+	if (((VAL1) == QLCNIC_ESW_STATS_NOT_AVAIL) && \
+	    ((VAL2) != QLCNIC_ESW_STATS_NOT_AVAIL)) \
+		(VAL1) = (VAL2); \
+	else if (((VAL1) != QLCNIC_ESW_STATS_NOT_AVAIL) && \
+		 ((VAL2) != QLCNIC_ESW_STATS_NOT_AVAIL)) \
+			(VAL1) += (VAL2); \
+} while (0)
+
 struct __qlcnic_esw_statistics {
 	__le16 context_id;
 	__le16 version;
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index 95a821e..a4c4d09 100644
--- a/drivers/net/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/qlcnic/qlcnic_ctx.c
@@ -1016,7 +1016,14 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch,
 	if (adapter->npars == NULL)
 		return -EIO;
 
-	memset(esw_stats, 0, sizeof(struct __qlcnic_esw_statistics));
+	memset(esw_stats, 0, sizeof(u64));
+	esw_stats->unicast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
+	esw_stats->multicast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
+	esw_stats->broadcast_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
+	esw_stats->dropped_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
+	esw_stats->errors = QLCNIC_ESW_STATS_NOT_AVAIL;
+	esw_stats->local_frames = QLCNIC_ESW_STATS_NOT_AVAIL;
+	esw_stats->numbytes = QLCNIC_ESW_STATS_NOT_AVAIL;
 	esw_stats->context_id = eswitch;
 
 	for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
@@ -1029,14 +1036,20 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch,
 
 		esw_stats->size = port_stats.size;
 		esw_stats->version = port_stats.version;
-		esw_stats->unicast_frames += port_stats.unicast_frames;
-		esw_stats->multicast_frames += port_stats.multicast_frames;
-		esw_stats->broadcast_frames += port_stats.broadcast_frames;
-		esw_stats->dropped_frames += port_stats.dropped_frames;
-		esw_stats->errors += port_stats.errors;
-		esw_stats->local_frames += port_stats.local_frames;
-		esw_stats->numbytes += port_stats.numbytes;
-
+		QLCNIC_ADD_ESW_STATS(esw_stats->unicast_frames,
+						port_stats.unicast_frames);
+		QLCNIC_ADD_ESW_STATS(esw_stats->multicast_frames,
+						port_stats.multicast_frames);
+		QLCNIC_ADD_ESW_STATS(esw_stats->broadcast_frames,
+						port_stats.broadcast_frames);
+		QLCNIC_ADD_ESW_STATS(esw_stats->dropped_frames,
+						port_stats.dropped_frames);
+		QLCNIC_ADD_ESW_STATS(esw_stats->errors,
+						port_stats.errors);
+		QLCNIC_ADD_ESW_STATS(esw_stats->local_frames,
+						port_stats.local_frames);
+		QLCNIC_ADD_ESW_STATS(esw_stats->numbytes,
+						port_stats.numbytes);
 		ret = 0;
 	}
 	return ret;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv2 NEXT 3/8] qlcnic: fix diag register
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 1/8] qlcnic: fix internal loopback test Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 4/8] qlcnic: fix endianess for lro Amit Kumar Salecha
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty

regs_buff[i] and diag_registers[j] array should use different index
variable.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic_ethtool.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 550cfe9..6a76014 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -343,7 +343,7 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
 	struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx;
 	struct qlcnic_host_sds_ring *sds_ring;
 	u32 *regs_buff = p;
-	int ring, i = 0;
+	int ring, i = 0, j = 0;
 
 	memset(p, 0, qlcnic_get_regs_len(dev));
 	regs->version = (QLCNIC_ETHTOOL_REGS_VER << 24) |
@@ -352,8 +352,8 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
 	regs_buff[0] = (0xcafe0000 | (QLCNIC_DEV_INFO_SIZE & 0xffff));
 	regs_buff[1] = QLCNIC_MGMT_API_VERSION;
 
-	for (i = QLCNIC_DEV_INFO_SIZE + 1; diag_registers[i] != -1; i++)
-		regs_buff[i] = QLCRD32(adapter, diag_registers[i]);
+	for (i = QLCNIC_DEV_INFO_SIZE + 1; diag_registers[j] != -1; j++, i++)
+		regs_buff[i] = QLCRD32(adapter, diag_registers[j]);
 
 	if (!test_bit(__QLCNIC_DEV_UP, &adapter->state))
 		return;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv2 NEXT 4/8] qlcnic: fix endianess for lro
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
                   ` (2 preceding siblings ...)
  2010-10-04 14:20 ` [PATCHv2 NEXT 3/8] qlcnic: fix diag register Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine Amit Kumar Salecha
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Sucheta Chakraborty

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

ipaddress in ifa->ifa_address field are in big endian format.
Also device requires ip address in big endian only.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h    |    7 ++++++-
 drivers/net/qlcnic/qlcnic_hw.c |    6 ++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 4667463..7af3c6c 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -898,6 +898,11 @@ struct qlcnic_mac_req {
 	u8 mac_addr[6];
 };
 
+struct qlcnic_ipaddr {
+	__be32 ipv4;
+	__be32 ipv6[4];
+};
+
 #define QLCNIC_MSI_ENABLED		0x02
 #define QLCNIC_MSIX_ENABLED		0x04
 #define QLCNIC_LRO_ENABLED		0x08
@@ -1286,7 +1291,7 @@ void qlcnic_free_mac_list(struct qlcnic_adapter *adapter);
 int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, u32);
 int qlcnic_config_intr_coalesce(struct qlcnic_adapter *adapter);
 int qlcnic_config_rss(struct qlcnic_adapter *adapter, int enable);
-int qlcnic_config_ipaddr(struct qlcnic_adapter *adapter, u32 ip, int cmd);
+int qlcnic_config_ipaddr(struct qlcnic_adapter *adapter, __be32 ip, int cmd);
 int qlcnic_linkevent_request(struct qlcnic_adapter *adapter, int enable);
 void qlcnic_advert_link_change(struct qlcnic_adapter *adapter, int linkup);
 
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index c198df9..68d5693 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -676,9 +676,10 @@ int qlcnic_config_rss(struct qlcnic_adapter *adapter, int enable)
 	return rv;
 }
 
-int qlcnic_config_ipaddr(struct qlcnic_adapter *adapter, u32 ip, int cmd)
+int qlcnic_config_ipaddr(struct qlcnic_adapter *adapter, __be32 ip, int cmd)
 {
 	struct qlcnic_nic_req req;
+	struct qlcnic_ipaddr *ipa;
 	u64 word;
 	int rv;
 
@@ -689,7 +690,8 @@ int qlcnic_config_ipaddr(struct qlcnic_adapter *adapter, u32 ip, int cmd)
 	req.req_hdr = cpu_to_le64(word);
 
 	req.words[0] = cpu_to_le64(cmd);
-	req.words[1] = cpu_to_le64(ip);
+	ipa = (struct qlcnic_ipaddr *)&req.words[1];
+	ipa->ipv4 = ip;
 
 	rv = qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
 	if (rv != 0)
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
                   ` (3 preceding siblings ...)
  2010-10-04 14:20 ` [PATCHv2 NEXT 4/8] qlcnic: fix endianess for lro Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes Amit Kumar Salecha
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Sucheta Chakraborty

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

o desc->vlan_tci is in __le16 format. Doing htons and
  cpu_to_le64 again on vlan_tci, result in invalid value on ppc.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h      |    7 ++++++-
 drivers/net/qlcnic/qlcnic_hw.c   |    6 ++++--
 drivers/net/qlcnic/qlcnic_main.c |   15 ++++++++++-----
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 7af3c6c..9d80171 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -898,6 +898,11 @@ struct qlcnic_mac_req {
 	u8 mac_addr[6];
 };
 
+struct qlcnic_vlan_req {
+	__le16 vlan_id;
+	__le16 rsvd[3];
+};
+
 struct qlcnic_ipaddr {
 	__be32 ipv4;
 	__be32 ipv6[4];
@@ -940,7 +945,7 @@ struct qlcnic_ipaddr {
 struct qlcnic_filter {
 	struct hlist_node fnode;
 	u8 faddr[ETH_ALEN];
-	u16 vlan_id;
+	__le16 vlan_id;
 	unsigned long ftime;
 };
 
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 68d5693..712cfab 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -375,10 +375,11 @@ qlcnic_send_cmd_descs(struct qlcnic_adapter *adapter,
 
 static int
 qlcnic_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
-				u16 vlan_id, unsigned op)
+				__le16 vlan_id, unsigned op)
 {
 	struct qlcnic_nic_req req;
 	struct qlcnic_mac_req *mac_req;
+	struct qlcnic_vlan_req *vlan_req;
 	u64 word;
 
 	memset(&req, 0, sizeof(struct qlcnic_nic_req));
@@ -391,7 +392,8 @@ qlcnic_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
 	mac_req->op = op;
 	memcpy(mac_req->mac_addr, addr, 6);
 
-	req.words[1] = cpu_to_le64(vlan_id);
+	vlan_req = (struct qlcnic_vlan_req *)&req.words[1];
+	vlan_req->vlan_id = vlan_id;
 
 	return qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
 }
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index a3d7705..6001f41 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -28,6 +28,7 @@
 
 #include "qlcnic.h"
 
+#include <linux/swab.h>
 #include <linux/dma-mapping.h>
 #include <linux/if_vlan.h>
 #include <net/ip.h>
@@ -1834,11 +1835,12 @@ static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter)
 }
 
 static void qlcnic_change_filter(struct qlcnic_adapter *adapter,
-		u64 uaddr, u16 vlan_id, struct qlcnic_host_tx_ring *tx_ring)
+		u64 uaddr, __le16 vlan_id, struct qlcnic_host_tx_ring *tx_ring)
 {
 	struct cmd_desc_type0 *hwdesc;
 	struct qlcnic_nic_req *req;
 	struct qlcnic_mac_req *mac_req;
+	struct qlcnic_vlan_req *vlan_req;
 	u32 producer;
 	u64 word;
 
@@ -1856,7 +1858,8 @@ static void qlcnic_change_filter(struct qlcnic_adapter *adapter,
 	mac_req->op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD;
 	memcpy(mac_req->mac_addr, &uaddr, ETH_ALEN);
 
-	req->words[1] = cpu_to_le64(vlan_id);
+	vlan_req = (struct qlcnic_vlan_req *)&req->words[1];
+	vlan_req->vlan_id = vlan_id;
 
 	tx_ring->producer = get_next_index(producer, tx_ring->num_desc);
 }
@@ -1875,7 +1878,7 @@ qlcnic_send_filter(struct qlcnic_adapter *adapter,
 	struct hlist_node *tmp_hnode, *n;
 	struct hlist_head *head;
 	u64 src_addr = 0;
-	u16 vlan_id = 0;
+	__le16 vlan_id = 0;
 	u8 hindex;
 
 	if (!compare_ether_addr(phdr->h_source, adapter->mac_addr))
@@ -1928,7 +1931,8 @@ qlcnic_tso_check(struct net_device *netdev,
 	struct vlan_ethhdr *vh;
 	struct qlcnic_adapter *adapter = netdev_priv(netdev);
 	u32 producer = tx_ring->producer;
-	int vlan_oob = first_desc->flags_opcode & cpu_to_le16(FLAGS_VLAN_OOB);
+	__le16 vlan_oob = first_desc->flags_opcode &
+				cpu_to_le16(FLAGS_VLAN_OOB);
 
 	if (*(skb->data) & BIT_0) {
 		flags |= BIT_0;
@@ -1999,7 +2003,8 @@ qlcnic_tso_check(struct net_device *netdev,
 		vh = (struct vlan_ethhdr *)((char *)hwdesc + 2);
 		skb_copy_from_linear_data(skb, vh, 12);
 		vh->h_vlan_proto = htons(ETH_P_8021Q);
-		vh->h_vlan_TCI = htons(first_desc->vlan_TCI);
+		vh->h_vlan_TCI = (__be16)swab16((u16)first_desc->vlan_TCI);
+
 		skb_copy_from_linear_data_offset(skb, 12,
 				(char *)vh + 16, copy_len - 16);
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
                   ` (4 preceding siblings ...)
  2010-10-04 14:20 ` [PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting Amit Kumar Salecha
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Sucheta Chakraborty

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic_ctx.c  |   12 ++++++------
 drivers/net/qlcnic/qlcnic_main.c |   10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index a4c4d09..75e3b19 100644
--- a/drivers/net/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/qlcnic/qlcnic_ctx.c
@@ -742,15 +742,15 @@ int qlcnic_get_pci_info(struct qlcnic_adapter *adapter,
 
 	if (err == QLCNIC_RCODE_SUCCESS) {
 		for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++, npar++, pci_info++) {
-			pci_info->id = le32_to_cpu(npar->id);
-			pci_info->active = le32_to_cpu(npar->active);
-			pci_info->type = le32_to_cpu(npar->type);
+			pci_info->id = le16_to_cpu(npar->id);
+			pci_info->active = le16_to_cpu(npar->active);
+			pci_info->type = le16_to_cpu(npar->type);
 			pci_info->default_port =
-				le32_to_cpu(npar->default_port);
+				le16_to_cpu(npar->default_port);
 			pci_info->tx_min_bw =
-				le32_to_cpu(npar->tx_min_bw);
+				le16_to_cpu(npar->tx_min_bw);
 			pci_info->tx_max_bw =
-				le32_to_cpu(npar->tx_max_bw);
+				le16_to_cpu(npar->tx_max_bw);
 			memcpy(pci_info->mac, npar->mac, ETH_ALEN);
 		}
 	} else {
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 6001f41..59a2138 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -521,9 +521,9 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
 		pfn = pci_info[i].id;
 		if (pfn > QLCNIC_MAX_PCI_FUNC)
 			return QL_STATUS_INVALID_PARAM;
-		adapter->npars[pfn].active = pci_info[i].active;
-		adapter->npars[pfn].type = pci_info[i].type;
-		adapter->npars[pfn].phy_port = pci_info[i].default_port;
+		adapter->npars[pfn].active = (u8)pci_info[i].active;
+		adapter->npars[pfn].type = (u8)pci_info[i].type;
+		adapter->npars[pfn].phy_port = (u8)pci_info[i].default_port;
 		adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw;
 		adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw;
 	}
@@ -723,7 +723,7 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter)
 	if (err)
 		return err;
 
-	adapter->physical_port = nic_info.phys_port;
+	adapter->physical_port = (u8)nic_info.phys_port;
 	adapter->switch_mode = nic_info.switch_mode;
 	adapter->max_tx_ques = nic_info.max_tx_ques;
 	adapter->max_rx_ques = nic_info.max_rx_ques;
@@ -3762,7 +3762,7 @@ qlcnic_sysfs_read_npar_config(struct file *file, struct kobject *kobj,
 			return ret;
 
 		np_cfg[i].pci_func = i;
-		np_cfg[i].op_mode = nic_info.op_mode;
+		np_cfg[i].op_mode = (u8)nic_info.op_mode;
 		np_cfg[i].port_num = nic_info.phys_port;
 		np_cfg[i].fw_capab = nic_info.capabilities;
 		np_cfg[i].min_bw = nic_info.min_tx_bw ;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
                   ` (5 preceding siblings ...)
  2010-10-04 14:20 ` [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  2010-10-04 14:20 ` [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit Amit Kumar Salecha
  2010-10-05  5:48 ` [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes David Miller
  8 siblings, 0 replies; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Sritej Velaga

From: Sritej Velaga <sritej.velaga@qlogic.com>

Port mode setting is not required for Qlogic CNA adapters.

Signed-off-by: Sritej Velaga <sritej.velaga@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic_main.c |   40 --------------------------------------
 1 files changed, 0 insertions(+), 40 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 59a2138..4757908 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -46,11 +46,6 @@ char qlcnic_driver_name[] = "qlcnic";
 static const char qlcnic_driver_string[] = "QLogic 1/10 GbE "
 	"Converged/Intelligent Ethernet Driver v" QLCNIC_LINUX_VERSIONID;
 
-static int port_mode = QLCNIC_PORT_MODE_AUTO_NEG;
-
-/* Default to restricted 1G auto-neg mode */
-static int wol_port_mode = 5;
-
 static int qlcnic_mac_learn;
 module_param(qlcnic_mac_learn, int, 0644);
 MODULE_PARM_DESC(qlcnic_mac_learn, "Mac Filter (0=disabled, 1=enabled)");
@@ -264,40 +259,6 @@ static void qlcnic_clear_stats(struct qlcnic_adapter *adapter)
 	memset(&adapter->stats, 0, sizeof(adapter->stats));
 }
 
-static void qlcnic_set_port_mode(struct qlcnic_adapter *adapter)
-{
-	u32 val, data;
-
-	val = adapter->ahw.board_type;
-	if ((val == QLCNIC_BRDTYPE_P3_HMEZ) ||
-		(val == QLCNIC_BRDTYPE_P3_XG_LOM)) {
-		if (port_mode == QLCNIC_PORT_MODE_802_3_AP) {
-			data = QLCNIC_PORT_MODE_802_3_AP;
-			QLCWR32(adapter, QLCNIC_PORT_MODE_ADDR, data);
-		} else if (port_mode == QLCNIC_PORT_MODE_XG) {
-			data = QLCNIC_PORT_MODE_XG;
-			QLCWR32(adapter, QLCNIC_PORT_MODE_ADDR, data);
-		} else if (port_mode == QLCNIC_PORT_MODE_AUTO_NEG_1G) {
-			data = QLCNIC_PORT_MODE_AUTO_NEG_1G;
-			QLCWR32(adapter, QLCNIC_PORT_MODE_ADDR, data);
-		} else if (port_mode == QLCNIC_PORT_MODE_AUTO_NEG_XG) {
-			data = QLCNIC_PORT_MODE_AUTO_NEG_XG;
-			QLCWR32(adapter, QLCNIC_PORT_MODE_ADDR, data);
-		} else {
-			data = QLCNIC_PORT_MODE_AUTO_NEG;
-			QLCWR32(adapter, QLCNIC_PORT_MODE_ADDR, data);
-		}
-
-		if ((wol_port_mode != QLCNIC_PORT_MODE_802_3_AP) &&
-			(wol_port_mode != QLCNIC_PORT_MODE_XG) &&
-			(wol_port_mode != QLCNIC_PORT_MODE_AUTO_NEG_1G) &&
-			(wol_port_mode != QLCNIC_PORT_MODE_AUTO_NEG_XG)) {
-			wol_port_mode = QLCNIC_PORT_MODE_AUTO_NEG;
-		}
-		QLCWR32(adapter, QLCNIC_WOL_PORT_MODE, wol_port_mode);
-	}
-}
-
 static void qlcnic_set_msix_bit(struct pci_dev *pdev, int enable)
 {
 	u32 control;
@@ -1032,7 +993,6 @@ qlcnic_start_firmware(struct qlcnic_adapter *adapter)
 	err = qlcnic_pinit_from_rom(adapter);
 	if (err)
 		goto err_out;
-	qlcnic_set_port_mode(adapter);
 
 	err = qlcnic_load_firmware(adapter);
 	if (err)
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
                   ` (6 preceding siblings ...)
  2010-10-04 14:20 ` [PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  2010-10-05  1:44   ` [PATCH net-next] qlcnic: remove dead code Stephen Hemminger
  2010-10-05  5:48 ` [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes David Miller
  8 siblings, 1 reply; 13+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 14:20 UTC (permalink / raw)
  To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Sritej Velaga

From: Sritej Velaga <sritej.velaga@qlogic.com>

Setting mtu < 68 is not supported.

Signed-off-by: Sritej Velaga <sritej.velaga@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h    |    1 +
 drivers/net/qlcnic/qlcnic_hw.c |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 9d80171..42a2883 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -95,6 +95,7 @@
 #define FIRST_PAGE_GROUP_END	0x100000
 
 #define P3_MAX_MTU                     (9600)
+#define P3_MIN_MTU                     (68)
 #define QLCNIC_MAX_ETHERHDR                32 /* This contains some padding */
 
 #define QLCNIC_P3_RX_BUF_MAX_LEN         (QLCNIC_MAX_ETHERHDR + ETH_DATA_LEN)
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 712cfab..9d3e16d 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -758,9 +758,9 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu)
 	struct qlcnic_adapter *adapter = netdev_priv(netdev);
 	int rc = 0;
 
-	if (mtu > P3_MAX_MTU) {
-		dev_err(&adapter->netdev->dev, "mtu > %d bytes unsupported\n",
-						P3_MAX_MTU);
+	if (mtu < P3_MIN_MTU || mtu > P3_MAX_MTU) {
+		dev_err(&adapter->netdev->dev, "%d bytes < mtu < %d bytes"
+			" not supported\n", P3_MAX_MTU, P3_MIN_MTU);
 		return -EINVAL;
 	}
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next] qlcnic: remove dead code
  2010-10-04 14:20 ` [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit Amit Kumar Salecha
@ 2010-10-05  1:44   ` Stephen Hemminger
  2010-10-05  6:18     ` Anirban Chakraborty
  2010-10-05  7:48     ` David Miller
  0 siblings, 2 replies; 13+ messages in thread
From: Stephen Hemminger @ 2010-10-05  1:44 UTC (permalink / raw)
  To: Amit Kumar Salecha
  Cc: davem, netdev, ameen.rahman, anirban.chakraborty, Sritej Velaga

This driver has several pieces of dead code (found by running
make namespacecheck). This patch removes them.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
Applies after Amit's earlier patches.

--- a/drivers/net/qlcnic/qlcnic.h	2010-10-05 10:37:07.442332958 +0900
+++ b/drivers/net/qlcnic/qlcnic.h	2010-10-05 10:38:04.459818979 +0900
@@ -1323,19 +1323,12 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_
 void qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring);
 
 /* Management functions */
-int qlcnic_set_mac_address(struct qlcnic_adapter *, u8*);
 int qlcnic_get_mac_address(struct qlcnic_adapter *, u8*);
 int qlcnic_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8);
 int qlcnic_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
 int qlcnic_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info*);
-int qlcnic_reset_partition(struct qlcnic_adapter *, u8);
 
 /*  eSwitch management functions */
-int qlcnic_get_eswitch_capabilities(struct qlcnic_adapter *, u8,
-				struct qlcnic_eswitch *);
-int qlcnic_get_eswitch_status(struct qlcnic_adapter *, u8,
-				struct qlcnic_eswitch *);
-int qlcnic_toggle_eswitch(struct qlcnic_adapter *, u8, u8);
 int qlcnic_config_switch_port(struct qlcnic_adapter *,
 				struct qlcnic_esw_func_cfg *);
 int qlcnic_get_eswitch_port_config(struct qlcnic_adapter *,
--- a/drivers/net/qlcnic/qlcnic_ctx.c	2010-10-05 10:37:00.492317319 +0900
+++ b/drivers/net/qlcnic/qlcnic_ctx.c	2010-10-05 10:38:04.459818979 +0900
@@ -556,32 +556,6 @@ void qlcnic_free_hw_resources(struct qlc
 	}
 }
 
-/* Set MAC address of a NIC partition */
-int qlcnic_set_mac_address(struct qlcnic_adapter *adapter, u8* mac)
-{
-	int err = 0;
-	u32 arg1, arg2, arg3;
-
-	arg1 = adapter->ahw.pci_func | BIT_9;
-	arg2 = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24);
-	arg3 = mac[4] | (mac[5] << 16);
-
-	err = qlcnic_issue_cmd(adapter,
-			adapter->ahw.pci_func,
-			adapter->fw_hal_version,
-			arg1,
-			arg2,
-			arg3,
-			QLCNIC_CDRP_CMD_MAC_ADDRESS);
-
-	if (err != QLCNIC_RCODE_SUCCESS) {
-		dev_err(&adapter->pdev->dev,
-			"Failed to set mac address%d\n", err);
-		err = -EIO;
-	}
-
-	return err;
-}
 
 /* Get MAC address of a NIC partition */
 int qlcnic_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac)
@@ -764,149 +738,6 @@ int qlcnic_get_pci_info(struct qlcnic_ad
 	return err;
 }
 
-/* Reset a NIC partition */
-
-int qlcnic_reset_partition(struct qlcnic_adapter *adapter, u8 func_no)
-{
-	int err = -EIO;
-
-	if (adapter->op_mode != QLCNIC_MGMT_FUNC)
-		return err;
-
-	err = qlcnic_issue_cmd(adapter,
-			adapter->ahw.pci_func,
-			adapter->fw_hal_version,
-			func_no,
-			0,
-			0,
-			QLCNIC_CDRP_CMD_RESET_NPAR);
-
-	if (err != QLCNIC_RCODE_SUCCESS) {
-		dev_err(&adapter->pdev->dev,
-			"Failed to issue reset partition%d\n", err);
-		err = -EIO;
-	}
-
-	return err;
-}
-
-/* Get eSwitch Capabilities */
-int qlcnic_get_eswitch_capabilities(struct qlcnic_adapter *adapter, u8 port,
-					struct qlcnic_eswitch *eswitch)
-{
-	int err = -EIO;
-	u32 arg1, arg2;
-
-	if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC)
-		return err;
-
-	err = qlcnic_issue_cmd(adapter,
-			adapter->ahw.pci_func,
-			adapter->fw_hal_version,
-			port,
-			0,
-			0,
-			QLCNIC_CDRP_CMD_GET_ESWITCH_CAPABILITY);
-
-	if (err == QLCNIC_RCODE_SUCCESS) {
-		arg1 = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
-		arg2 = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
-
-		eswitch->port = arg1 & 0xf;
-		eswitch->max_ucast_filters = LSW(arg2);
-		eswitch->max_active_vlans = MSW(arg2) & 0xfff;
-		if (arg1 & BIT_6)
-			eswitch->flags |= QLCNIC_SWITCH_VLAN_FILTERING;
-		if (arg1 & BIT_7)
-			eswitch->flags |= QLCNIC_SWITCH_PROMISC_MODE;
-		if (arg1 & BIT_8)
-			eswitch->flags |= QLCNIC_SWITCH_PORT_MIRRORING;
-	} else {
-		dev_err(&adapter->pdev->dev,
-			"Failed to get eswitch capabilities%d\n", err);
-	}
-
-	return err;
-}
-
-/* Get current status of eswitch */
-int qlcnic_get_eswitch_status(struct qlcnic_adapter *adapter, u8 port,
-				struct qlcnic_eswitch *eswitch)
-{
-	int err = -EIO;
-	u32 arg1, arg2;
-
-	if (adapter->op_mode != QLCNIC_MGMT_FUNC)
-		return err;
-
-	err = qlcnic_issue_cmd(adapter,
-			adapter->ahw.pci_func,
-			adapter->fw_hal_version,
-			port,
-			0,
-			0,
-			QLCNIC_CDRP_CMD_GET_ESWITCH_STATUS);
-
-	if (err == QLCNIC_RCODE_SUCCESS) {
-		arg1 = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
-		arg2 = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
-
-		eswitch->port = arg1 & 0xf;
-		eswitch->active_vports = LSB(arg2);
-		eswitch->active_ucast_filters = MSB(arg2);
-		eswitch->active_vlans = LSB(MSW(arg2));
-		if (arg1 & BIT_6)
-			eswitch->flags |= QLCNIC_SWITCH_VLAN_FILTERING;
-		if (arg1 & BIT_8)
-			eswitch->flags |= QLCNIC_SWITCH_PORT_MIRRORING;
-
-	} else {
-		dev_err(&adapter->pdev->dev,
-			"Failed to get eswitch status%d\n", err);
-	}
-
-	return err;
-}
-
-/* Enable/Disable eSwitch */
-int qlcnic_toggle_eswitch(struct qlcnic_adapter *adapter, u8 id, u8 enable)
-{
-	int err = -EIO;
-	u32 arg1, arg2;
-	struct qlcnic_eswitch *eswitch;
-
-	if (adapter->op_mode != QLCNIC_MGMT_FUNC)
-		return err;
-
-	eswitch = &adapter->eswitch[id];
-	if (!eswitch)
-		return err;
-
-	arg1 = eswitch->port | (enable ? BIT_4 : 0);
-	arg2 = eswitch->active_vports | (eswitch->max_ucast_filters << 8) |
-		(eswitch->max_active_vlans << 16);
-	err = qlcnic_issue_cmd(adapter,
-			adapter->ahw.pci_func,
-			adapter->fw_hal_version,
-			arg1,
-			arg2,
-			0,
-			QLCNIC_CDRP_CMD_TOGGLE_ESWITCH);
-
-	if (err != QLCNIC_RCODE_SUCCESS) {
-		dev_err(&adapter->pdev->dev,
-			"Failed to enable eswitch%d\n", eswitch->port);
-		eswitch->flags &= ~QLCNIC_SWITCH_ENABLE;
-		err = -EIO;
-	} else {
-		eswitch->flags |= QLCNIC_SWITCH_ENABLE;
-		dev_info(&adapter->pdev->dev,
-			"Enabled eSwitch for port %d\n", eswitch->port);
-	}
-
-	return err;
-}
-
 /* Configure eSwitch for port mirroring */
 int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id,
 				u8 enable_mirroring, u8 pci_func)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
                   ` (7 preceding siblings ...)
  2010-10-04 14:20 ` [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit Amit Kumar Salecha
@ 2010-10-05  5:48 ` David Miller
  8 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2010-10-05  5:48 UTC (permalink / raw)
  To: amit.salecha; +Cc: netdev, ameen.rahman, anirban.chakraborty

From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon,  4 Oct 2010 07:20:08 -0700

>  Series v2 of 8 patches to fix endianesses for PPC, internal loopback test
>  and etc. Accidentally, earlier patch series had a garbage patch.

All applied, thank you.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next] qlcnic: remove dead code
  2010-10-05  1:44   ` [PATCH net-next] qlcnic: remove dead code Stephen Hemminger
@ 2010-10-05  6:18     ` Anirban Chakraborty
  2010-10-05  7:48     ` David Miller
  1 sibling, 0 replies; 13+ messages in thread
From: Anirban Chakraborty @ 2010-10-05  6:18 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Amit Salecha, davem@davemloft.net, netdev@vger.kernel.org,
	Ameen Rahman, Sritej Velaga


On Oct 4, 2010, at 6:44 PM, Stephen Hemminger wrote:

> This driver has several pieces of dead code (found by running
> make namespacecheck). This patch removes them.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> ---
> Applies after Amit's earlier patches.
> 
> --- a/drivers/net/qlcnic/qlcnic.h	2010-10-05 10:37:07.442332958 +0900
> +++ b/drivers/net/qlcnic/qlcnic.h	2010-10-05 10:38:04.459818979 +0900
> @@ -1323,19 +1323,12 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_
> void qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring);
> 
> /* Management functions */
> -int qlcnic_set_mac_address(struct qlcnic_adapter *, u8*);
> int qlcnic_get_mac_address(struct qlcnic_adapter *, u8*);
> int qlcnic_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8);
> int qlcnic_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
> int qlcnic_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info*);
> -int qlcnic_reset_partition(struct qlcnic_adapter *, u8);
> 
> /*  eSwitch management functions */
> -int qlcnic_get_eswitch_capabilities(struct qlcnic_adapter *, u8,
> -				struct qlcnic_eswitch *);
> -int qlcnic_get_eswitch_status(struct qlcnic_adapter *, u8,
> -				struct qlcnic_eswitch *);
> -int qlcnic_toggle_eswitch(struct qlcnic_adapter *, u8, u8);
> int qlcnic_config_switch_port(struct qlcnic_adapter *,
> 				struct qlcnic_esw_func_cfg *);
> int qlcnic_get_eswitch_port_config(struct qlcnic_adapter *,
> --- a/drivers/net/qlcnic/qlcnic_ctx.c	2010-10-05 10:37:00.492317319 +0900
> +++ b/drivers/net/qlcnic/qlcnic_ctx.c	2010-10-05 10:38:04.459818979 +0900
> @@ -556,32 +556,6 @@ void qlcnic_free_hw_resources(struct qlc
> 	}
> }
> 
> -/* Set MAC address of a NIC partition */
> -int qlcnic_set_mac_address(struct qlcnic_adapter *adapter, u8* mac)
> -{
> -	int err = 0;
> -	u32 arg1, arg2, arg3;
> -
> -	arg1 = adapter->ahw.pci_func | BIT_9;
> -	arg2 = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24);
> -	arg3 = mac[4] | (mac[5] << 16);
> -
> -	err = qlcnic_issue_cmd(adapter,
> -			adapter->ahw.pci_func,
> -			adapter->fw_hal_version,
> -			arg1,
> -			arg2,
> -			arg3,
> -			QLCNIC_CDRP_CMD_MAC_ADDRESS);
> -
> -	if (err != QLCNIC_RCODE_SUCCESS) {
> -		dev_err(&adapter->pdev->dev,
> -			"Failed to set mac address%d\n", err);
> -		err = -EIO;
> -	}
> -
> -	return err;
> -}
> 
> /* Get MAC address of a NIC partition */
> int qlcnic_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac)
> @@ -764,149 +738,6 @@ int qlcnic_get_pci_info(struct qlcnic_ad
> 	return err;
> }
> 
> -/* Reset a NIC partition */
> -
> -int qlcnic_reset_partition(struct qlcnic_adapter *adapter, u8 func_no)
> -{
> -	int err = -EIO;
> -
> -	if (adapter->op_mode != QLCNIC_MGMT_FUNC)
> -		return err;
> -
> -	err = qlcnic_issue_cmd(adapter,
> -			adapter->ahw.pci_func,
> -			adapter->fw_hal_version,
> -			func_no,
> -			0,
> -			0,
> -			QLCNIC_CDRP_CMD_RESET_NPAR);
> -
> -	if (err != QLCNIC_RCODE_SUCCESS) {
> -		dev_err(&adapter->pdev->dev,
> -			"Failed to issue reset partition%d\n", err);
> -		err = -EIO;
> -	}
> -
> -	return err;
> -}
> -
> -/* Get eSwitch Capabilities */
> -int qlcnic_get_eswitch_capabilities(struct qlcnic_adapter *adapter, u8 port,
> -					struct qlcnic_eswitch *eswitch)
> -{
> -	int err = -EIO;
> -	u32 arg1, arg2;
> -
> -	if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC)
> -		return err;
> -
> -	err = qlcnic_issue_cmd(adapter,
> -			adapter->ahw.pci_func,
> -			adapter->fw_hal_version,
> -			port,
> -			0,
> -			0,
> -			QLCNIC_CDRP_CMD_GET_ESWITCH_CAPABILITY);
> -
> -	if (err == QLCNIC_RCODE_SUCCESS) {
> -		arg1 = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
> -		arg2 = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
> -
> -		eswitch->port = arg1 & 0xf;
> -		eswitch->max_ucast_filters = LSW(arg2);
> -		eswitch->max_active_vlans = MSW(arg2) & 0xfff;
> -		if (arg1 & BIT_6)
> -			eswitch->flags |= QLCNIC_SWITCH_VLAN_FILTERING;
> -		if (arg1 & BIT_7)
> -			eswitch->flags |= QLCNIC_SWITCH_PROMISC_MODE;
> -		if (arg1 & BIT_8)
> -			eswitch->flags |= QLCNIC_SWITCH_PORT_MIRRORING;
> -	} else {
> -		dev_err(&adapter->pdev->dev,
> -			"Failed to get eswitch capabilities%d\n", err);
> -	}
> -
> -	return err;
> -}
> -
> -/* Get current status of eswitch */
> -int qlcnic_get_eswitch_status(struct qlcnic_adapter *adapter, u8 port,
> -				struct qlcnic_eswitch *eswitch)
> -{
> -	int err = -EIO;
> -	u32 arg1, arg2;
> -
> -	if (adapter->op_mode != QLCNIC_MGMT_FUNC)
> -		return err;
> -
> -	err = qlcnic_issue_cmd(adapter,
> -			adapter->ahw.pci_func,
> -			adapter->fw_hal_version,
> -			port,
> -			0,
> -			0,
> -			QLCNIC_CDRP_CMD_GET_ESWITCH_STATUS);
> -
> -	if (err == QLCNIC_RCODE_SUCCESS) {
> -		arg1 = QLCRD32(adapter, QLCNIC_ARG1_CRB_OFFSET);
> -		arg2 = QLCRD32(adapter, QLCNIC_ARG2_CRB_OFFSET);
> -
> -		eswitch->port = arg1 & 0xf;
> -		eswitch->active_vports = LSB(arg2);
> -		eswitch->active_ucast_filters = MSB(arg2);
> -		eswitch->active_vlans = LSB(MSW(arg2));
> -		if (arg1 & BIT_6)
> -			eswitch->flags |= QLCNIC_SWITCH_VLAN_FILTERING;
> -		if (arg1 & BIT_8)
> -			eswitch->flags |= QLCNIC_SWITCH_PORT_MIRRORING;
> -
> -	} else {
> -		dev_err(&adapter->pdev->dev,
> -			"Failed to get eswitch status%d\n", err);
> -	}
> -
> -	return err;
> -}
> -
> -/* Enable/Disable eSwitch */
> -int qlcnic_toggle_eswitch(struct qlcnic_adapter *adapter, u8 id, u8 enable)
> -{
> -	int err = -EIO;
> -	u32 arg1, arg2;
> -	struct qlcnic_eswitch *eswitch;
> -
> -	if (adapter->op_mode != QLCNIC_MGMT_FUNC)
> -		return err;
> -
> -	eswitch = &adapter->eswitch[id];
> -	if (!eswitch)
> -		return err;
> -
> -	arg1 = eswitch->port | (enable ? BIT_4 : 0);
> -	arg2 = eswitch->active_vports | (eswitch->max_ucast_filters << 8) |
> -		(eswitch->max_active_vlans << 16);
> -	err = qlcnic_issue_cmd(adapter,
> -			adapter->ahw.pci_func,
> -			adapter->fw_hal_version,
> -			arg1,
> -			arg2,
> -			0,
> -			QLCNIC_CDRP_CMD_TOGGLE_ESWITCH);
> -
> -	if (err != QLCNIC_RCODE_SUCCESS) {
> -		dev_err(&adapter->pdev->dev,
> -			"Failed to enable eswitch%d\n", eswitch->port);
> -		eswitch->flags &= ~QLCNIC_SWITCH_ENABLE;
> -		err = -EIO;
> -	} else {
> -		eswitch->flags |= QLCNIC_SWITCH_ENABLE;
> -		dev_info(&adapter->pdev->dev,
> -			"Enabled eSwitch for port %d\n", eswitch->port);
> -	}
> -
> -	return err;
> -}
> -
> /* Configure eSwitch for port mirroring */
> int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id,
> 				u8 enable_mirroring, u8 pci_func)
> 

Thanks for doing this.

-Anirban




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next] qlcnic: remove dead code
  2010-10-05  1:44   ` [PATCH net-next] qlcnic: remove dead code Stephen Hemminger
  2010-10-05  6:18     ` Anirban Chakraborty
@ 2010-10-05  7:48     ` David Miller
  1 sibling, 0 replies; 13+ messages in thread
From: David Miller @ 2010-10-05  7:48 UTC (permalink / raw)
  To: shemminger
  Cc: amit.salecha, netdev, ameen.rahman, anirban.chakraborty,
	sritej.velaga

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 5 Oct 2010 10:44:30 +0900

> This driver has several pieces of dead code (found by running
> make namespacecheck). This patch removes them.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-10-05  7:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 1/8] qlcnic: fix internal loopback test Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 3/8] qlcnic: fix diag register Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 4/8] qlcnic: fix endianess for lro Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit Amit Kumar Salecha
2010-10-05  1:44   ` [PATCH net-next] qlcnic: remove dead code Stephen Hemminger
2010-10-05  6:18     ` Anirban Chakraborty
2010-10-05  7:48     ` David Miller
2010-10-05  5:48 ` [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).