Commit 87b200e1 authored by David S. Miller's avatar David S. Miller

Merge branch 'be2net-next'

Sathya Perla says:

====================
be2net: patch set

Patches 1 to 6 address issues with return values of some ndo/ethtool
driver methods. In error scenarios, either an inappropriate error or
a +ve return value (where the stack expects a -ve value) was being returned.

Patch 7 updates description strings for certain UE bits.

Patch 8 cleans up (reduces) argument passing for a few routines in be_cmds.c.

Patch 9 removes some unused code (unused definitions.)

Patch 10 updates NULL check in the driver to a consistent "if (!foo)" style.

Patchs 11 to 13 fix a few minor issues with the earlier patch bec84e6b
("create optimal number of queues on SR-IOV config"):
	- patch 11 fixes BEx_get_resources() code to use be_max_vfs() macro
	- patch 12 skips SR-IOV config code for BE2 that doesn't support SRIOV
	- patch 13 uses adapter->flags to track SRIOV enabled state

Patch 14 updates the driver version.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 23fa5c2c c346e6e5
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "be_hw.h" #include "be_hw.h"
#include "be_roce.h" #include "be_roce.h"
#define DRV_VER "10.2u" #define DRV_VER "10.4u"
#define DRV_NAME "be2net" #define DRV_NAME "be2net"
#define BE_NAME "Emulex BladeEngine2" #define BE_NAME "Emulex BladeEngine2"
#define BE3_NAME "Emulex BladeEngine3" #define BE3_NAME "Emulex BladeEngine3"
...@@ -372,6 +372,7 @@ enum vf_state { ...@@ -372,6 +372,7 @@ enum vf_state {
}; };
#define BE_FLAGS_LINK_STATUS_INIT 1 #define BE_FLAGS_LINK_STATUS_INIT 1
#define BE_FLAGS_SRIOV_ENABLED (1 << 2)
#define BE_FLAGS_WORKER_SCHEDULED (1 << 3) #define BE_FLAGS_WORKER_SCHEDULED (1 << 3)
#define BE_FLAGS_VLAN_PROMISC (1 << 4) #define BE_FLAGS_VLAN_PROMISC (1 << 4)
#define BE_FLAGS_MCAST_PROMISC (1 << 5) #define BE_FLAGS_MCAST_PROMISC (1 << 5)
...@@ -525,7 +526,8 @@ struct be_adapter { ...@@ -525,7 +526,8 @@ struct be_adapter {
#define be_physfn(adapter) (!adapter->virtfn) #define be_physfn(adapter) (!adapter->virtfn)
#define be_virtfn(adapter) (adapter->virtfn) #define be_virtfn(adapter) (adapter->virtfn)
#define sriov_enabled(adapter) (adapter->num_vfs > 0) #define sriov_enabled(adapter) (adapter->flags & \
BE_FLAGS_SRIOV_ENABLED)
#define for_all_vfs(adapter, vf_cfg, i) \ #define for_all_vfs(adapter, vf_cfg, i) \
for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \ for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \
...@@ -672,6 +674,8 @@ static inline void swap_dws(void *wrb, int len) ...@@ -672,6 +674,8 @@ static inline void swap_dws(void *wrb, int len)
#endif /* __BIG_ENDIAN */ #endif /* __BIG_ENDIAN */
} }
#define be_cmd_status(status) (status > 0 ? -EIO : status)
static inline u8 is_tcp_pkt(struct sk_buff *skb) static inline u8 is_tcp_pkt(struct sk_buff *skb)
{ {
u8 val = 0; u8 val = 0;
......
...@@ -1749,8 +1749,7 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) ...@@ -1749,8 +1749,7 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
} }
/* Uses synchronous mcc */ /* Uses synchronous mcc */
int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver, int be_cmd_get_fw_ver(struct be_adapter *adapter)
char *fw_on_flash)
{ {
struct be_mcc_wrb *wrb; struct be_mcc_wrb *wrb;
struct be_cmd_req_get_fw_version *req; struct be_cmd_req_get_fw_version *req;
...@@ -1772,9 +1771,8 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver, ...@@ -1772,9 +1771,8 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
status = be_mcc_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
if (!status) { if (!status) {
struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb); struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb);
strcpy(fw_ver, resp->firmware_version_string); strcpy(adapter->fw_ver, resp->firmware_version_string);
if (fw_on_flash) strcpy(adapter->fw_on_flash, resp->fw_on_flash_version_string);
strcpy(fw_on_flash, resp->fw_on_flash_version_string);
} }
err: err:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
...@@ -1997,8 +1995,7 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc) ...@@ -1997,8 +1995,7 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc)
} }
/* Uses mbox */ /* Uses mbox */
int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, int be_cmd_query_fw_cfg(struct be_adapter *adapter)
u32 *mode, u32 *caps, u16 *asic_rev)
{ {
struct be_mcc_wrb *wrb; struct be_mcc_wrb *wrb;
struct be_cmd_req_query_fw_cfg *req; struct be_cmd_req_query_fw_cfg *req;
...@@ -2017,10 +2014,10 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, ...@@ -2017,10 +2014,10 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
status = be_mbox_notify_wait(adapter); status = be_mbox_notify_wait(adapter);
if (!status) { if (!status) {
struct be_cmd_resp_query_fw_cfg *resp = embedded_payload(wrb); struct be_cmd_resp_query_fw_cfg *resp = embedded_payload(wrb);
*port_num = le32_to_cpu(resp->phys_port); adapter->port_num = le32_to_cpu(resp->phys_port);
*mode = le32_to_cpu(resp->function_mode); adapter->function_mode = le32_to_cpu(resp->function_mode);
*caps = le32_to_cpu(resp->function_caps); adapter->function_caps = le32_to_cpu(resp->function_caps);
*asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF; adapter->asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF;
} }
mutex_unlock(&adapter->mbox_lock); mutex_unlock(&adapter->mbox_lock);
...@@ -2224,7 +2221,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2224,7 +2221,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
if (!wait_for_completion_timeout(&adapter->et_cmd_compl, if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
msecs_to_jiffies(60000))) msecs_to_jiffies(60000)))
status = -1; status = -ETIMEDOUT;
else else
status = adapter->flash_status; status = adapter->flash_status;
...@@ -2320,7 +2317,7 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2320,7 +2317,7 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
if (!wait_for_completion_timeout(&adapter->et_cmd_compl, if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
msecs_to_jiffies(40000))) msecs_to_jiffies(40000)))
status = -1; status = -ETIMEDOUT;
else else
status = adapter->flash_status; status = adapter->flash_status;
......
...@@ -1081,11 +1081,6 @@ struct be_cmd_req_modify_eq_delay { ...@@ -1081,11 +1081,6 @@ struct be_cmd_req_modify_eq_delay {
struct be_set_eqd set_eqd[MAX_EVT_QS]; struct be_set_eqd set_eqd[MAX_EVT_QS];
} __packed; } __packed;
struct be_cmd_resp_modify_eq_delay {
struct be_cmd_resp_hdr hdr;
u32 rsvd0;
} __packed;
/******************** Get FW Config *******************/ /******************** Get FW Config *******************/
/* The HW can come up in either of the following multi-channel modes /* The HW can come up in either of the following multi-channel modes
* based on the skew/IPL. * based on the skew/IPL.
...@@ -1156,11 +1151,6 @@ struct be_cmd_req_enable_disable_beacon { ...@@ -1156,11 +1151,6 @@ struct be_cmd_req_enable_disable_beacon {
u8 status_duration; u8 status_duration;
} __packed; } __packed;
struct be_cmd_resp_enable_disable_beacon {
struct be_cmd_resp_hdr resp_hdr;
u32 rsvd0;
} __packed;
struct be_cmd_req_get_beacon_state { struct be_cmd_req_get_beacon_state {
struct be_cmd_req_hdr hdr; struct be_cmd_req_hdr hdr;
u8 port_num; u8 port_num;
...@@ -1326,11 +1316,6 @@ struct be_cmd_req_set_lmode { ...@@ -1326,11 +1316,6 @@ struct be_cmd_req_set_lmode {
u8 loopback_state; u8 loopback_state;
}; };
struct be_cmd_resp_set_lmode {
struct be_cmd_resp_hdr resp_hdr;
u8 rsvd0[4];
};
/********************** DDR DMA test *********************/ /********************** DDR DMA test *********************/
struct be_cmd_req_ddrdma_test { struct be_cmd_req_ddrdma_test {
struct be_cmd_req_hdr hdr; struct be_cmd_req_hdr hdr;
...@@ -1434,11 +1419,6 @@ struct be_cmd_req_set_qos { ...@@ -1434,11 +1419,6 @@ struct be_cmd_req_set_qos {
u32 rsvd[7]; u32 rsvd[7];
}; };
struct be_cmd_resp_set_qos {
struct be_cmd_resp_hdr hdr;
u32 rsvd;
};
/*********************** Controller Attributes ***********************/ /*********************** Controller Attributes ***********************/
struct be_cmd_req_cntl_attribs { struct be_cmd_req_cntl_attribs {
struct be_cmd_req_hdr hdr; struct be_cmd_req_hdr hdr;
...@@ -1572,11 +1552,6 @@ struct be_cmd_req_set_hsw_config { ...@@ -1572,11 +1552,6 @@ struct be_cmd_req_set_hsw_config {
u8 context[sizeof(struct amap_set_hsw_context) / 8]; u8 context[sizeof(struct amap_set_hsw_context) / 8];
} __packed; } __packed;
struct be_cmd_resp_set_hsw_config {
struct be_cmd_resp_hdr hdr;
u32 rsvd;
};
struct amap_get_hsw_req_context { struct amap_get_hsw_req_context {
u8 interface_id[16]; u8 interface_id[16];
u8 rsvd0[14]; u8 rsvd0[14];
...@@ -1966,10 +1941,6 @@ struct be_cmd_req_set_profile_config { ...@@ -1966,10 +1941,6 @@ struct be_cmd_req_set_profile_config {
u8 desc[2 * RESOURCE_DESC_SIZE_V1]; u8 desc[2 * RESOURCE_DESC_SIZE_V1];
} __packed; } __packed;
struct be_cmd_resp_set_profile_config {
struct be_cmd_resp_hdr hdr;
};
struct be_cmd_req_get_active_profile { struct be_cmd_req_get_active_profile {
struct be_cmd_req_hdr hdr; struct be_cmd_req_hdr hdr;
u32 rsvd; u32 rsvd;
...@@ -2071,16 +2042,14 @@ int be_cmd_reset(struct be_adapter *adapter); ...@@ -2071,16 +2042,14 @@ int be_cmd_reset(struct be_adapter *adapter);
int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd); int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd);
int lancer_cmd_get_pport_stats(struct be_adapter *adapter, int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
struct be_dma_mem *nonemb_cmd); struct be_dma_mem *nonemb_cmd);
int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver, int be_cmd_get_fw_ver(struct be_adapter *adapter);
char *fw_on_flash);
int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num); int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num);
int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
u32 num); u32 num);
int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status); int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status);
int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc); int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc);
int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc); int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc);
int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, int be_cmd_query_fw_cfg(struct be_adapter *adapter);
u32 *function_mode, u32 *function_caps, u16 *asic_rev);
int be_cmd_reset_function(struct be_adapter *adapter); int be_cmd_reset_function(struct be_adapter *adapter);
int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
u32 rss_hash_opts, u16 table_size, const u8 *rss_hkey); u32 rss_hash_opts, u16 table_size, const u8 *rss_hkey);
......
...@@ -643,7 +643,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd) ...@@ -643,7 +643,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
if (status) if (status)
dev_warn(&adapter->pdev->dev, "Pause param set failed.\n"); dev_warn(&adapter->pdev->dev, "Pause param set failed.\n");
return status; return be_cmd_status(status);
} }
static int be_set_phys_id(struct net_device *netdev, static int be_set_phys_id(struct net_device *netdev,
...@@ -762,7 +762,7 @@ static int be_test_ddr_dma(struct be_adapter *adapter) ...@@ -762,7 +762,7 @@ static int be_test_ddr_dma(struct be_adapter *adapter)
err: err:
dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va, dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va,
ddrdma_cmd.dma); ddrdma_cmd.dma);
return ret; return be_cmd_status(ret);
} }
static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type, static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
...@@ -885,7 +885,7 @@ static int be_read_eeprom(struct net_device *netdev, ...@@ -885,7 +885,7 @@ static int be_read_eeprom(struct net_device *netdev,
dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va, dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va,
eeprom_cmd.dma); eeprom_cmd.dma);
return status; return be_cmd_status(status);
} }
static u32 be_get_msg_level(struct net_device *netdev) static u32 be_get_msg_level(struct net_device *netdev)
...@@ -1042,7 +1042,7 @@ static int be_set_rss_hash_opts(struct be_adapter *adapter, ...@@ -1042,7 +1042,7 @@ static int be_set_rss_hash_opts(struct be_adapter *adapter,
if (!status) if (!status)
adapter->rss_info.rss_flags = rss_flags; adapter->rss_info.rss_flags = rss_flags;
return status; return be_cmd_status(status);
} }
static int be_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd) static int be_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
...@@ -1080,6 +1080,7 @@ static int be_set_channels(struct net_device *netdev, ...@@ -1080,6 +1080,7 @@ static int be_set_channels(struct net_device *netdev,
struct ethtool_channels *ch) struct ethtool_channels *ch)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int status;
if (ch->rx_count || ch->tx_count || ch->other_count || if (ch->rx_count || ch->tx_count || ch->other_count ||
!ch->combined_count || ch->combined_count > be_max_qs(adapter)) !ch->combined_count || ch->combined_count > be_max_qs(adapter))
...@@ -1087,7 +1088,8 @@ static int be_set_channels(struct net_device *netdev, ...@@ -1087,7 +1088,8 @@ static int be_set_channels(struct net_device *netdev,
adapter->cfg_num_qs = ch->combined_count; adapter->cfg_num_qs = ch->combined_count;
return be_update_queues(adapter); status = be_update_queues(adapter);
return be_cmd_status(status);
} }
static u32 be_get_rxfh_indir_size(struct net_device *netdev) static u32 be_get_rxfh_indir_size(struct net_device *netdev)
......
...@@ -81,10 +81,10 @@ static const char * const ue_status_low_desc[] = { ...@@ -81,10 +81,10 @@ static const char * const ue_status_low_desc[] = {
"P1_OB_LINK ", "P1_OB_LINK ",
"HOST_GPIO ", "HOST_GPIO ",
"MBOX ", "MBOX ",
"AXGMAC0", "ERX2 ",
"AXGMAC1", "SPARE ",
"JTAG", "JTAG ",
"MPU_INTPEND" "MPU_INTPEND "
}; };
/* UE Status High CSR */ /* UE Status High CSR */
static const char * const ue_status_hi_desc[] = { static const char * const ue_status_hi_desc[] = {
...@@ -109,16 +109,16 @@ static const char * const ue_status_hi_desc[] = { ...@@ -109,16 +109,16 @@ static const char * const ue_status_hi_desc[] = {
"HOST5", "HOST5",
"HOST6", "HOST6",
"HOST7", "HOST7",
"HOST8", "ECRC",
"HOST9", "Poison TLP",
"NETC", "NETC",
"Unknown", "PERIPH",
"Unknown", "LLTXULP",
"Unknown", "D2P",
"Unknown", "RCON",
"Unknown", "LDMA",
"Unknown", "LLTXP",
"Unknown", "LLTXPB",
"Unknown" "Unknown"
}; };
...@@ -1281,13 +1281,15 @@ static int be_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) ...@@ -1281,13 +1281,15 @@ static int be_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
vf + 1); vf + 1);
} }
if (status) if (status) {
dev_err(&adapter->pdev->dev, "MAC %pM set on VF %d Failed\n", dev_err(&adapter->pdev->dev, "MAC %pM set on VF %d Failed: %#x",
mac, vf); mac, vf, status);
else return be_cmd_status(status);
memcpy(vf_cfg->mac_addr, mac, ETH_ALEN); }
return status; ether_addr_copy(vf_cfg->mac_addr, mac);
return 0;
} }
static int be_get_vf_config(struct net_device *netdev, int vf, static int be_get_vf_config(struct net_device *netdev, int vf,
...@@ -1336,12 +1338,16 @@ static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) ...@@ -1336,12 +1338,16 @@ static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
vf + 1, vf_cfg->if_handle, 0); vf + 1, vf_cfg->if_handle, 0);
} }
if (!status) if (status) {
vf_cfg->vlan_tag = vlan; dev_err(&adapter->pdev->dev,
else "VLAN %d config on VF %d failed : %#x\n", vlan,
dev_info(&adapter->pdev->dev, vf, status);
"VLAN %d config on VF %d failed\n", vlan, vf); return be_cmd_status(status);
return status; }
vf_cfg->vlan_tag = vlan;
return 0;
} }
static int be_set_vf_tx_rate(struct net_device *netdev, int vf, static int be_set_vf_tx_rate(struct net_device *netdev, int vf,
...@@ -1372,7 +1378,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, int vf, ...@@ -1372,7 +1378,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, int vf,
if (!link_status) { if (!link_status) {
dev_err(dev, "TX-rate setting not allowed when link is down\n"); dev_err(dev, "TX-rate setting not allowed when link is down\n");
status = -EPERM; status = -ENETDOWN;
goto err; goto err;
} }
...@@ -1403,7 +1409,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, int vf, ...@@ -1403,7 +1409,7 @@ static int be_set_vf_tx_rate(struct net_device *netdev, int vf,
err: err:
dev_err(dev, "TX-rate setting of %dMbps on VF%d failed\n", dev_err(dev, "TX-rate setting of %dMbps on VF%d failed\n",
max_tx_rate, vf); max_tx_rate, vf);
return status; return be_cmd_status(status);
} }
static int be_set_vf_link_state(struct net_device *netdev, int vf, static int be_set_vf_link_state(struct net_device *netdev, int vf,
int link_state) int link_state)
...@@ -1418,10 +1424,15 @@ static int be_set_vf_link_state(struct net_device *netdev, int vf, ...@@ -1418,10 +1424,15 @@ static int be_set_vf_link_state(struct net_device *netdev, int vf,
return -EINVAL; return -EINVAL;
status = be_cmd_set_logical_link_config(adapter, link_state, vf+1); status = be_cmd_set_logical_link_config(adapter, link_state, vf+1);
if (!status) if (status) {
adapter->vf_cfg[vf].plink_tracking = link_state; dev_err(&adapter->pdev->dev,
"Link state change on VF %d failed: %#x\n", vf, status);
return be_cmd_status(status);
}
return status; adapter->vf_cfg[vf].plink_tracking = link_state;
return 0;
} }
static void be_aic_update(struct be_aic_obj *aic, u64 rx_pkts, u64 tx_pkts, static void be_aic_update(struct be_aic_obj *aic, u64 rx_pkts, u64 tx_pkts,
...@@ -2023,7 +2034,7 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo) ...@@ -2023,7 +2034,7 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo)
*/ */
for (;;) { for (;;) {
rxcp = be_rx_compl_get(rxo); rxcp = be_rx_compl_get(rxo);
if (rxcp == NULL) { if (!rxcp) {
if (lancer_chip(adapter)) if (lancer_chip(adapter))
break; break;
...@@ -2930,8 +2941,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable) ...@@ -2930,8 +2941,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config); cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config);
cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
GFP_KERNEL); GFP_KERNEL);
if (cmd.va == NULL) if (!cmd.va)
return -1; return -ENOMEM;
if (enable) { if (enable) {
status = pci_write_config_dword(adapter->pdev, status = pci_write_config_dword(adapter->pdev,
...@@ -3038,6 +3049,7 @@ static void be_vf_clear(struct be_adapter *adapter) ...@@ -3038,6 +3049,7 @@ static void be_vf_clear(struct be_adapter *adapter)
done: done:
kfree(adapter->vf_cfg); kfree(adapter->vf_cfg);
adapter->num_vfs = 0; adapter->num_vfs = 0;
adapter->flags &= ~BE_FLAGS_SRIOV_ENABLED;
} }
static void be_clear_queues(struct be_adapter *adapter) static void be_clear_queues(struct be_adapter *adapter)
...@@ -3230,6 +3242,8 @@ static int be_vf_setup(struct be_adapter *adapter) ...@@ -3230,6 +3242,8 @@ static int be_vf_setup(struct be_adapter *adapter)
goto err; goto err;
} }
} }
adapter->flags |= BE_FLAGS_SRIOV_ENABLED;
return 0; return 0;
err: err:
dev_err(dev, "VF setup failed\n"); dev_err(dev, "VF setup failed\n");
...@@ -3301,7 +3315,7 @@ static void BEx_get_resources(struct be_adapter *adapter, ...@@ -3301,7 +3315,7 @@ static void BEx_get_resources(struct be_adapter *adapter,
res->max_rx_qs = res->max_rss_qs + 1; res->max_rx_qs = res->max_rss_qs + 1;
if (be_physfn(adapter)) if (be_physfn(adapter))
res->max_evt_qs = (res->max_vfs > 0) ? res->max_evt_qs = (be_max_vfs(adapter) > 0) ?
BE3_SRIOV_MAX_EVT_QS : BE3_MAX_EVT_QS; BE3_SRIOV_MAX_EVT_QS : BE3_MAX_EVT_QS;
else else
res->max_evt_qs = 1; res->max_evt_qs = 1;
...@@ -3414,10 +3428,7 @@ static int be_get_config(struct be_adapter *adapter) ...@@ -3414,10 +3428,7 @@ static int be_get_config(struct be_adapter *adapter)
u16 profile_id; u16 profile_id;
int status; int status;
status = be_cmd_query_fw_cfg(adapter, &adapter->port_num, status = be_cmd_query_fw_cfg(adapter);
&adapter->function_mode,
&adapter->function_caps,
&adapter->asic_rev);
if (status) if (status)
return status; return status;
...@@ -3426,7 +3437,9 @@ static int be_get_config(struct be_adapter *adapter) ...@@ -3426,7 +3437,9 @@ static int be_get_config(struct be_adapter *adapter)
if (!status) if (!status)
dev_info(&adapter->pdev->dev, dev_info(&adapter->pdev->dev,
"Using profile 0x%x\n", profile_id); "Using profile 0x%x\n", profile_id);
}
if (!BE2_chip(adapter) && be_physfn(adapter)) {
status = be_get_sriov_config(adapter); status = be_get_sriov_config(adapter);
if (status) if (status)
return status; return status;
...@@ -3606,7 +3619,7 @@ static int be_setup(struct be_adapter *adapter) ...@@ -3606,7 +3619,7 @@ static int be_setup(struct be_adapter *adapter)
if (status) if (status)
goto err; goto err;
be_cmd_get_fw_ver(adapter, adapter->fw_ver, adapter->fw_on_flash); be_cmd_get_fw_ver(adapter);
if (BE2_chip(adapter) && fw_major_num(adapter->fw_ver) < 4) { if (BE2_chip(adapter) && fw_major_num(adapter->fw_ver) < 4) {
dev_err(dev, "Firmware on card is old(%s), IRQs may not work.", dev_err(dev, "Firmware on card is old(%s), IRQs may not work.",
...@@ -3956,7 +3969,7 @@ static int be_flash_skyhawk(struct be_adapter *adapter, ...@@ -3956,7 +3969,7 @@ static int be_flash_skyhawk(struct be_adapter *adapter,
fsec = get_fsec_info(adapter, filehdr_size + img_hdrs_size, fw); fsec = get_fsec_info(adapter, filehdr_size + img_hdrs_size, fw);
if (!fsec) { if (!fsec) {
dev_err(dev, "Invalid Cookie. FW image may be corrupted\n"); dev_err(dev, "Invalid Cookie. FW image may be corrupted\n");
return -1; return -EINVAL;
} }
for (i = 0; i < le32_to_cpu(fsec->fsec_hdr.num_images); i++) { for (i = 0; i < le32_to_cpu(fsec->fsec_hdr.num_images); i++) {
...@@ -4125,7 +4138,7 @@ static int lancer_fw_download(struct be_adapter *adapter, ...@@ -4125,7 +4138,7 @@ static int lancer_fw_download(struct be_adapter *adapter,
static int be_get_ufi_type(struct be_adapter *adapter, static int be_get_ufi_type(struct be_adapter *adapter,
struct flash_file_hdr_g3 *fhdr) struct flash_file_hdr_g3 *fhdr)
{ {
if (fhdr == NULL) if (!fhdr)
goto be_get_ufi_exit; goto be_get_ufi_exit;
if (skyhawk_chip(adapter) && fhdr->build[0] == '4') if (skyhawk_chip(adapter) && fhdr->build[0] == '4')
...@@ -4187,7 +4200,7 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) ...@@ -4187,7 +4200,7 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
&flash_cmd, &flash_cmd,
num_imgs); num_imgs);
else { else {
status = -1; status = -EINVAL;
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Can't load BE3 UFI on BE3R\n"); "Can't load BE3 UFI on BE3R\n");
} }
...@@ -4198,7 +4211,7 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) ...@@ -4198,7 +4211,7 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
if (ufi_type == UFI_TYPE2) if (ufi_type == UFI_TYPE2)
status = be_flash_BEx(adapter, fw, &flash_cmd, 0); status = be_flash_BEx(adapter, fw, &flash_cmd, 0);
else if (ufi_type == -1) else if (ufi_type == -1)
status = -1; status = -EINVAL;
dma_free_coherent(&adapter->pdev->dev, flash_cmd.size, flash_cmd.va, dma_free_coherent(&adapter->pdev->dev, flash_cmd.size, flash_cmd.va,
flash_cmd.dma); flash_cmd.dma);
...@@ -4221,7 +4234,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file) ...@@ -4221,7 +4234,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file)
if (!netif_running(adapter->netdev)) { if (!netif_running(adapter->netdev)) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Firmware load not allowed (interface is down)\n"); "Firmware load not allowed (interface is down)\n");
return -1; return -ENETDOWN;
} }
status = request_firmware(&fw, fw_file, &adapter->pdev->dev); status = request_firmware(&fw, fw_file, &adapter->pdev->dev);
...@@ -4236,8 +4249,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file) ...@@ -4236,8 +4249,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file)
status = be_fw_download(adapter, fw); status = be_fw_download(adapter, fw);
if (!status) if (!status)
be_cmd_get_fw_ver(adapter, adapter->fw_ver, be_cmd_get_fw_ver(adapter);
adapter->fw_on_flash);
fw_exit: fw_exit:
release_firmware(fw); release_firmware(fw);
...@@ -4468,12 +4480,12 @@ static int be_map_pci_bars(struct be_adapter *adapter) ...@@ -4468,12 +4480,12 @@ static int be_map_pci_bars(struct be_adapter *adapter)
if (BEx_chip(adapter) && be_physfn(adapter)) { if (BEx_chip(adapter) && be_physfn(adapter)) {
adapter->csr = pci_iomap(adapter->pdev, 2, 0); adapter->csr = pci_iomap(adapter->pdev, 2, 0);
if (adapter->csr == NULL) if (!adapter->csr)
return -ENOMEM; return -ENOMEM;
} }
addr = pci_iomap(adapter->pdev, db_bar(adapter), 0); addr = pci_iomap(adapter->pdev, db_bar(adapter), 0);
if (addr == NULL) if (!addr)
goto pci_map_err; goto pci_map_err;
adapter->db = addr; adapter->db = addr;
...@@ -4536,7 +4548,7 @@ static int be_ctrl_init(struct be_adapter *adapter) ...@@ -4536,7 +4548,7 @@ static int be_ctrl_init(struct be_adapter *adapter)
rx_filter->va = dma_zalloc_coherent(&adapter->pdev->dev, rx_filter->va = dma_zalloc_coherent(&adapter->pdev->dev,
rx_filter->size, &rx_filter->dma, rx_filter->size, &rx_filter->dma,
GFP_KERNEL); GFP_KERNEL);
if (rx_filter->va == NULL) { if (!rx_filter->va) {
status = -ENOMEM; status = -ENOMEM;
goto free_mbox; goto free_mbox;
} }
...@@ -4585,8 +4597,8 @@ static int be_stats_init(struct be_adapter *adapter) ...@@ -4585,8 +4597,8 @@ static int be_stats_init(struct be_adapter *adapter)
cmd->va = dma_zalloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, cmd->va = dma_zalloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma,
GFP_KERNEL); GFP_KERNEL);
if (cmd->va == NULL) if (!cmd->va)
return -1; return -ENOMEM;
return 0; return 0;
} }
...@@ -4807,7 +4819,7 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) ...@@ -4807,7 +4819,7 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
pci_set_master(pdev); pci_set_master(pdev);
netdev = alloc_etherdev_mqs(sizeof(*adapter), MAX_TX_QS, MAX_RX_QS); netdev = alloc_etherdev_mqs(sizeof(*adapter), MAX_TX_QS, MAX_RX_QS);
if (netdev == NULL) { if (!netdev) {
status = -ENOMEM; status = -ENOMEM;
goto rel_reg; goto rel_reg;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment