aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@emulex.com>2014-05-09 03:59:13 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-09 13:13:38 -0400
commit748b539ab761a50bde3aa4b7d6d0999b5d86206d (patch)
tree2f3974c99bb9cc415838c858ed607ea52662a064
parentfe6f397c433c43a4404259d6ee3f1200b9a6d97e (diff)
be2net: fix line wrap and function call indentation in be_main.c
When a funtion definition or a function call spans more than one line, ensure that the first argument on the subsequent lines is aligned to the first column after the opening paranthesis of the function call. Also remove unnecessary line wrap. Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c204
1 files changed, 101 insertions, 103 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index a3c6a27d13fa..8dc1af47c59a 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -134,7 +134,7 @@ static void be_queue_free(struct be_adapter *adapter, struct be_queue_info *q)
134} 134}
135 135
136static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q, 136static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q,
137 u16 len, u16 entry_size) 137 u16 len, u16 entry_size)
138{ 138{
139 struct be_dma_mem *mem = &q->dma_mem; 139 struct be_dma_mem *mem = &q->dma_mem;
140 140
@@ -154,7 +154,7 @@ static void be_reg_intr_set(struct be_adapter *adapter, bool enable)
154 u32 reg, enabled; 154 u32 reg, enabled;
155 155
156 pci_read_config_dword(adapter->pdev, PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET, 156 pci_read_config_dword(adapter->pdev, PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET,
157 &reg); 157 &reg);
158 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; 158 enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK;
159 159
160 if (!enabled && enable) 160 if (!enabled && enable)
@@ -165,7 +165,7 @@ static void be_reg_intr_set(struct be_adapter *adapter, bool enable)
165 return; 165 return;
166 166
167 pci_write_config_dword(adapter->pdev, 167 pci_write_config_dword(adapter->pdev,
168 PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET, reg); 168 PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET, reg);
169} 169}
170 170
171static void be_intr_set(struct be_adapter *adapter, bool enable) 171static void be_intr_set(struct be_adapter *adapter, bool enable)
@@ -206,12 +206,11 @@ static void be_txq_notify(struct be_adapter *adapter, struct be_tx_obj *txo,
206} 206}
207 207
208static void be_eq_notify(struct be_adapter *adapter, u16 qid, 208static void be_eq_notify(struct be_adapter *adapter, u16 qid,
209 bool arm, bool clear_int, u16 num_popped) 209 bool arm, bool clear_int, u16 num_popped)
210{ 210{
211 u32 val = 0; 211 u32 val = 0;
212 val |= qid & DB_EQ_RING_ID_MASK; 212 val |= qid & DB_EQ_RING_ID_MASK;
213 val |= ((qid & DB_EQ_RING_ID_EXT_MASK) << 213 val |= ((qid & DB_EQ_RING_ID_EXT_MASK) << DB_EQ_RING_ID_EXT_MASK_SHIFT);
214 DB_EQ_RING_ID_EXT_MASK_SHIFT);
215 214
216 if (adapter->eeh_error) 215 if (adapter->eeh_error)
217 return; 216 return;
@@ -477,7 +476,7 @@ static void populate_be_v2_stats(struct be_adapter *adapter)
477 drvs->rx_drops_no_tpre_descr = rxf_stats->rx_drops_no_tpre_descr; 476 drvs->rx_drops_no_tpre_descr = rxf_stats->rx_drops_no_tpre_descr;
478 drvs->rx_drops_too_many_frags = rxf_stats->rx_drops_too_many_frags; 477 drvs->rx_drops_too_many_frags = rxf_stats->rx_drops_too_many_frags;
479 adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops; 478 adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops;
480 if (be_roce_supported(adapter)) { 479 if (be_roce_supported(adapter)) {
481 drvs->rx_roce_bytes_lsd = port_stats->roce_bytes_received_lsd; 480 drvs->rx_roce_bytes_lsd = port_stats->roce_bytes_received_lsd;
482 drvs->rx_roce_bytes_msd = port_stats->roce_bytes_received_msd; 481 drvs->rx_roce_bytes_msd = port_stats->roce_bytes_received_msd;
483 drvs->rx_roce_frames = port_stats->roce_frames_received; 482 drvs->rx_roce_frames = port_stats->roce_frames_received;
@@ -491,8 +490,7 @@ static void populate_lancer_stats(struct be_adapter *adapter)
491{ 490{
492 491
493 struct be_drv_stats *drvs = &adapter->drv_stats; 492 struct be_drv_stats *drvs = &adapter->drv_stats;
494 struct lancer_pport_stats *pport_stats = 493 struct lancer_pport_stats *pport_stats = pport_stats_from_cmd(adapter);
495 pport_stats_from_cmd(adapter);
496 494
497 be_dws_le_to_cpu(pport_stats, sizeof(*pport_stats)); 495 be_dws_le_to_cpu(pport_stats, sizeof(*pport_stats));
498 drvs->rx_pause_frames = pport_stats->rx_pause_frames_lo; 496 drvs->rx_pause_frames = pport_stats->rx_pause_frames_lo;
@@ -539,8 +537,7 @@ static void accumulate_16bit_val(u32 *acc, u16 val)
539} 537}
540 538
541static void populate_erx_stats(struct be_adapter *adapter, 539static void populate_erx_stats(struct be_adapter *adapter,
542 struct be_rx_obj *rxo, 540 struct be_rx_obj *rxo, u32 erx_stat)
543 u32 erx_stat)
544{ 541{
545 if (!BEx_chip(adapter)) 542 if (!BEx_chip(adapter))
546 rx_stats(rxo)->rx_drops_no_frags = erx_stat; 543 rx_stats(rxo)->rx_drops_no_frags = erx_stat;
@@ -579,7 +576,7 @@ void be_parse_stats(struct be_adapter *adapter)
579} 576}
580 577
581static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev, 578static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
582 struct rtnl_link_stats64 *stats) 579 struct rtnl_link_stats64 *stats)
583{ 580{
584 struct be_adapter *adapter = netdev_priv(netdev); 581 struct be_adapter *adapter = netdev_priv(netdev);
585 struct be_drv_stats *drvs = &adapter->drv_stats; 582 struct be_drv_stats *drvs = &adapter->drv_stats;
@@ -660,7 +657,8 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status)
660} 657}
661 658
662static void be_tx_stats_update(struct be_tx_obj *txo, 659static void be_tx_stats_update(struct be_tx_obj *txo,
663 u32 wrb_cnt, u32 copied, u32 gso_segs, bool stopped) 660 u32 wrb_cnt, u32 copied, u32 gso_segs,
661 bool stopped)
664{ 662{
665 struct be_tx_stats *stats = tx_stats(txo); 663 struct be_tx_stats *stats = tx_stats(txo);
666 664
@@ -676,7 +674,7 @@ static void be_tx_stats_update(struct be_tx_obj *txo,
676 674
677/* Determine number of WRB entries needed to xmit data in an skb */ 675/* Determine number of WRB entries needed to xmit data in an skb */
678static u32 wrb_cnt_for_skb(struct be_adapter *adapter, struct sk_buff *skb, 676static u32 wrb_cnt_for_skb(struct be_adapter *adapter, struct sk_buff *skb,
679 bool *dummy) 677 bool *dummy)
680{ 678{
681 int cnt = (skb->len > skb->data_len); 679 int cnt = (skb->len > skb->data_len);
682 680
@@ -704,7 +702,7 @@ static inline void wrb_fill(struct be_eth_wrb *wrb, u64 addr, int len)
704} 702}
705 703
706static inline u16 be_get_tx_vlan_tag(struct be_adapter *adapter, 704static inline u16 be_get_tx_vlan_tag(struct be_adapter *adapter,
707 struct sk_buff *skb) 705 struct sk_buff *skb)
708{ 706{
709 u8 vlan_prio; 707 u8 vlan_prio;
710 u16 vlan_tag; 708 u16 vlan_tag;
@@ -733,7 +731,8 @@ static u16 skb_ip_proto(struct sk_buff *skb)
733} 731}
734 732
735static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr, 733static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr,
736 struct sk_buff *skb, u32 wrb_cnt, u32 len, bool skip_hw_vlan) 734 struct sk_buff *skb, u32 wrb_cnt, u32 len,
735 bool skip_hw_vlan)
737{ 736{
738 u16 vlan_tag, proto; 737 u16 vlan_tag, proto;
739 738
@@ -774,7 +773,7 @@ static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr,
774} 773}
775 774
776static void unmap_tx_frag(struct device *dev, struct be_eth_wrb *wrb, 775static void unmap_tx_frag(struct device *dev, struct be_eth_wrb *wrb,
777 bool unmap_single) 776 bool unmap_single)
778{ 777{
779 dma_addr_t dma; 778 dma_addr_t dma;
780 779
@@ -791,8 +790,8 @@ static void unmap_tx_frag(struct device *dev, struct be_eth_wrb *wrb,
791} 790}
792 791
793static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq, 792static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq,
794 struct sk_buff *skb, u32 wrb_cnt, bool dummy_wrb, 793 struct sk_buff *skb, u32 wrb_cnt, bool dummy_wrb,
795 bool skip_hw_vlan) 794 bool skip_hw_vlan)
796{ 795{
797 dma_addr_t busaddr; 796 dma_addr_t busaddr;
798 int i, copied = 0; 797 int i, copied = 0;
@@ -821,8 +820,7 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq,
821 } 820 }
822 821
823 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 822 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
824 const struct skb_frag_struct *frag = 823 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
825 &skb_shinfo(skb)->frags[i];
826 busaddr = skb_frag_dma_map(dev, frag, 0, 824 busaddr = skb_frag_dma_map(dev, frag, 0,
827 skb_frag_size(frag), DMA_TO_DEVICE); 825 skb_frag_size(frag), DMA_TO_DEVICE);
828 if (dma_mapping_error(dev, busaddr)) 826 if (dma_mapping_error(dev, busaddr))
@@ -927,8 +925,7 @@ static int be_vlan_tag_tx_chk(struct be_adapter *adapter, struct sk_buff *skb)
927 return vlan_tx_tag_present(skb) || adapter->pvid || adapter->qnq_vid; 925 return vlan_tx_tag_present(skb) || adapter->pvid || adapter->qnq_vid;
928} 926}
929 927
930static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, 928static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, struct sk_buff *skb)
931 struct sk_buff *skb)
932{ 929{
933 return BE3_chip(adapter) && be_ipv6_exthdr_check(skb); 930 return BE3_chip(adapter) && be_ipv6_exthdr_check(skb);
934} 931}
@@ -959,7 +956,7 @@ static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter,
959 */ 956 */
960 if (be_pvid_tagging_enabled(adapter) && 957 if (be_pvid_tagging_enabled(adapter) &&
961 veh->h_vlan_proto == htons(ETH_P_8021Q)) 958 veh->h_vlan_proto == htons(ETH_P_8021Q))
962 *skip_hw_vlan = true; 959 *skip_hw_vlan = true;
963 960
964 /* HW has a bug wherein it will calculate CSUM for VLAN 961 /* HW has a bug wherein it will calculate CSUM for VLAN
965 * pkts even though it is disabled. 962 * pkts even though it is disabled.
@@ -1077,16 +1074,15 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
1077{ 1074{
1078 struct be_adapter *adapter = netdev_priv(netdev); 1075 struct be_adapter *adapter = netdev_priv(netdev);
1079 if (new_mtu < BE_MIN_MTU || 1076 if (new_mtu < BE_MIN_MTU ||
1080 new_mtu > (BE_MAX_JUMBO_FRAME_SIZE - 1077 new_mtu > (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN))) {
1081 (ETH_HLEN + ETH_FCS_LEN))) {
1082 dev_info(&adapter->pdev->dev, 1078 dev_info(&adapter->pdev->dev,
1083 "MTU must be between %d and %d bytes\n", 1079 "MTU must be between %d and %d bytes\n",
1084 BE_MIN_MTU, 1080 BE_MIN_MTU,
1085 (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN))); 1081 (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN)));
1086 return -EINVAL; 1082 return -EINVAL;
1087 } 1083 }
1088 dev_info(&adapter->pdev->dev, "MTU changed from %d to %d bytes\n", 1084 dev_info(&adapter->pdev->dev, "MTU changed from %d to %d bytes\n",
1089 netdev->mtu, new_mtu); 1085 netdev->mtu, new_mtu);
1090 netdev->mtu = new_mtu; 1086 netdev->mtu = new_mtu;
1091 return 0; 1087 return 0;
1092} 1088}
@@ -1113,8 +1109,7 @@ static int be_vid_config(struct be_adapter *adapter)
1113 if (adapter->vlan_tag[i]) 1109 if (adapter->vlan_tag[i])
1114 vids[num++] = cpu_to_le16(i); 1110 vids[num++] = cpu_to_le16(i);
1115 1111
1116 status = be_cmd_vlan_config(adapter, adapter->if_handle, 1112 status = be_cmd_vlan_config(adapter, adapter->if_handle, vids, num, 0);
1117 vids, num, 0);
1118 1113
1119 if (status) { 1114 if (status) {
1120 /* Set to VLAN promisc mode as setting VLAN filter failed */ 1115 /* Set to VLAN promisc mode as setting VLAN filter failed */
@@ -1254,8 +1249,10 @@ static void be_set_rx_mode(struct net_device *netdev)
1254 1249
1255 /* Set to MCAST promisc mode if setting MULTICAST address fails */ 1250 /* Set to MCAST promisc mode if setting MULTICAST address fails */
1256 if (status) { 1251 if (status) {
1257 dev_info(&adapter->pdev->dev, "Exhausted multicast HW filters.\n"); 1252 dev_info(&adapter->pdev->dev,
1258 dev_info(&adapter->pdev->dev, "Disabling HW multicast filtering.\n"); 1253 "Exhausted multicast HW filters.\n");
1254 dev_info(&adapter->pdev->dev,
1255 "Disabling HW multicast filtering.\n");
1259 be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON); 1256 be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON);
1260 } 1257 }
1261done: 1258done:
@@ -1287,7 +1284,7 @@ static int be_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
1287 1284
1288 if (status) 1285 if (status)
1289 dev_err(&adapter->pdev->dev, "MAC %pM set on VF %d Failed\n", 1286 dev_err(&adapter->pdev->dev, "MAC %pM set on VF %d Failed\n",
1290 mac, vf); 1287 mac, vf);
1291 else 1288 else
1292 memcpy(vf_cfg->mac_addr, mac, ETH_ALEN); 1289 memcpy(vf_cfg->mac_addr, mac, ETH_ALEN);
1293 1290
@@ -1295,7 +1292,7 @@ static int be_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
1295} 1292}
1296 1293
1297static int be_get_vf_config(struct net_device *netdev, int vf, 1294static int be_get_vf_config(struct net_device *netdev, int vf,
1298 struct ifla_vf_info *vi) 1295 struct ifla_vf_info *vi)
1299{ 1296{
1300 struct be_adapter *adapter = netdev_priv(netdev); 1297 struct be_adapter *adapter = netdev_priv(netdev);
1301 struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf]; 1298 struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf];
@@ -1316,8 +1313,7 @@ static int be_get_vf_config(struct net_device *netdev, int vf,
1316 return 0; 1313 return 0;
1317} 1314}
1318 1315
1319static int be_set_vf_vlan(struct net_device *netdev, 1316static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
1320 int vf, u16 vlan, u8 qos)
1321{ 1317{
1322 struct be_adapter *adapter = netdev_priv(netdev); 1318 struct be_adapter *adapter = netdev_priv(netdev);
1323 struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf]; 1319 struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf];
@@ -1348,8 +1344,7 @@ static int be_set_vf_vlan(struct net_device *netdev,
1348 return status; 1344 return status;
1349} 1345}
1350 1346
1351static int be_set_vf_tx_rate(struct net_device *netdev, 1347static int be_set_vf_tx_rate(struct net_device *netdev, int vf, int rate)
1352 int vf, int rate)
1353{ 1348{
1354 struct be_adapter *adapter = netdev_priv(netdev); 1349 struct be_adapter *adapter = netdev_priv(netdev);
1355 int status = 0; 1350 int status = 0;
@@ -1369,7 +1364,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev,
1369 status = be_cmd_config_qos(adapter, rate / 10, vf + 1); 1364 status = be_cmd_config_qos(adapter, rate / 10, vf + 1);
1370 if (status) 1365 if (status)
1371 dev_err(&adapter->pdev->dev, 1366 dev_err(&adapter->pdev->dev,
1372 "tx rate %d on VF %d failed\n", rate, vf); 1367 "tx rate %d on VF %d failed\n", rate, vf);
1373 else 1368 else
1374 adapter->vf_cfg[vf].tx_rate = rate; 1369 adapter->vf_cfg[vf].tx_rate = rate;
1375 return status; 1370 return status;
@@ -1469,7 +1464,7 @@ modify_eqd:
1469} 1464}
1470 1465
1471static void be_rx_stats_update(struct be_rx_obj *rxo, 1466static void be_rx_stats_update(struct be_rx_obj *rxo,
1472 struct be_rx_compl_info *rxcp) 1467 struct be_rx_compl_info *rxcp)
1473{ 1468{
1474 struct be_rx_stats *stats = rx_stats(rxo); 1469 struct be_rx_stats *stats = rx_stats(rxo);
1475 1470
@@ -1566,7 +1561,8 @@ static void skb_fill_rx_data(struct be_rx_obj *rxo, struct sk_buff *skb,
1566 skb_frag_set_page(skb, 0, page_info->page); 1561 skb_frag_set_page(skb, 0, page_info->page);
1567 skb_shinfo(skb)->frags[0].page_offset = 1562 skb_shinfo(skb)->frags[0].page_offset =
1568 page_info->page_offset + hdr_len; 1563 page_info->page_offset + hdr_len;
1569 skb_frag_size_set(&skb_shinfo(skb)->frags[0], curr_frag_len - hdr_len); 1564 skb_frag_size_set(&skb_shinfo(skb)->frags[0],
1565 curr_frag_len - hdr_len);
1570 skb->data_len = curr_frag_len - hdr_len; 1566 skb->data_len = curr_frag_len - hdr_len;
1571 skb->truesize += rx_frag_size; 1567 skb->truesize += rx_frag_size;
1572 skb->tail += hdr_len; 1568 skb->tail += hdr_len;
@@ -1725,8 +1721,8 @@ static void be_parse_rx_compl_v1(struct be_eth_rx_compl *compl,
1725 if (rxcp->vlanf) { 1721 if (rxcp->vlanf) {
1726 rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, qnq, 1722 rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, qnq,
1727 compl); 1723 compl);
1728 rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag, 1724 rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1,
1729 compl); 1725 vlan_tag, compl);
1730 } 1726 }
1731 rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, port, compl); 1727 rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, port, compl);
1732 rxcp->tunneled = 1728 rxcp->tunneled =
@@ -1757,8 +1753,8 @@ static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl,
1757 if (rxcp->vlanf) { 1753 if (rxcp->vlanf) {
1758 rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, qnq, 1754 rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, qnq,
1759 compl); 1755 compl);
1760 rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag, 1756 rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0,
1761 compl); 1757 vlan_tag, compl);
1762 } 1758 }
1763 rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); 1759 rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl);
1764 rxcp->ip_frag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, 1760 rxcp->ip_frag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0,
@@ -1915,7 +1911,7 @@ static struct be_eth_tx_compl *be_tx_compl_get(struct be_queue_info *tx_cq)
1915} 1911}
1916 1912
1917static u16 be_tx_compl_process(struct be_adapter *adapter, 1913static u16 be_tx_compl_process(struct be_adapter *adapter,
1918 struct be_tx_obj *txo, u16 last_index) 1914 struct be_tx_obj *txo, u16 last_index)
1919{ 1915{
1920 struct be_queue_info *txq = &txo->q; 1916 struct be_queue_info *txq = &txo->q;
1921 struct be_eth_wrb *wrb; 1917 struct be_eth_wrb *wrb;
@@ -2122,7 +2118,7 @@ static int be_evt_queues_create(struct be_adapter *adapter)
2122 2118
2123 eq = &eqo->q; 2119 eq = &eqo->q;
2124 rc = be_queue_alloc(adapter, eq, EVNT_Q_LEN, 2120 rc = be_queue_alloc(adapter, eq, EVNT_Q_LEN,
2125 sizeof(struct be_eq_entry)); 2121 sizeof(struct be_eq_entry));
2126 if (rc) 2122 if (rc)
2127 return rc; 2123 return rc;
2128 2124
@@ -2155,7 +2151,7 @@ static int be_mcc_queues_create(struct be_adapter *adapter)
2155 2151
2156 cq = &adapter->mcc_obj.cq; 2152 cq = &adapter->mcc_obj.cq;
2157 if (be_queue_alloc(adapter, cq, MCC_CQ_LEN, 2153 if (be_queue_alloc(adapter, cq, MCC_CQ_LEN,
2158 sizeof(struct be_mcc_compl))) 2154 sizeof(struct be_mcc_compl)))
2159 goto err; 2155 goto err;
2160 2156
2161 /* Use the default EQ for MCC completions */ 2157 /* Use the default EQ for MCC completions */
@@ -2275,7 +2271,7 @@ static int be_rx_cqs_create(struct be_adapter *adapter)
2275 rxo->adapter = adapter; 2271 rxo->adapter = adapter;
2276 cq = &rxo->cq; 2272 cq = &rxo->cq;
2277 rc = be_queue_alloc(adapter, cq, RX_CQ_LEN, 2273 rc = be_queue_alloc(adapter, cq, RX_CQ_LEN,
2278 sizeof(struct be_eth_rx_compl)); 2274 sizeof(struct be_eth_rx_compl));
2279 if (rc) 2275 if (rc)
2280 return rc; 2276 return rc;
2281 2277
@@ -2339,7 +2335,7 @@ static inline bool do_gro(struct be_rx_compl_info *rxcp)
2339} 2335}
2340 2336
2341static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi, 2337static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi,
2342 int budget, int polling) 2338 int budget, int polling)
2343{ 2339{
2344 struct be_adapter *adapter = rxo->adapter; 2340 struct be_adapter *adapter = rxo->adapter;
2345 struct be_queue_info *rx_cq = &rxo->cq; 2341 struct be_queue_info *rx_cq = &rxo->cq;
@@ -2365,7 +2361,7 @@ static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi,
2365 * promiscuous mode on some skews 2361 * promiscuous mode on some skews
2366 */ 2362 */
2367 if (unlikely(rxcp->port != adapter->port_num && 2363 if (unlikely(rxcp->port != adapter->port_num &&
2368 !lancer_chip(adapter))) { 2364 !lancer_chip(adapter))) {
2369 be_rx_compl_discard(rxo, rxcp); 2365 be_rx_compl_discard(rxo, rxcp);
2370 goto loop_continue; 2366 goto loop_continue;
2371 } 2367 }
@@ -2405,8 +2401,9 @@ static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo,
2405 if (!txcp) 2401 if (!txcp)
2406 break; 2402 break;
2407 num_wrbs += be_tx_compl_process(adapter, txo, 2403 num_wrbs += be_tx_compl_process(adapter, txo,
2408 AMAP_GET_BITS(struct amap_eth_tx_compl, 2404 AMAP_GET_BITS(struct
2409 wrb_index, txcp)); 2405 amap_eth_tx_compl,
2406 wrb_index, txcp));
2410 } 2407 }
2411 2408
2412 if (work_done) { 2409 if (work_done) {
@@ -2416,7 +2413,7 @@ static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo,
2416 /* As Tx wrbs have been freed up, wake up netdev queue 2413 /* As Tx wrbs have been freed up, wake up netdev queue
2417 * if it was stopped due to lack of tx wrbs. */ 2414 * if it was stopped due to lack of tx wrbs. */
2418 if (__netif_subqueue_stopped(adapter->netdev, idx) && 2415 if (__netif_subqueue_stopped(adapter->netdev, idx) &&
2419 atomic_read(&txo->q.used) < txo->q.len / 2) { 2416 atomic_read(&txo->q.used) < txo->q.len / 2) {
2420 netif_wake_subqueue(adapter->netdev, idx); 2417 netif_wake_subqueue(adapter->netdev, idx);
2421 } 2418 }
2422 2419
@@ -2510,9 +2507,9 @@ void be_detect_error(struct be_adapter *adapter)
2510 sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET); 2507 sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
2511 if (sliport_status & SLIPORT_STATUS_ERR_MASK) { 2508 if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
2512 sliport_err1 = ioread32(adapter->db + 2509 sliport_err1 = ioread32(adapter->db +
2513 SLIPORT_ERROR1_OFFSET); 2510 SLIPORT_ERROR1_OFFSET);
2514 sliport_err2 = ioread32(adapter->db + 2511 sliport_err2 = ioread32(adapter->db +
2515 SLIPORT_ERROR2_OFFSET); 2512 SLIPORT_ERROR2_OFFSET);
2516 adapter->hw_error = true; 2513 adapter->hw_error = true;
2517 /* Do not log error messages if its a FW reset */ 2514 /* Do not log error messages if its a FW reset */
2518 if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 && 2515 if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 &&
@@ -2531,13 +2528,13 @@ void be_detect_error(struct be_adapter *adapter)
2531 } 2528 }
2532 } else { 2529 } else {
2533 pci_read_config_dword(adapter->pdev, 2530 pci_read_config_dword(adapter->pdev,
2534 PCICFG_UE_STATUS_LOW, &ue_lo); 2531 PCICFG_UE_STATUS_LOW, &ue_lo);
2535 pci_read_config_dword(adapter->pdev, 2532 pci_read_config_dword(adapter->pdev,
2536 PCICFG_UE_STATUS_HIGH, &ue_hi); 2533 PCICFG_UE_STATUS_HIGH, &ue_hi);
2537 pci_read_config_dword(adapter->pdev, 2534 pci_read_config_dword(adapter->pdev,
2538 PCICFG_UE_STATUS_LOW_MASK, &ue_lo_mask); 2535 PCICFG_UE_STATUS_LOW_MASK, &ue_lo_mask);
2539 pci_read_config_dword(adapter->pdev, 2536 pci_read_config_dword(adapter->pdev,
2540 PCICFG_UE_STATUS_HI_MASK, &ue_hi_mask); 2537 PCICFG_UE_STATUS_HI_MASK, &ue_hi_mask);
2541 2538
2542 ue_lo = (ue_lo & ~ue_lo_mask); 2539 ue_lo = (ue_lo & ~ue_lo_mask);
2543 ue_hi = (ue_hi & ~ue_hi_mask); 2540 ue_hi = (ue_hi & ~ue_hi_mask);
@@ -2624,7 +2621,7 @@ fail:
2624} 2621}
2625 2622
2626static inline int be_msix_vec_get(struct be_adapter *adapter, 2623static inline int be_msix_vec_get(struct be_adapter *adapter,
2627 struct be_eq_obj *eqo) 2624 struct be_eq_obj *eqo)
2628{ 2625{
2629 return adapter->msix_entries[eqo->msix_idx].vector; 2626 return adapter->msix_entries[eqo->msix_idx].vector;
2630} 2627}
@@ -2648,7 +2645,7 @@ err_msix:
2648 for (i--, eqo = &adapter->eq_obj[i]; i >= 0; i--, eqo--) 2645 for (i--, eqo = &adapter->eq_obj[i]; i >= 0; i--, eqo--)
2649 free_irq(be_msix_vec_get(adapter, eqo), eqo); 2646 free_irq(be_msix_vec_get(adapter, eqo), eqo);
2650 dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n", 2647 dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n",
2651 status); 2648 status);
2652 be_msix_disable(adapter); 2649 be_msix_disable(adapter);
2653 return status; 2650 return status;
2654} 2651}
@@ -2821,8 +2818,7 @@ static int be_rx_qs_create(struct be_adapter *adapter)
2821 } 2818 }
2822 2819
2823 get_random_bytes(rss_hkey, RSS_HASH_KEY_LEN); 2820 get_random_bytes(rss_hkey, RSS_HASH_KEY_LEN);
2824 rc = be_cmd_rss_config(adapter, rss->rsstable, 2821 rc = be_cmd_rss_config(adapter, rss->rsstable, rss->rss_flags,
2825 rss->rss_flags,
2826 128, rss_hkey); 2822 128, rss_hkey);
2827 if (rc) { 2823 if (rc) {
2828 rss->rss_flags = RSS_ENABLE_NONE; 2824 rss->rss_flags = RSS_ENABLE_NONE;
@@ -2903,7 +2899,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
2903 2899
2904 if (enable) { 2900 if (enable) {
2905 status = pci_write_config_dword(adapter->pdev, 2901 status = pci_write_config_dword(adapter->pdev,
2906 PCICFG_PM_CONTROL_OFFSET, PCICFG_PM_CONTROL_MASK); 2902 PCICFG_PM_CONTROL_OFFSET,
2903 PCICFG_PM_CONTROL_MASK);
2907 if (status) { 2904 if (status) {
2908 dev_err(&adapter->pdev->dev, 2905 dev_err(&adapter->pdev->dev,
2909 "Could not enable Wake-on-lan\n"); 2906 "Could not enable Wake-on-lan\n");
@@ -2912,7 +2909,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
2912 return status; 2909 return status;
2913 } 2910 }
2914 status = be_cmd_enable_magic_wol(adapter, 2911 status = be_cmd_enable_magic_wol(adapter,
2915 adapter->netdev->dev_addr, &cmd); 2912 adapter->netdev->dev_addr,
2913 &cmd);
2916 pci_enable_wake(adapter->pdev, PCI_D3hot, 1); 2914 pci_enable_wake(adapter->pdev, PCI_D3hot, 1);
2917 pci_enable_wake(adapter->pdev, PCI_D3cold, 1); 2915 pci_enable_wake(adapter->pdev, PCI_D3cold, 1);
2918 } else { 2916 } else {
@@ -2951,7 +2949,8 @@ static int be_vf_eth_addr_config(struct be_adapter *adapter)
2951 2949
2952 if (status) 2950 if (status)
2953 dev_err(&adapter->pdev->dev, 2951 dev_err(&adapter->pdev->dev,
2954 "Mac address assignment failed for VF %d\n", vf); 2952 "Mac address assignment failed for VF %d\n",
2953 vf);
2955 else 2954 else
2956 memcpy(vf_cfg->mac_addr, mac, ETH_ALEN); 2955 memcpy(vf_cfg->mac_addr, mac, ETH_ALEN);
2957 2956
@@ -3093,9 +3092,11 @@ static int be_vfs_if_create(struct be_adapter *adapter)
3093 3092
3094 /* If a FW profile exists, then cap_flags are updated */ 3093 /* If a FW profile exists, then cap_flags are updated */
3095 en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED | 3094 en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED |
3096 BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_MULTICAST); 3095 BE_IF_FLAGS_BROADCAST |
3097 status = be_cmd_if_create(adapter, cap_flags, en_flags, 3096 BE_IF_FLAGS_MULTICAST);
3098 &vf_cfg->if_handle, vf + 1); 3097 status =
3098 be_cmd_if_create(adapter, cap_flags, en_flags,
3099 &vf_cfg->if_handle, vf + 1);
3099 if (status) 3100 if (status)
3100 goto err; 3101 goto err;
3101 } 3102 }
@@ -3601,8 +3602,8 @@ static void be_netpoll(struct net_device *netdev)
3601static char flash_cookie[2][16] = {"*** SE FLAS", "H DIRECTORY *** "}; 3602static char flash_cookie[2][16] = {"*** SE FLAS", "H DIRECTORY *** "};
3602 3603
3603static bool be_flash_redboot(struct be_adapter *adapter, 3604static bool be_flash_redboot(struct be_adapter *adapter,
3604 const u8 *p, u32 img_start, int image_size, 3605 const u8 *p, u32 img_start, int image_size,
3605 int hdr_size) 3606 int hdr_size)
3606{ 3607{
3607 u32 crc_offset; 3608 u32 crc_offset;
3608 u8 flashed_crc[4]; 3609 u8 flashed_crc[4];
@@ -3612,11 +3613,10 @@ static bool be_flash_redboot(struct be_adapter *adapter,
3612 3613
3613 p += crc_offset; 3614 p += crc_offset;
3614 3615
3615 status = be_cmd_get_flash_crc(adapter, flashed_crc, 3616 status = be_cmd_get_flash_crc(adapter, flashed_crc, (image_size - 4));
3616 (image_size - 4));
3617 if (status) { 3617 if (status) {
3618 dev_err(&adapter->pdev->dev, 3618 dev_err(&adapter->pdev->dev,
3619 "could not get crc from flash, not flashing redboot\n"); 3619 "could not get crc from flash, not flashing redboot\n");
3620 return false; 3620 return false;
3621 } 3621 }
3622 3622
@@ -3656,8 +3656,8 @@ static bool is_comp_in_ufi(struct be_adapter *adapter,
3656} 3656}
3657 3657
3658static struct flash_section_info *get_fsec_info(struct be_adapter *adapter, 3658static struct flash_section_info *get_fsec_info(struct be_adapter *adapter,
3659 int header_size, 3659 int header_size,
3660 const struct firmware *fw) 3660 const struct firmware *fw)
3661{ 3661{
3662 struct flash_section_info *fsec = NULL; 3662 struct flash_section_info *fsec = NULL;
3663 const u8 *p = fw->data; 3663 const u8 *p = fw->data;
@@ -3673,7 +3673,7 @@ static struct flash_section_info *get_fsec_info(struct be_adapter *adapter,
3673} 3673}
3674 3674
3675static int be_flash(struct be_adapter *adapter, const u8 *img, 3675static int be_flash(struct be_adapter *adapter, const u8 *img,
3676 struct be_dma_mem *flash_cmd, int optype, int img_size) 3676 struct be_dma_mem *flash_cmd, int optype, int img_size)
3677{ 3677{
3678 u32 total_bytes = 0, flash_op, num_bytes = 0; 3678 u32 total_bytes = 0, flash_op, num_bytes = 0;
3679 int status = 0; 3679 int status = 0;
@@ -3700,7 +3700,7 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
3700 memcpy(req->data_buf, img, num_bytes); 3700 memcpy(req->data_buf, img, num_bytes);
3701 img += num_bytes; 3701 img += num_bytes;
3702 status = be_cmd_write_flashrom(adapter, flash_cmd, optype, 3702 status = be_cmd_write_flashrom(adapter, flash_cmd, optype,
3703 flash_op, num_bytes); 3703 flash_op, num_bytes);
3704 if (status) { 3704 if (status) {
3705 if (status == ILLEGAL_IOCTL_REQ && 3705 if (status == ILLEGAL_IOCTL_REQ &&
3706 optype == OPTYPE_PHY_FW) 3706 optype == OPTYPE_PHY_FW)
@@ -3715,10 +3715,8 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
3715 3715
3716/* For BE2, BE3 and BE3-R */ 3716/* For BE2, BE3 and BE3-R */
3717static int be_flash_BEx(struct be_adapter *adapter, 3717static int be_flash_BEx(struct be_adapter *adapter,
3718 const struct firmware *fw, 3718 const struct firmware *fw,
3719 struct be_dma_mem *flash_cmd, 3719 struct be_dma_mem *flash_cmd, int num_of_images)
3720 int num_of_images)
3721
3722{ 3720{
3723 int status = 0, i, filehdr_size = 0; 3721 int status = 0, i, filehdr_size = 0;
3724 int img_hdrs_size = (num_of_images * sizeof(struct image_hdr)); 3722 int img_hdrs_size = (num_of_images * sizeof(struct image_hdr));
@@ -3800,8 +3798,10 @@ static int be_flash_BEx(struct be_adapter *adapter,
3800 3798
3801 if (pflashcomp[i].optype == OPTYPE_REDBOOT) { 3799 if (pflashcomp[i].optype == OPTYPE_REDBOOT) {
3802 redboot = be_flash_redboot(adapter, fw->data, 3800 redboot = be_flash_redboot(adapter, fw->data,
3803 pflashcomp[i].offset, pflashcomp[i].size, 3801 pflashcomp[i].offset,
3804 filehdr_size + img_hdrs_size); 3802 pflashcomp[i].size,
3803 filehdr_size +
3804 img_hdrs_size);
3805 if (!redboot) 3805 if (!redboot)
3806 continue; 3806 continue;
3807 } 3807 }
@@ -3812,7 +3812,7 @@ static int be_flash_BEx(struct be_adapter *adapter,
3812 return -1; 3812 return -1;
3813 3813
3814 status = be_flash(adapter, p, flash_cmd, pflashcomp[i].optype, 3814 status = be_flash(adapter, p, flash_cmd, pflashcomp[i].optype,
3815 pflashcomp[i].size); 3815 pflashcomp[i].size);
3816 if (status) { 3816 if (status) {
3817 dev_err(&adapter->pdev->dev, 3817 dev_err(&adapter->pdev->dev,
3818 "Flashing section type %d failed.\n", 3818 "Flashing section type %d failed.\n",
@@ -3824,8 +3824,8 @@ static int be_flash_BEx(struct be_adapter *adapter,
3824} 3824}
3825 3825
3826static int be_flash_skyhawk(struct be_adapter *adapter, 3826static int be_flash_skyhawk(struct be_adapter *adapter,
3827 const struct firmware *fw, 3827 const struct firmware *fw,
3828 struct be_dma_mem *flash_cmd, int num_of_images) 3828 struct be_dma_mem *flash_cmd, int num_of_images)
3829{ 3829{
3830 int status = 0, i, filehdr_size = 0; 3830 int status = 0, i, filehdr_size = 0;
3831 int img_offset, img_size, img_optype, redboot; 3831 int img_offset, img_size, img_optype, redboot;
@@ -3873,8 +3873,9 @@ static int be_flash_skyhawk(struct be_adapter *adapter,
3873 3873
3874 if (img_optype == OPTYPE_REDBOOT) { 3874 if (img_optype == OPTYPE_REDBOOT) {
3875 redboot = be_flash_redboot(adapter, fw->data, 3875 redboot = be_flash_redboot(adapter, fw->data,
3876 img_offset, img_size, 3876 img_offset, img_size,
3877 filehdr_size + img_hdrs_size); 3877 filehdr_size +
3878 img_hdrs_size);
3878 if (!redboot) 3879 if (!redboot)
3879 continue; 3880 continue;
3880 } 3881 }
@@ -3896,7 +3897,7 @@ static int be_flash_skyhawk(struct be_adapter *adapter,
3896} 3897}
3897 3898
3898static int lancer_fw_download(struct be_adapter *adapter, 3899static int lancer_fw_download(struct be_adapter *adapter,
3899 const struct firmware *fw) 3900 const struct firmware *fw)
3900{ 3901{
3901#define LANCER_FW_DOWNLOAD_CHUNK (32 * 1024) 3902#define LANCER_FW_DOWNLOAD_CHUNK (32 * 1024)
3902#define LANCER_FW_DOWNLOAD_LOCATION "/prg" 3903#define LANCER_FW_DOWNLOAD_LOCATION "/prg"
@@ -3962,7 +3963,7 @@ static int lancer_fw_download(struct be_adapter *adapter,
3962 } 3963 }
3963 3964
3964 dma_free_coherent(&adapter->pdev->dev, flash_cmd.size, flash_cmd.va, 3965 dma_free_coherent(&adapter->pdev->dev, flash_cmd.size, flash_cmd.va,
3965 flash_cmd.dma); 3966 flash_cmd.dma);
3966 if (status) { 3967 if (status) {
3967 dev_err(&adapter->pdev->dev, 3968 dev_err(&adapter->pdev->dev,
3968 "Firmware load error. " 3969 "Firmware load error. "
@@ -3983,9 +3984,8 @@ static int lancer_fw_download(struct be_adapter *adapter,
3983 goto lancer_fw_exit; 3984 goto lancer_fw_exit;
3984 } 3985 }
3985 } else if (change_status != LANCER_NO_RESET_NEEDED) { 3986 } else if (change_status != LANCER_NO_RESET_NEEDED) {
3986 dev_err(&adapter->pdev->dev, 3987 dev_err(&adapter->pdev->dev,
3987 "System reboot required for new FW" 3988 "System reboot required for new FW to be active\n");
3988 " to be active\n");
3989 } 3989 }
3990 3990
3991 dev_info(&adapter->pdev->dev, "Firmware flashed successfully\n"); 3991 dev_info(&adapter->pdev->dev, "Firmware flashed successfully\n");
@@ -4049,7 +4049,7 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
4049 switch (ufi_type) { 4049 switch (ufi_type) {
4050 case UFI_TYPE4: 4050 case UFI_TYPE4:
4051 status = be_flash_skyhawk(adapter, fw, 4051 status = be_flash_skyhawk(adapter, fw,
4052 &flash_cmd, num_imgs); 4052 &flash_cmd, num_imgs);
4053 break; 4053 break;
4054 case UFI_TYPE3R: 4054 case UFI_TYPE3R:
4055 status = be_flash_BEx(adapter, fw, &flash_cmd, 4055 status = be_flash_BEx(adapter, fw, &flash_cmd,
@@ -4119,8 +4119,7 @@ fw_exit:
4119 return status; 4119 return status;
4120} 4120}
4121 4121
4122static int be_ndo_bridge_setlink(struct net_device *dev, 4122static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh)
4123 struct nlmsghdr *nlh)
4124{ 4123{
4125 struct be_adapter *adapter = netdev_priv(dev); 4124 struct be_adapter *adapter = netdev_priv(dev);
4126 struct nlattr *attr, *br_spec; 4125 struct nlattr *attr, *br_spec;
@@ -4162,8 +4161,7 @@ err:
4162} 4161}
4163 4162
4164static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, 4163static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
4165 struct net_device *dev, 4164 struct net_device *dev, u32 filter_mask)
4166 u32 filter_mask)
4167{ 4165{
4168 struct be_adapter *adapter = netdev_priv(dev); 4166 struct be_adapter *adapter = netdev_priv(dev);
4169 int status = 0; 4167 int status = 0;
@@ -4877,7 +4875,7 @@ static void be_shutdown(struct pci_dev *pdev)
4877} 4875}
4878 4876
4879static pci_ers_result_t be_eeh_err_detected(struct pci_dev *pdev, 4877static pci_ers_result_t be_eeh_err_detected(struct pci_dev *pdev,
4880 pci_channel_state_t state) 4878 pci_channel_state_t state)
4881{ 4879{
4882 struct be_adapter *adapter = pci_get_drvdata(pdev); 4880 struct be_adapter *adapter = pci_get_drvdata(pdev);
4883 struct net_device *netdev = adapter->netdev; 4881 struct net_device *netdev = adapter->netdev;