aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-10-13 07:32:50 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-13 07:32:50 -0400
commit1f225031fee6c39cbbf2a6c79cb150ff63f0556c (patch)
tree66411136a3cbb93cc3ac6587dfcef33fe73c1d71
parent3bb35ac4978977cf414893ee721f442039c4b8a4 (diff)
parent196e3735fa66c8340d6fff9ec81f6201ffc60b7d (diff)
Merge branch 'be2net-fixes'
Sathya Perla says: ==================== be2net: patch set Patch 1 fixes a FW image compatibility check in the driver that prevents certain FW images from being flashed on BE3 (not BE3-R) adapters. Patch 2 fixes a spin_lock not being released in a failure case in be_cmd_notify_wait(). Patch 3 includes a workaround to pad packets that are only 32b long or less to be applicabe to BE3 too. This workaround was currently applied only to Skyhawk and Lancer chips. Such packets are causing BE3's TX path to stall on a SR-IOV config. Patch 4 fixes the be_cmd_get_profile_config() routine to set the pf_num field in the cmd request. The FW requires this field to be set for it to return the specific function's descriptors. If not set, the FW returns the descriptors of all the functions on the device. If the first descriptor is not what is being queried for, the driver will read wrong data. This patch fixes this issue by using the GET_CNTL_ATTRIB cmd to query the real pci_func_num of a function and then uses it in the GET_PROFILE_CONFIG cmd. Patch 5 completes an earlier fix that removed the vlan promisc capability for VFs. The earlier fix did not update the removal of this capability from the profile descriptor of the VF. This causes the VF driver to request this capability when it tries to create it's interface at probe time. This could potentailly cause the VF probe to fail if the FW enforces strict checking of the flags based on what was provisoned by the PF. This strict checking is not being done by FW currently but will be fixed in a future version. This patch fixes this issue by updating the VF's profile descriptor so that they match the interface capability flags provisioned by the PF. Pls consider adding these patches to the net tree. Thanks! ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c31
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h10
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c28
4 files changed, 52 insertions, 18 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 821540913343..d463563e1f70 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -592,6 +592,7 @@ struct be_adapter {
592 int be_get_temp_freq; 592 int be_get_temp_freq;
593 struct be_hwmon hwmon_info; 593 struct be_hwmon hwmon_info;
594 u8 pf_number; 594 u8 pf_number;
595 u8 pci_func_num;
595 struct rss_info rss_info; 596 struct rss_info rss_info;
596 /* Filters for packets that need to be sent to BMC */ 597 /* Filters for packets that need to be sent to BMC */
597 u32 bmc_filt_mask; 598 u32 bmc_filt_mask;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index eb323913cd39..1795c935ff02 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -851,8 +851,10 @@ static int be_cmd_notify_wait(struct be_adapter *adapter,
851 return status; 851 return status;
852 852
853 dest_wrb = be_cmd_copy(adapter, wrb); 853 dest_wrb = be_cmd_copy(adapter, wrb);
854 if (!dest_wrb) 854 if (!dest_wrb) {
855 return -EBUSY; 855 status = -EBUSY;
856 goto unlock;
857 }
856 858
857 if (use_mcc(adapter)) 859 if (use_mcc(adapter))
858 status = be_mcc_notify_wait(adapter); 860 status = be_mcc_notify_wait(adapter);
@@ -862,6 +864,7 @@ static int be_cmd_notify_wait(struct be_adapter *adapter,
862 if (!status) 864 if (!status)
863 memcpy(wrb, dest_wrb, sizeof(*wrb)); 865 memcpy(wrb, dest_wrb, sizeof(*wrb));
864 866
867unlock:
865 be_cmd_unlock(adapter); 868 be_cmd_unlock(adapter);
866 return status; 869 return status;
867} 870}
@@ -1984,6 +1987,8 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
1984 be_if_cap_flags(adapter)); 1987 be_if_cap_flags(adapter));
1985 } 1988 }
1986 flags &= be_if_cap_flags(adapter); 1989 flags &= be_if_cap_flags(adapter);
1990 if (!flags)
1991 return -ENOTSUPP;
1987 1992
1988 return __be_cmd_rx_filter(adapter, flags, value); 1993 return __be_cmd_rx_filter(adapter, flags, value);
1989} 1994}
@@ -2887,6 +2892,7 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
2887 if (!status) { 2892 if (!status) {
2888 attribs = attribs_cmd.va + sizeof(struct be_cmd_resp_hdr); 2893 attribs = attribs_cmd.va + sizeof(struct be_cmd_resp_hdr);
2889 adapter->hba_port_num = attribs->hba_attribs.phy_port; 2894 adapter->hba_port_num = attribs->hba_attribs.phy_port;
2895 adapter->pci_func_num = attribs->pci_func_num;
2890 serial_num = attribs->hba_attribs.controller_serial_number; 2896 serial_num = attribs->hba_attribs.controller_serial_number;
2891 for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++) 2897 for (i = 0; i < CNTL_SERIAL_NUM_WORDS; i++)
2892 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) & 2898 adapter->serial_num[i] = le32_to_cpu(serial_num[i]) &
@@ -3709,7 +3715,6 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res)
3709 status = -EINVAL; 3715 status = -EINVAL;
3710 goto err; 3716 goto err;
3711 } 3717 }
3712
3713 adapter->pf_number = desc->pf_num; 3718 adapter->pf_number = desc->pf_num;
3714 be_copy_nic_desc(res, desc); 3719 be_copy_nic_desc(res, desc);
3715 } 3720 }
@@ -3721,7 +3726,10 @@ err:
3721 return status; 3726 return status;
3722} 3727}
3723 3728
3724/* Will use MBOX only if MCCQ has not been created */ 3729/* Will use MBOX only if MCCQ has not been created
3730 * non-zero domain => a PF is querying this on behalf of a VF
3731 * zero domain => a PF or a VF is querying this for itself
3732 */
3725int be_cmd_get_profile_config(struct be_adapter *adapter, 3733int be_cmd_get_profile_config(struct be_adapter *adapter,
3726 struct be_resources *res, u8 query, u8 domain) 3734 struct be_resources *res, u8 query, u8 domain)
3727{ 3735{
@@ -3748,10 +3756,15 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
3748 OPCODE_COMMON_GET_PROFILE_CONFIG, 3756 OPCODE_COMMON_GET_PROFILE_CONFIG,
3749 cmd.size, &wrb, &cmd); 3757 cmd.size, &wrb, &cmd);
3750 3758
3751 req->hdr.domain = domain;
3752 if (!lancer_chip(adapter)) 3759 if (!lancer_chip(adapter))
3753 req->hdr.version = 1; 3760 req->hdr.version = 1;
3754 req->type = ACTIVE_PROFILE_TYPE; 3761 req->type = ACTIVE_PROFILE_TYPE;
3762 /* When a function is querying profile information relating to
3763 * itself hdr.pf_number must be set to it's pci_func_num + 1
3764 */
3765 req->hdr.domain = domain;
3766 if (domain == 0)
3767 req->hdr.pf_num = adapter->pci_func_num + 1;
3755 3768
3756 /* When QUERY_MODIFIABLE_FIELDS_TYPE bit is set, cmd returns the 3769 /* When QUERY_MODIFIABLE_FIELDS_TYPE bit is set, cmd returns the
3757 * descriptors with all bits set to "1" for the fields which can be 3770 * descriptors with all bits set to "1" for the fields which can be
@@ -3921,12 +3934,16 @@ static void be_fill_vf_res_template(struct be_adapter *adapter,
3921 vf_if_cap_flags &= ~(BE_IF_FLAGS_RSS | 3934 vf_if_cap_flags &= ~(BE_IF_FLAGS_RSS |
3922 BE_IF_FLAGS_DEFQ_RSS); 3935 BE_IF_FLAGS_DEFQ_RSS);
3923 } 3936 }
3924
3925 nic_vft->cap_flags = cpu_to_le32(vf_if_cap_flags);
3926 } else { 3937 } else {
3927 num_vf_qs = 1; 3938 num_vf_qs = 1;
3928 } 3939 }
3929 3940
3941 if (res_mod.vf_if_cap_flags & BE_IF_FLAGS_VLAN_PROMISCUOUS) {
3942 nic_vft->flags |= BIT(IF_CAPS_FLAGS_VALID_SHIFT);
3943 vf_if_cap_flags &= ~BE_IF_FLAGS_VLAN_PROMISCUOUS;
3944 }
3945
3946 nic_vft->cap_flags = cpu_to_le32(vf_if_cap_flags);
3930 nic_vft->rq_count = cpu_to_le16(num_vf_qs); 3947 nic_vft->rq_count = cpu_to_le16(num_vf_qs);
3931 nic_vft->txq_count = cpu_to_le16(num_vf_qs); 3948 nic_vft->txq_count = cpu_to_le16(num_vf_qs);
3932 nic_vft->rssq_count = cpu_to_le16(num_vf_qs); 3949 nic_vft->rssq_count = cpu_to_le16(num_vf_qs);
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 7d178bdb112e..91155ea74f34 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -289,7 +289,9 @@ struct be_cmd_req_hdr {
289 u32 timeout; /* dword 1 */ 289 u32 timeout; /* dword 1 */
290 u32 request_length; /* dword 2 */ 290 u32 request_length; /* dword 2 */
291 u8 version; /* dword 3 */ 291 u8 version; /* dword 3 */
292 u8 rsvd[3]; /* dword 3 */ 292 u8 rsvd1; /* dword 3 */
293 u8 pf_num; /* dword 3 */
294 u8 rsvd2; /* dword 3 */
293}; 295};
294 296
295#define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ 297#define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
@@ -1652,7 +1654,11 @@ struct mgmt_hba_attribs {
1652 1654
1653struct mgmt_controller_attrib { 1655struct mgmt_controller_attrib {
1654 struct mgmt_hba_attribs hba_attribs; 1656 struct mgmt_hba_attribs hba_attribs;
1655 u32 rsvd0[10]; 1657 u32 rsvd0[2];
1658 u16 rsvd1;
1659 u8 pci_func_num;
1660 u8 rsvd2;
1661 u32 rsvd3[7];
1656} __packed; 1662} __packed;
1657 1663
1658struct be_cmd_req_cntl_attribs { 1664struct be_cmd_req_cntl_attribs {
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 7bf51a1a0a77..eb48a977f8da 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1123,11 +1123,12 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter,
1123 struct sk_buff *skb, 1123 struct sk_buff *skb,
1124 struct be_wrb_params *wrb_params) 1124 struct be_wrb_params *wrb_params)
1125{ 1125{
1126 /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or 1126 /* Lancer, SH and BE3 in SRIOV mode have a bug wherein
1127 * less may cause a transmit stall on that port. So the work-around is 1127 * packets that are 32b or less may cause a transmit stall
1128 * to pad short packets (<= 32 bytes) to a 36-byte length. 1128 * on that port. The workaround is to pad such packets
1129 * (len <= 32 bytes) to a minimum length of 36b.
1129 */ 1130 */
1130 if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) { 1131 if (skb->len <= 32) {
1131 if (skb_put_padto(skb, 36)) 1132 if (skb_put_padto(skb, 36))
1132 return NULL; 1133 return NULL;
1133 } 1134 }
@@ -4205,10 +4206,6 @@ static int be_get_config(struct be_adapter *adapter)
4205 int status, level; 4206 int status, level;
4206 u16 profile_id; 4207 u16 profile_id;
4207 4208
4208 status = be_cmd_get_cntl_attributes(adapter);
4209 if (status)
4210 return status;
4211
4212 status = be_cmd_query_fw_cfg(adapter); 4209 status = be_cmd_query_fw_cfg(adapter);
4213 if (status) 4210 if (status)
4214 return status; 4211 return status;
@@ -4407,6 +4404,11 @@ static int be_setup(struct be_adapter *adapter)
4407 if (!lancer_chip(adapter)) 4404 if (!lancer_chip(adapter))
4408 be_cmd_req_native_mode(adapter); 4405 be_cmd_req_native_mode(adapter);
4409 4406
4407 /* Need to invoke this cmd first to get the PCI Function Number */
4408 status = be_cmd_get_cntl_attributes(adapter);
4409 if (status)
4410 return status;
4411
4410 if (!BE2_chip(adapter) && be_physfn(adapter)) 4412 if (!BE2_chip(adapter) && be_physfn(adapter))
4411 be_alloc_sriov_res(adapter); 4413 be_alloc_sriov_res(adapter);
4412 4414
@@ -4999,7 +5001,15 @@ static bool be_check_ufi_compatibility(struct be_adapter *adapter,
4999 return false; 5001 return false;
5000 } 5002 }
5001 5003
5002 return (fhdr->asic_type_rev >= adapter->asic_rev); 5004 /* In BE3 FW images the "asic_type_rev" field doesn't track the
5005 * asic_rev of the chips it is compatible with.
5006 * When asic_type_rev is 0 the image is compatible only with
5007 * pre-BE3-R chips (asic_rev < 0x10)
5008 */
5009 if (BEx_chip(adapter) && fhdr->asic_type_rev == 0)
5010 return adapter->asic_rev < 0x10;
5011 else
5012 return (fhdr->asic_type_rev >= adapter->asic_rev);
5003} 5013}
5004 5014
5005static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) 5015static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)