Commit 58e70b59 authored by David S. Miller's avatar David S. Miller

Merge branch 'be2net-next'

Sathya Perla says:

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

Patch 1 fixes a regression caused by a previous commit on net-next.
Old versions of BE3 FW may not support cmds to re-provision (and hence
optimize) resources/queues in SR-IOV config. Do not treat this FW cmd
failure as fatal and fail the function initialization. Instead, just
enable SR-IOV with the resources provided by the FW.

Patch 2 ignores a VF mac address setting if the new mac is already active
on the VF.

Patch 3 adds support to delete a FW-dump via ethtool on Lancer adapters.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7e32aa4d f0613380
...@@ -383,8 +383,10 @@ enum vf_state { ...@@ -383,8 +383,10 @@ enum vf_state {
#define BE_UC_PMAC_COUNT 30 #define BE_UC_PMAC_COUNT 30
#define BE_VF_UC_PMAC_COUNT 2 #define BE_VF_UC_PMAC_COUNT 2
/* Ethtool set_dump flags */ /* Ethtool set_dump flags */
#define LANCER_INITIATE_FW_DUMP 0x1 #define LANCER_INITIATE_FW_DUMP 0x1
#define LANCER_DELETE_FW_DUMP 0x2
struct phy_info { struct phy_info {
u8 transceiver; u8 transceiver;
......
...@@ -2240,6 +2240,34 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2240,6 +2240,34 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
return status; return status;
} }
int lancer_cmd_delete_object(struct be_adapter *adapter, const char *obj_name)
{
struct lancer_cmd_req_delete_object *req;
struct be_mcc_wrb *wrb;
int status;
spin_lock_bh(&adapter->mcc_lock);
wrb = wrb_from_mccq(adapter);
if (!wrb) {
status = -EBUSY;
goto err;
}
req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_DELETE_OBJECT,
sizeof(*req), wrb, NULL);
strcpy(req->object_name, obj_name);
status = be_mcc_notify_wait(adapter);
err:
spin_unlock_bh(&adapter->mcc_lock);
return status;
}
int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 data_size, u32 data_offset, const char *obj_name, u32 data_size, u32 data_offset, const char *obj_name,
u32 *data_read, u32 *eof, u8 *addn_status) u32 *data_read, u32 *eof, u8 *addn_status)
...@@ -3805,13 +3833,19 @@ bool dump_present(struct be_adapter *adapter) ...@@ -3805,13 +3833,19 @@ bool dump_present(struct be_adapter *adapter)
int lancer_initiate_dump(struct be_adapter *adapter) int lancer_initiate_dump(struct be_adapter *adapter)
{ {
struct device *dev = &adapter->pdev->dev;
int status; int status;
if (dump_present(adapter)) {
dev_info(dev, "Previous dump not cleared, not forcing dump\n");
return -EEXIST;
}
/* give firmware reset and diagnostic dump */ /* give firmware reset and diagnostic dump */
status = lancer_physdev_ctrl(adapter, PHYSDEV_CONTROL_FW_RESET_MASK | status = lancer_physdev_ctrl(adapter, PHYSDEV_CONTROL_FW_RESET_MASK |
PHYSDEV_CONTROL_DD_MASK); PHYSDEV_CONTROL_DD_MASK);
if (status < 0) { if (status < 0) {
dev_err(&adapter->pdev->dev, "Firmware reset failed\n"); dev_err(dev, "FW reset failed\n");
return status; return status;
} }
...@@ -3820,13 +3854,21 @@ int lancer_initiate_dump(struct be_adapter *adapter) ...@@ -3820,13 +3854,21 @@ int lancer_initiate_dump(struct be_adapter *adapter)
return status; return status;
if (!dump_present(adapter)) { if (!dump_present(adapter)) {
dev_err(&adapter->pdev->dev, "Dump image not present\n"); dev_err(dev, "FW dump not generated\n");
return -1; return -EIO;
} }
return 0; return 0;
} }
int lancer_delete_dump(struct be_adapter *adapter)
{
int status;
status = lancer_cmd_delete_object(adapter, LANCER_FW_DUMP_FILE);
return be_cmd_status(status);
}
/* Uses sync mcc */ /* Uses sync mcc */
int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain) int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain)
{ {
......
...@@ -231,6 +231,7 @@ struct be_mcc_mailbox { ...@@ -231,6 +231,7 @@ struct be_mcc_mailbox {
#define OPCODE_COMMON_GET_FN_PRIVILEGES 170 #define OPCODE_COMMON_GET_FN_PRIVILEGES 170
#define OPCODE_COMMON_READ_OBJECT 171 #define OPCODE_COMMON_READ_OBJECT 171
#define OPCODE_COMMON_WRITE_OBJECT 172 #define OPCODE_COMMON_WRITE_OBJECT 172
#define OPCODE_COMMON_DELETE_OBJECT 174
#define OPCODE_COMMON_MANAGE_IFACE_FILTERS 193 #define OPCODE_COMMON_MANAGE_IFACE_FILTERS 193
#define OPCODE_COMMON_GET_IFACE_LIST 194 #define OPCODE_COMMON_GET_IFACE_LIST 194
#define OPCODE_COMMON_ENABLE_DISABLE_VF 196 #define OPCODE_COMMON_ENABLE_DISABLE_VF 196
...@@ -1253,6 +1254,13 @@ struct lancer_cmd_resp_read_object { ...@@ -1253,6 +1254,13 @@ struct lancer_cmd_resp_read_object {
u32 eof; u32 eof;
}; };
struct lancer_cmd_req_delete_object {
struct be_cmd_req_hdr hdr;
u32 rsvd1;
u32 rsvd2;
u8 object_name[104];
};
/************************ WOL *******************************/ /************************ WOL *******************************/
struct be_cmd_req_acpi_wol_magic_config{ struct be_cmd_req_acpi_wol_magic_config{
struct be_cmd_req_hdr hdr; struct be_cmd_req_hdr hdr;
...@@ -2067,6 +2075,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2067,6 +2075,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 data_size, u32 data_offset, const char *obj_name, u32 data_size, u32 data_offset, const char *obj_name,
u32 *data_read, u32 *eof, u8 *addn_status); u32 *data_read, u32 *eof, u8 *addn_status);
int lancer_cmd_delete_object(struct be_adapter *adapter, const char *obj_name);
int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
u16 optype, int offset); u16 optype, int offset);
int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
...@@ -2120,6 +2129,7 @@ int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter, ...@@ -2120,6 +2129,7 @@ int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter,
struct be_fat_conf_params *cfgs); struct be_fat_conf_params *cfgs);
int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask); int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask);
int lancer_initiate_dump(struct be_adapter *adapter); int lancer_initiate_dump(struct be_adapter *adapter);
int lancer_delete_dump(struct be_adapter *adapter);
bool dump_present(struct be_adapter *adapter); bool dump_present(struct be_adapter *adapter);
int lancer_test_and_set_rdy_state(struct be_adapter *adapter); int lancer_test_and_set_rdy_state(struct be_adapter *adapter);
int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name); int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name);
......
...@@ -681,21 +681,20 @@ static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump) ...@@ -681,21 +681,20 @@ static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump)
struct device *dev = &adapter->pdev->dev; struct device *dev = &adapter->pdev->dev;
int status; int status;
if (!lancer_chip(adapter)) { if (!lancer_chip(adapter) ||
dev_err(dev, "FW dump not supported\n"); !check_privilege(adapter, MAX_PRIVILEGES))
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
if (dump_present(adapter)) {
dev_err(dev, "Previous dump not cleared, not forcing dump\n");
return 0;
}
switch (dump->flag) { switch (dump->flag) {
case LANCER_INITIATE_FW_DUMP: case LANCER_INITIATE_FW_DUMP:
status = lancer_initiate_dump(adapter); status = lancer_initiate_dump(adapter);
if (!status) if (!status)
dev_info(dev, "F/w dump initiated successfully\n"); dev_info(dev, "FW dump initiated successfully\n");
break;
case LANCER_DELETE_FW_DUMP:
status = lancer_delete_dump(adapter);
if (!status)
dev_info(dev, "FW dump deleted successfully\n");
break; break;
default: default:
dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag); dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag);
......
...@@ -1270,6 +1270,12 @@ static int be_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) ...@@ -1270,6 +1270,12 @@ static int be_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
if (!is_valid_ether_addr(mac) || vf >= adapter->num_vfs) if (!is_valid_ether_addr(mac) || vf >= adapter->num_vfs)
return -EINVAL; return -EINVAL;
/* Proceed further only if user provided MAC is different
* from active MAC
*/
if (ether_addr_equal(mac, vf_cfg->mac_addr))
return 0;
if (BEx_chip(adapter)) { if (BEx_chip(adapter)) {
be_cmd_pmac_del(adapter, vf_cfg->if_handle, vf_cfg->pmac_id, be_cmd_pmac_del(adapter, vf_cfg->if_handle, vf_cfg->pmac_id,
vf + 1); vf + 1);
...@@ -3342,22 +3348,17 @@ static int be_get_sriov_config(struct be_adapter *adapter) ...@@ -3342,22 +3348,17 @@ static int be_get_sriov_config(struct be_adapter *adapter)
{ {
struct device *dev = &adapter->pdev->dev; struct device *dev = &adapter->pdev->dev;
struct be_resources res = {0}; struct be_resources res = {0};
int status, max_vfs, old_vfs; int max_vfs, old_vfs;
status = be_cmd_get_profile_config(adapter, &res, 0);
if (status)
return status;
adapter->pool_res = res;
/* Some old versions of BE3 FW don't report max_vfs value */ /* Some old versions of BE3 FW don't report max_vfs value */
be_cmd_get_profile_config(adapter, &res, 0);
if (BE3_chip(adapter) && !res.max_vfs) { if (BE3_chip(adapter) && !res.max_vfs) {
max_vfs = pci_sriov_get_totalvfs(adapter->pdev); max_vfs = pci_sriov_get_totalvfs(adapter->pdev);
res.max_vfs = max_vfs > 0 ? min(MAX_VFS, max_vfs) : 0; res.max_vfs = max_vfs > 0 ? min(MAX_VFS, max_vfs) : 0;
} }
adapter->pool_res.max_vfs = res.max_vfs; adapter->pool_res = res;
pci_sriov_set_totalvfs(adapter->pdev, be_max_vfs(adapter));
if (!be_max_vfs(adapter)) { if (!be_max_vfs(adapter)) {
if (num_vfs) if (num_vfs)
...@@ -3366,6 +3367,8 @@ static int be_get_sriov_config(struct be_adapter *adapter) ...@@ -3366,6 +3367,8 @@ static int be_get_sriov_config(struct be_adapter *adapter)
return 0; return 0;
} }
pci_sriov_set_totalvfs(adapter->pdev, be_max_vfs(adapter));
/* validate num_vfs module param */ /* validate num_vfs module param */
old_vfs = pci_num_vf(adapter->pdev); old_vfs = pci_num_vf(adapter->pdev);
if (old_vfs) { if (old_vfs) {
...@@ -3423,26 +3426,17 @@ static int be_get_resources(struct be_adapter *adapter) ...@@ -3423,26 +3426,17 @@ static int be_get_resources(struct be_adapter *adapter)
return 0; return 0;
} }
static int be_get_config(struct be_adapter *adapter) static void be_sriov_config(struct be_adapter *adapter)
{ {
u16 profile_id; struct device *dev = &adapter->pdev->dev;
int status; int status;
status = be_cmd_query_fw_cfg(adapter);
if (status)
return status;
if (be_physfn(adapter)) {
status = be_cmd_get_active_profile(adapter, &profile_id);
if (!status)
dev_info(&adapter->pdev->dev,
"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; dev_err(dev, "Failed to query SR-IOV configuration\n");
dev_err(dev, "SR-IOV cannot be enabled\n");
return;
}
/* When the HW is in SRIOV capable configuration, the PF-pool /* When the HW is in SRIOV capable configuration, the PF-pool
* resources are equally distributed across the max-number of * resources are equally distributed across the max-number of
...@@ -3452,15 +3446,34 @@ static int be_get_config(struct be_adapter *adapter) ...@@ -3452,15 +3446,34 @@ static int be_get_config(struct be_adapter *adapter)
* resources. This facility is not available in BE3 FW. * resources. This facility is not available in BE3 FW.
* Also, this is done by FW in Lancer chip. * Also, this is done by FW in Lancer chip.
*/ */
if (!pci_num_vf(adapter->pdev)) { if (be_max_vfs(adapter) && !pci_num_vf(adapter->pdev)) {
status = be_cmd_set_sriov_config(adapter, status = be_cmd_set_sriov_config(adapter,
adapter->pool_res, adapter->pool_res,
adapter->num_vfs); adapter->num_vfs);
if (status) if (status)
return status; dev_err(dev, "Failed to optimize SR-IOV resources\n");
} }
}
static int be_get_config(struct be_adapter *adapter)
{
u16 profile_id;
int status;
status = be_cmd_query_fw_cfg(adapter);
if (status)
return status;
if (be_physfn(adapter)) {
status = be_cmd_get_active_profile(adapter, &profile_id);
if (!status)
dev_info(&adapter->pdev->dev,
"Using profile 0x%x\n", profile_id);
} }
if (!BE2_chip(adapter) && be_physfn(adapter))
be_sriov_config(adapter);
status = be_get_resources(adapter); status = be_get_resources(adapter);
if (status) if (status)
return status; return status;
......
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