netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes
  2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
@ 2010-10-04 14:20 ` Amit Kumar Salecha
  0 siblings, 0 replies; 12+ 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] 12+ messages in thread

* [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats
       [not found] <1286205297-23214-1-git-send-email-amit.salecha@qlogic.com>
@ 2010-10-04 15:14 ` Amit Kumar Salecha
  2011-04-11 22:55   ` David Miller
  2011-04-11 23:09   ` Stephen Hemminger
  2010-10-04 15:14 ` [PATCHv2 NEXT 3/8] qlcnic: fix diag register Amit Kumar Salecha
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 12+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 15:14 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] 12+ messages in thread

* [PATCHv2 NEXT 3/8] qlcnic: fix diag register
       [not found] <1286205297-23214-1-git-send-email-amit.salecha@qlogic.com>
  2010-10-04 15:14 ` [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats Amit Kumar Salecha
@ 2010-10-04 15:14 ` Amit Kumar Salecha
  2010-10-04 15:14 ` [PATCHv2 NEXT 4/8] qlcnic: fix endianess for lro Amit Kumar Salecha
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 15:14 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] 12+ messages in thread

* [PATCHv2 NEXT 4/8] qlcnic: fix endianess for lro
       [not found] <1286205297-23214-1-git-send-email-amit.salecha@qlogic.com>
  2010-10-04 15:14 ` [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats Amit Kumar Salecha
  2010-10-04 15:14 ` [PATCHv2 NEXT 3/8] qlcnic: fix diag register Amit Kumar Salecha
@ 2010-10-04 15:14 ` Amit Kumar Salecha
  2010-10-04 15:14 ` [PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine Amit Kumar Salecha
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 15:14 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] 12+ messages in thread

* [PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine
       [not found] <1286205297-23214-1-git-send-email-amit.salecha@qlogic.com>
                   ` (2 preceding siblings ...)
  2010-10-04 15:14 ` [PATCHv2 NEXT 4/8] qlcnic: fix endianess for lro Amit Kumar Salecha
@ 2010-10-04 15:14 ` Amit Kumar Salecha
  2010-10-04 15:14 ` [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes Amit Kumar Salecha
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 15:14 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] 12+ messages in thread

* [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes
       [not found] <1286205297-23214-1-git-send-email-amit.salecha@qlogic.com>
                   ` (3 preceding siblings ...)
  2010-10-04 15:14 ` [PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine Amit Kumar Salecha
@ 2010-10-04 15:14 ` Amit Kumar Salecha
  2011-04-11 23:00   ` Ben Hutchings
  2010-10-04 15:14 ` [PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting Amit Kumar Salecha
  2010-10-04 15:14 ` [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit Amit Kumar Salecha
  6 siblings, 1 reply; 12+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 15:14 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] 12+ messages in thread

* [PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting
       [not found] <1286205297-23214-1-git-send-email-amit.salecha@qlogic.com>
                   ` (4 preceding siblings ...)
  2010-10-04 15:14 ` [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes Amit Kumar Salecha
@ 2010-10-04 15:14 ` Amit Kumar Salecha
  2010-10-04 15:14 ` [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit Amit Kumar Salecha
  6 siblings, 0 replies; 12+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 15:14 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] 12+ messages in thread

* [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit
       [not found] <1286205297-23214-1-git-send-email-amit.salecha@qlogic.com>
                   ` (5 preceding siblings ...)
  2010-10-04 15:14 ` [PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting Amit Kumar Salecha
@ 2010-10-04 15:14 ` Amit Kumar Salecha
  6 siblings, 0 replies; 12+ messages in thread
From: Amit Kumar Salecha @ 2010-10-04 15:14 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] 12+ messages in thread

* Re: [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats
  2010-10-04 15:14 ` [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats Amit Kumar Salecha
@ 2011-04-11 22:55   ` David Miller
  2011-04-12  4:48     ` Amit Salecha
  2011-04-11 23:09   ` Stephen Hemminger
  1 sibling, 1 reply; 12+ messages in thread
From: David Miller @ 2011-04-11 22:55 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 08:14:51 -0700

> 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>

Why are patches being posted from back in October 4, 2010?

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

* Re: [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes
  2010-10-04 15:14 ` [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes Amit Kumar Salecha
@ 2011-04-11 23:00   ` Ben Hutchings
  0 siblings, 0 replies; 12+ messages in thread
From: Ben Hutchings @ 2011-04-11 23:00 UTC (permalink / raw)
  To: Amit Kumar Salecha
  Cc: davem, netdev, ameen.rahman, anirban.chakraborty,
	Sucheta Chakraborty

On Mon, 2010-10-04 at 08:14 -0700, Amit Kumar Salecha wrote:
> 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);
[...]

It looks like this function was broken on big-endian systems.  The
commit message should say that you are fixing a bug, not just that some
unspecified 'sparse warning[s]' (that alerted you to the bug) were
fixed.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
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	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats
  2010-10-04 15:14 ` [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats Amit Kumar Salecha
  2011-04-11 22:55   ` David Miller
@ 2011-04-11 23:09   ` Stephen Hemminger
  1 sibling, 0 replies; 12+ messages in thread
From: Stephen Hemminger @ 2011-04-11 23:09 UTC (permalink / raw)
  To: Amit Kumar Salecha; +Cc: davem, netdev, ameen.rahman, anirban.chakraborty

On Mon,  4 Oct 2010 08:14:51 -0700
Amit Kumar Salecha <amit.salecha@qlogic.com> wrote:

> +
> +#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)

Fugly macro. Make it an inline function?

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

* RE: [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats
  2011-04-11 22:55   ` David Miller
@ 2011-04-12  4:48     ` Amit Salecha
  0 siblings, 0 replies; 12+ messages in thread
From: Amit Salecha @ 2011-04-12  4:48 UTC (permalink / raw)
  To: David Miller, Stephen Hemminger
  Cc: netdev@vger.kernel.org, Ameen Rahman, Anirban Chakraborty

> From: Amit Kumar Salecha <amit.salecha@qlogic.com>
> Date: Mon,  4 Oct 2010 08:14:51 -0700
>
> > 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>
>
> Why are patches being posted from back in October 4, 2010?

My mail server is spamming mail, please ignore all below emails:

[PATCH NEXT 1/2] netxen: Notify firmware of Flex-10 interface down
[PATCHv2 NEXT 3/8] qlcnic: fix diag register
[PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit
[PATCH NEXT 0/2]nexten: bug fixes
[PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats
[PATCH NEXT 2/2] netxen: support for GbE port settings
[PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes
[PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting
[PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine

Sorry for inconvenience caused to all.

-Amit

This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.


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

end of thread, other threads:[~2011-04-12  4:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1286205297-23214-1-git-send-email-amit.salecha@qlogic.com>
2010-10-04 15:14 ` [PATCHv2 NEXT 2/8] qlcnic: fix eswitch stats Amit Kumar Salecha
2011-04-11 22:55   ` David Miller
2011-04-12  4:48     ` Amit Salecha
2011-04-11 23:09   ` Stephen Hemminger
2010-10-04 15:14 ` [PATCHv2 NEXT 3/8] qlcnic: fix diag register Amit Kumar Salecha
2010-10-04 15:14 ` [PATCHv2 NEXT 4/8] qlcnic: fix endianess for lro Amit Kumar Salecha
2010-10-04 15:14 ` [PATCHv2 NEXT 5/8] qlcnic: fix vlan TSO on big endian machine Amit Kumar Salecha
2010-10-04 15:14 ` [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes Amit Kumar Salecha
2011-04-11 23:00   ` Ben Hutchings
2010-10-04 15:14 ` [PATCHv2 NEXT 7/8] qlcnic: cleanup port mode setting Amit Kumar Salecha
2010-10-04 15:14 ` [PATCHv2 NEXT 8/8] qlcnic: set mtu lower limit Amit Kumar Salecha
2010-10-04 14:20 [PATCHv2 NEXT 0/8]qlcnic: miscellaneous fixes Amit Kumar Salecha
2010-10-04 14:20 ` [PATCHv2 NEXT 6/8] qlcnic: sparse warning fixes Amit Kumar Salecha

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).