aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-10-09 09:30:45 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-09 09:30:45 -0400
commitd24cd733bae8fc6c121c437b3197ab7f3930ca66 (patch)
tree0acb2fe1897a0bdd90ea467e80eee9500088eb11
parent2f7c68d8e6d47d9b66cc2c803e7d8a5b9768475d (diff)
parentdc6e8511ff7141141578bac559565c55a1e14ad8 (diff)
Merge branch 'be2net-fixes'
Sriharsha Basavapatna says: ==================== be2net: patch-set The following patch set contains a few bug fixes. Please consider applying this to the net-next tree. Thanks. Patch-1 Obtains proper PF number for BEx chips Patch-2 Fixes a FW update issue seen with BEx chips Patch-3 Updates copyright string Patch-4 Fixes TX stats for TSO packets Patch-5 Enables VF link state setting for BE3 ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c31
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h6
-rw-r--r--drivers/net/ethernet/emulex/benet/be_hw.h2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c14
4 files changed, 47 insertions, 6 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 9cffe48be156..1fb5d7239254 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2728,6 +2728,26 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
2728 return 0; 2728 return 0;
2729} 2729}
2730 2730
2731#define NCSI_UPDATE_LOG "NCSI section update is not supported in FW ver %s\n"
2732static bool be_fw_ncsi_supported(char *ver)
2733{
2734 int v1[4] = {3, 102, 148, 0}; /* Min ver that supports NCSI FW */
2735 int v2[4];
2736 int i;
2737
2738 if (sscanf(ver, "%d.%d.%d.%d", &v2[0], &v2[1], &v2[2], &v2[3]) != 4)
2739 return false;
2740
2741 for (i = 0; i < 4; i++) {
2742 if (v1[i] < v2[i])
2743 return true;
2744 else if (v1[i] > v2[i])
2745 return false;
2746 }
2747
2748 return true;
2749}
2750
2731/* For BE2, BE3 and BE3-R */ 2751/* For BE2, BE3 and BE3-R */
2732static int be_flash_BEx(struct be_adapter *adapter, 2752static int be_flash_BEx(struct be_adapter *adapter,
2733 const struct firmware *fw, 2753 const struct firmware *fw,
@@ -2805,8 +2825,10 @@ static int be_flash_BEx(struct be_adapter *adapter,
2805 continue; 2825 continue;
2806 2826
2807 if ((pflashcomp[i].optype == OPTYPE_NCSI_FW) && 2827 if ((pflashcomp[i].optype == OPTYPE_NCSI_FW) &&
2808 memcmp(adapter->fw_ver, "3.102.148.0", 11) < 0) 2828 !be_fw_ncsi_supported(adapter->fw_ver)) {
2829 dev_info(dev, NCSI_UPDATE_LOG, adapter->fw_ver);
2809 continue; 2830 continue;
2831 }
2810 2832
2811 if (pflashcomp[i].optype == OPTYPE_PHY_FW && 2833 if (pflashcomp[i].optype == OPTYPE_PHY_FW &&
2812 !phy_flashing_required(adapter)) 2834 !phy_flashing_required(adapter))
@@ -3527,6 +3549,11 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
3527 for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++) 3549 for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++)
3528 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) & 3550 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) &
3529 (BIT_MASK(16) - 1); 3551 (BIT_MASK(16) - 1);
3552 /* For BEx, since GET_FUNC_CONFIG command is not
3553 * supported, we read funcnum here as a workaround.
3554 */
3555 if (BEx_chip(adapter))
3556 adapter->pf_num = attribs->hba_attribs.pci_funcnum;
3530 } 3557 }
3531 3558
3532err: 3559err:
@@ -4950,7 +4977,7 @@ int be_cmd_set_logical_link_config(struct be_adapter *adapter,
4950{ 4977{
4951 int status; 4978 int status;
4952 4979
4953 if (BEx_chip(adapter)) 4980 if (BE2_chip(adapter))
4954 return -EOPNOTSUPP; 4981 return -EOPNOTSUPP;
4955 4982
4956 status = __be_cmd_set_logical_link_config(adapter, link_state, 4983 status = __be_cmd_set_logical_link_config(adapter, link_state,
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 1bd82bcb3be5..09da2d82c2f0 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1720,7 +1720,11 @@ struct mgmt_hba_attribs {
1720 u32 rsvd2[55]; 1720 u32 rsvd2[55];
1721 u8 rsvd3[3]; 1721 u8 rsvd3[3];
1722 u8 phy_port; 1722 u8 phy_port;
1723 u32 rsvd4[13]; 1723 u32 rsvd4[15];
1724 u8 rsvd5[2];
1725 u8 pci_funcnum;
1726 u8 rsvd6;
1727 u32 rsvd7[6];
1724} __packed; 1728} __packed;
1725 1729
1726struct mgmt_controller_attrib { 1730struct mgmt_controller_attrib {
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index 92942c84d329..36e4232ed6b8 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2005 - 2015 Emulex 2 * Copyright (C) 2005-2016 Broadcom.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index dcb930a52613..cece8a08edca 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -724,14 +724,24 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status)
724 netdev_info(netdev, "Link is %s\n", link_status ? "Up" : "Down"); 724 netdev_info(netdev, "Link is %s\n", link_status ? "Up" : "Down");
725} 725}
726 726
727static int be_gso_hdr_len(struct sk_buff *skb)
728{
729 if (skb->encapsulation)
730 return skb_inner_transport_offset(skb) +
731 inner_tcp_hdrlen(skb);
732 return skb_transport_offset(skb) + tcp_hdrlen(skb);
733}
734
727static void be_tx_stats_update(struct be_tx_obj *txo, struct sk_buff *skb) 735static void be_tx_stats_update(struct be_tx_obj *txo, struct sk_buff *skb)
728{ 736{
729 struct be_tx_stats *stats = tx_stats(txo); 737 struct be_tx_stats *stats = tx_stats(txo);
730 u64 tx_pkts = skb_shinfo(skb)->gso_segs ? : 1; 738 u32 tx_pkts = skb_shinfo(skb)->gso_segs ? : 1;
739 /* Account for headers which get duplicated in TSO pkt */
740 u32 dup_hdr_len = tx_pkts > 1 ? be_gso_hdr_len(skb) * (tx_pkts - 1) : 0;
731 741
732 u64_stats_update_begin(&stats->sync); 742 u64_stats_update_begin(&stats->sync);
733 stats->tx_reqs++; 743 stats->tx_reqs++;
734 stats->tx_bytes += skb->len; 744 stats->tx_bytes += skb->len + dup_hdr_len;
735 stats->tx_pkts += tx_pkts; 745 stats->tx_pkts += tx_pkts;
736 if (skb->encapsulation && skb->ip_summed == CHECKSUM_PARTIAL) 746 if (skb->encapsulation && skb->ip_summed == CHECKSUM_PARTIAL)
737 stats->tx_vxlan_offload_pkts += tx_pkts; 747 stats->tx_vxlan_offload_pkts += tx_pkts;