qlcnic: miscellaneous fixes
Subsystems (2)
v2 cover qlcnic: miscellaneous fixes
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
PATCH v2 1/8 qlcnic: fix internal loopback test
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.
--- drivers/net/qlcnic/qlcnic_ethtool.c | 26 +++++++++++++++++++------- drivers/net/qlcnic/qlcnic_init.c | 19 ++++++++++++++++++- 2 files changed, 37 insertions(+), 8 deletions(-)
drivers/net/qlcnic/qlcnic_ethtool.c +19 -7
@@ -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 10static 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 ; }
drivers/net/qlcnic/qlcnic_init.c +18 -1
@@ -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++;
Signature · 1 line
1.6.3.3
PATCH v2 2/8 qlcnic: fix eswitch stats
In reply to Amit Kumar SalechaSome of the counters are not implemented in fw. Fw return NOT AVAILABLE VALUE as (0xffffffffffffffff). Adding these counters, result in invalid value.
--- drivers/net/qlcnic/qlcnic.h | 12 ++++++++++++ drivers/net/qlcnic/qlcnic_ctx.c | 31 ++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 9 deletions(-)
drivers/net/qlcnic/qlcnic.h +12 -0
@@ -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;
drivers/net/qlcnic/qlcnic_ctx.c +22 -9
@@ -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;
Signature · 1 line
1.6.3.3
PATCH v2 3/8 qlcnic: fix diag register
In reply to Amit Kumar Salecharegs_buff[i] and diag_registers[j] array should use different index variable.
--- drivers/net/qlcnic/qlcnic_ethtool.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/qlcnic/qlcnic_ethtool.c +3 -3
@@ -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 ;
Signature · 1 line
1.6.3.3
PATCH v2 4/8 qlcnic: fix endianess for lro
In reply to Amit Kumar SalechaFrom: Sucheta Chakraborty <[email protected]>
ipaddress in ifa->ifa_address field are in big endian format. Also device requires ip address in big endian only.
--- drivers/net/qlcnic/qlcnic.h | 7 ++++++- drivers/net/qlcnic/qlcnic_hw.c | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/net/qlcnic/qlcnic.h +6 -1
@@ -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);
drivers/net/qlcnic/qlcnic_hw.c +4 -2
@@ -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 )
Signature · 1 line
1.6.3.3
PATCH v2 5/8 qlcnic: fix vlan TSO on big endian machine
In reply to Amit Kumar SalechaFrom: Sucheta Chakraborty <[email protected]>
o desc->vlan_tci is in __le16 format. Doing htons and cpu_to_le64 again on vlan_tci, result in invalid value on ppc.
--- 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(-)
drivers/net/qlcnic/qlcnic.h +6 -1
@@ -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; };
drivers/net/qlcnic/qlcnic_hw.c +4 -2
@@ -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 ); }
drivers/net/qlcnic/qlcnic_main.c +10 -5
@@ -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 );
Signature · 1 line
1.6.3.3
PATCH v2 6/8 qlcnic: sparse warning fixes
In reply to Amit Kumar SalechaFrom: Sucheta Chakraborty <[email protected]>
--- drivers/net/qlcnic/qlcnic_ctx.c | 12 ++++++------ drivers/net/qlcnic/qlcnic_main.c | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/net/qlcnic/qlcnic_ctx.c +6 -6
@@ -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 {
drivers/net/qlcnic/qlcnic_main.c +5 -5
@@ -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 ;
Signature · 1 line
1.6.3.3
PATCH v2 7/8 qlcnic: cleanup port mode setting
In reply to Amit Kumar SalechaFrom: Sritej Velaga <[email protected]>
Port mode setting is not required for Qlogic CNA adapters.
--- drivers/net/qlcnic/qlcnic_main.c | 40 -------------------------------------- 1 files changed, 0 insertions(+), 40 deletions(-)
drivers/net/qlcnic/qlcnic_main.c +0 -40
@@ -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)
Signature · 1 line
1.6.3.3
PATCH v2 8/8 qlcnic: set mtu lower limit
In reply to Amit Kumar SalechaFrom: Sritej Velaga <[email protected]>
Setting mtu < 68 is not supported.
--- drivers/net/qlcnic/qlcnic.h | 1 + drivers/net/qlcnic/qlcnic_hw.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/qlcnic/qlcnic.h +1 -0
@@ -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)
drivers/net/qlcnic/qlcnic_hw.c +3 -3
@@ -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 ; }
Signature · 1 line
1.6.3.3
PATCH 1/1 qlcnic: remove dead code
This driver has several pieces of dead code (found by running make namespacecheck). This patch removes them.
---
Applies after Amit's earlier patches.
drivers/net/qlcnic/qlcnic.h +0 -7
@@ -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 *,
drivers/net/qlcnic/qlcnic_ctx.c +0 -169
181 lines not on this page · raw message
Re: [PATCH net-next] qlcnic: remove dead code
Quoted 205 lines · Stephen Hemminger
This driver has several pieces of dead code (found by running make namespacecheck). This patch removes them.
Signed-off-by Stephen Hemminger <[email protected]>---
Applies after Amit's earlier patches.drivers/net/qlcnic/qlcnic.h +0
-7@@ -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 *,drivers/net/qlcnic/qlcnic_ctx.c +0
-162@@ -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_adreturn 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 ;
drivers/net/qlcnic/qlcnic_ctx.c int qlcnic_get_pci_info(struct qlcnic_ad · line 743
Quoted 10 lines
drivers/net/qlcnic/qlcnic_ctx.c +0
-7-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
Re: [PATCH net-next] qlcnic: remove dead code
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Tue, 5 Oct 2010 10:44:30 +0900
Quoted 4 lines
This driver has several pieces of dead code (found by running make namespacecheck). This patch removes them.
Signed-off-by Stephen Hemminger <[email protected]>
Applied.
David Miller
maintainerFrom: Amit Kumar Salecha <[email protected]>
Date: Mon, 4 Oct 2010 07:20:08 -0700
Quoted 2 lines
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.