Commit 1ab8c11f authored by David S. Miller's avatar David S. Miller

Merge branch 'be2net-next'

Sathya Perla says:

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

The following patch set contains some feature additions, code re-organization
and cleanup and a few non-critical fixes. Pls consider applying this to
the net-next tree. Thanks.

v3 changes: add a default case to the switch statement in patch 5 to
satisfy the compiler (-Wswitch).
v2 changes: replaced an if/else block that checks for error values with a
switch/case statement in patch 5.

Patch 1 fixes VF link state transition from disabled to auto that did
not work due to an issue in the FW. This issue could not be fixed in FW due
to some backward compatibility issues it causes with released drivers.
The issue has been fixed by introducing a new version (v2) of the cmd
from 10.6 FW onwards. This patch adds support for v2 version of this cmd.

Patch 2 reports a EOPNOTSUPP status to ethtool when the user tries to
configure BE3/SRIOV in VEPA mode as it is not supported by the chip.

Patch 3 cleansup FW flash image related constant definitions. Many of these
definitions (such as section offset values) were defined in decimal format
rather than hexa-decimal. This makes this part of the code un-readable.
Also some defines related to BE2 are labeld "g2" and defines related to BE3
are labeled "g3".  This patch cleans up all of this to make this code more
readable.

Patch 4 moves the FW cmd code to be_cmds.c. All code relating to FW cmds
has been in be_cmds.[ch], excepting FW flash cmd related code.
This patch moves these routines from be_main.c to be_cmds.c.

Patch 5 adds a log message to report digital signature errors while
flashing a FW image. From FW version 11.0 onwards, the FW supports a new
"secure mode" feature (based on a jumper setting on the adapter.) In this
mode, the FW image when flashed is authenticated with a digital signature.

Patch 6 removes a line of code that has no effect.

Patch 7 removes some unused variables.

Patch 8 fixes port resource descriptor query via the GET_PROFILE FW cmd.
An earlier commit passed a specific pf_num while issuing this cmd as FW
returns descriptors for all functions when pf_num is zero. But, when pf_num
is set to a non-zero value, FW does not return the port resource descriptor.
This patch fixes this by setting pf_num to 0 while issuing the query cmd
and adds code to pick the correct NIC resource descriptor from the list of
descriptors returned by FW.

Patch 9 adds support for ethtool get-dump feature. In the past when this
option was not yet available, this feature was supported via the
--register-dump option as a workaround.  This patch removes support for
FW-dump via --register-dump option as it is now available via --get-dump
option. Even though the "ethtool --register-dump" cmd which used to work
earlier, will now fail with ENOTSUPP error, we feel it is not an issue as
this is used only for diagnostics purpose.

Patch 10 bumps up the driver version.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents da0bcb4e ab07ead5
......@@ -37,7 +37,7 @@
#include "be_hw.h"
#include "be_roce.h"
#define DRV_VER "10.6.0.3"
#define DRV_VER "11.0.0.0"
#define DRV_NAME "be2net"
#define BE_NAME "Emulex BladeEngine2"
#define BE3_NAME "Emulex BladeEngine3"
......@@ -521,7 +521,7 @@ struct be_adapter {
struct be_drv_stats drv_stats;
struct be_aic_obj aic_obj[MAX_EVT_QS];
u8 vlan_prio_bmap; /* Available Priority BitMap */
u16 recommended_prio; /* Recommended Priority */
u16 recommended_prio_bits;/* Recommended Priority bits in vlan tag */
struct be_dma_mem rx_filter; /* Cmd DMA mem for rx-filter */
struct be_dma_mem stats_cmd;
......@@ -547,10 +547,6 @@ struct be_adapter {
u32 beacon_state; /* for set_phys_id */
bool eeh_error;
bool fw_timeout;
bool hw_error;
u32 port_num;
char port_name;
u8 mc_type;
......@@ -574,6 +570,8 @@ struct be_adapter {
struct be_resources pool_res; /* resources available for the port */
struct be_resources res; /* resources available for the func */
u16 num_vfs; /* Number of VFs provisioned by PF */
u8 pf_num; /* Numbering used by FW, starts at 0 */
u8 vf_num; /* Numbering used by FW, starts at 1 */
u8 virtfn;
struct be_vf_cfg *vf_cfg;
bool be3_native;
......@@ -591,11 +589,10 @@ struct be_adapter {
u32 msg_enable;
int be_get_temp_freq;
struct be_hwmon hwmon_info;
u8 pf_number;
u8 pci_func_num;
struct rss_info rss_info;
/* Filters for packets that need to be sent to BMC */
u32 bmc_filt_mask;
u32 fat_dump_len;
u16 serial_num[CNTL_SERIAL_NUM_WORDS];
};
......
This diff is collapsed.
......@@ -66,7 +66,9 @@ enum mcc_addl_status {
MCC_ADDL_STATUS_INSUFFICIENT_RESOURCES = 0x16,
MCC_ADDL_STATUS_FLASH_IMAGE_CRC_MISMATCH = 0x4d,
MCC_ADDL_STATUS_TOO_MANY_INTERFACES = 0x4a,
MCC_ADDL_STATUS_INSUFFICIENT_VLANS = 0xab
MCC_ADDL_STATUS_INSUFFICIENT_VLANS = 0xab,
MCC_ADDL_STATUS_INVALID_SIGNATURE = 0x56,
MCC_ADDL_STATUS_MISSING_SIGNATURE = 0x57
};
#define CQE_BASE_STATUS_MASK 0xFFFF
......@@ -289,9 +291,7 @@ struct be_cmd_req_hdr {
u32 timeout; /* dword 1 */
u32 request_length; /* dword 2 */
u8 version; /* dword 3 */
u8 rsvd1; /* dword 3 */
u8 pf_num; /* dword 3 */
u8 rsvd2; /* dword 3 */
u8 rsvd[3]; /* dword 3 */
};
#define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
......@@ -1207,68 +1207,85 @@ struct be_cmd_resp_get_beacon_state {
/* Flashrom related descriptors */
#define MAX_FLASH_COMP 32
#define OPTYPE_ISCSI_ACTIVE 0
#define OPTYPE_REDBOOT 1
#define OPTYPE_BIOS 2
#define OPTYPE_PXE_BIOS 3
#define OPTYPE_OFFSET_SPECIFIED 7
#define OPTYPE_FCOE_BIOS 8
#define OPTYPE_ISCSI_BACKUP 9
#define OPTYPE_FCOE_FW_ACTIVE 10
#define OPTYPE_FCOE_FW_BACKUP 11
#define OPTYPE_NCSI_FW 13
#define OPTYPE_REDBOOT_DIR 18
#define OPTYPE_REDBOOT_CONFIG 19
#define OPTYPE_SH_PHY_FW 21
#define OPTYPE_FLASHISM_JUMPVECTOR 22
#define OPTYPE_UFI_DIR 23
#define OPTYPE_PHY_FW 99
#define FLASH_BIOS_IMAGE_MAX_SIZE_g2 262144 /* Max OPTION ROM image sz */
#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 262144 /* Max Redboot image sz */
#define FLASH_IMAGE_MAX_SIZE_g2 1310720 /* Max firmware image size */
#define FLASH_NCSI_IMAGE_MAX_SIZE_g3 262144
#define FLASH_PHY_FW_IMAGE_MAX_SIZE_g3 262144
#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 524288 /* Max OPTION ROM image sz */
#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 1048576 /* Max Redboot image sz */
#define FLASH_IMAGE_MAX_SIZE_g3 2097152 /* Max firmware image size */
/* Offsets for components on Flash. */
#define FLASH_REDBOOT_START_g2 0
#define FLASH_FCoE_BIOS_START_g2 524288
#define FLASH_iSCSI_PRIMARY_IMAGE_START_g2 1048576
#define FLASH_iSCSI_BACKUP_IMAGE_START_g2 2359296
#define FLASH_FCoE_PRIMARY_IMAGE_START_g2 3670016
#define FLASH_FCoE_BACKUP_IMAGE_START_g2 4980736
#define FLASH_iSCSI_BIOS_START_g2 7340032
#define FLASH_PXE_BIOS_START_g2 7864320
#define FLASH_REDBOOT_START_g3 262144
#define FLASH_PHY_FW_START_g3 1310720
#define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 2097152
#define FLASH_iSCSI_BACKUP_IMAGE_START_g3 4194304
#define FLASH_FCoE_PRIMARY_IMAGE_START_g3 6291456
#define FLASH_FCoE_BACKUP_IMAGE_START_g3 8388608
#define FLASH_iSCSI_BIOS_START_g3 12582912
#define FLASH_PXE_BIOS_START_g3 13107200
#define FLASH_FCoE_BIOS_START_g3 13631488
#define FLASH_NCSI_START_g3 15990784
#define IMAGE_NCSI 16
#define IMAGE_OPTION_ROM_PXE 32
#define IMAGE_OPTION_ROM_FCoE 33
#define IMAGE_OPTION_ROM_ISCSI 34
#define IMAGE_FLASHISM_JUMPVECTOR 48
#define IMAGE_FIRMWARE_iSCSI 160
#define IMAGE_FIRMWARE_FCoE 162
#define IMAGE_FIRMWARE_BACKUP_iSCSI 176
#define IMAGE_FIRMWARE_BACKUP_FCoE 178
#define IMAGE_FIRMWARE_PHY 192
#define IMAGE_REDBOOT_DIR 208
#define IMAGE_REDBOOT_CONFIG 209
#define IMAGE_UFI_DIR 210
#define IMAGE_BOOT_CODE 224
/* Optypes of each component in the UFI */
enum {
OPTYPE_ISCSI_ACTIVE = 0,
OPTYPE_REDBOOT = 1,
OPTYPE_BIOS = 2,
OPTYPE_PXE_BIOS = 3,
OPTYPE_OFFSET_SPECIFIED = 7,
OPTYPE_FCOE_BIOS = 8,
OPTYPE_ISCSI_BACKUP = 9,
OPTYPE_FCOE_FW_ACTIVE = 10,
OPTYPE_FCOE_FW_BACKUP = 11,
OPTYPE_NCSI_FW = 13,
OPTYPE_REDBOOT_DIR = 18,
OPTYPE_REDBOOT_CONFIG = 19,
OPTYPE_SH_PHY_FW = 21,
OPTYPE_FLASHISM_JUMPVECTOR = 22,
OPTYPE_UFI_DIR = 23,
OPTYPE_PHY_FW = 99
};
/* Maximum sizes of components in BE2 FW UFI */
enum {
BE2_BIOS_COMP_MAX_SIZE = 0x40000,
BE2_REDBOOT_COMP_MAX_SIZE = 0x40000,
BE2_COMP_MAX_SIZE = 0x140000
};
/* Maximum sizes of components in BE3 FW UFI */
enum {
BE3_NCSI_COMP_MAX_SIZE = 0x40000,
BE3_PHY_FW_COMP_MAX_SIZE = 0x40000,
BE3_BIOS_COMP_MAX_SIZE = 0x80000,
BE3_REDBOOT_COMP_MAX_SIZE = 0x100000,
BE3_COMP_MAX_SIZE = 0x200000
};
/* Offsets for components in BE2 FW UFI */
enum {
BE2_REDBOOT_START = 0x8000,
BE2_FCOE_BIOS_START = 0x80000,
BE2_ISCSI_PRIMARY_IMAGE_START = 0x100000,
BE2_ISCSI_BACKUP_IMAGE_START = 0x240000,
BE2_FCOE_PRIMARY_IMAGE_START = 0x380000,
BE2_FCOE_BACKUP_IMAGE_START = 0x4c0000,
BE2_ISCSI_BIOS_START = 0x700000,
BE2_PXE_BIOS_START = 0x780000
};
/* Offsets for components in BE3 FW UFI */
enum {
BE3_REDBOOT_START = 0x40000,
BE3_PHY_FW_START = 0x140000,
BE3_ISCSI_PRIMARY_IMAGE_START = 0x200000,
BE3_ISCSI_BACKUP_IMAGE_START = 0x400000,
BE3_FCOE_PRIMARY_IMAGE_START = 0x600000,
BE3_FCOE_BACKUP_IMAGE_START = 0x800000,
BE3_ISCSI_BIOS_START = 0xc00000,
BE3_PXE_BIOS_START = 0xc80000,
BE3_FCOE_BIOS_START = 0xd00000,
BE3_NCSI_START = 0xf40000
};
/* Component entry types */
enum {
IMAGE_NCSI = 0x10,
IMAGE_OPTION_ROM_PXE = 0x20,
IMAGE_OPTION_ROM_FCOE = 0x21,
IMAGE_OPTION_ROM_ISCSI = 0x22,
IMAGE_FLASHISM_JUMPVECTOR = 0x30,
IMAGE_FIRMWARE_ISCSI = 0xa0,
IMAGE_FIRMWARE_FCOE = 0xa2,
IMAGE_FIRMWARE_BACKUP_ISCSI = 0xb0,
IMAGE_FIRMWARE_BACKUP_FCOE = 0xb2,
IMAGE_FIRMWARE_PHY = 0xc0,
IMAGE_REDBOOT_DIR = 0xd0,
IMAGE_REDBOOT_CONFIG = 0xd1,
IMAGE_UFI_DIR = 0xd2,
IMAGE_BOOT_CODE = 0xe2
};
struct controller_id {
u32 vendor;
......@@ -1394,6 +1411,9 @@ struct be_cmd_read_flash_crc {
} __packed;
/**************** Lancer Firmware Flash ************/
#define LANCER_FW_DOWNLOAD_CHUNK (32 * 1024)
#define LANCER_FW_DOWNLOAD_LOCATION "/prg"
struct amap_lancer_write_obj_context {
u8 write_length[24];
u8 reserved1[7];
......@@ -1654,11 +1674,7 @@ struct mgmt_hba_attribs {
struct mgmt_controller_attrib {
struct mgmt_hba_attribs hba_attribs;
u32 rsvd0[2];
u16 rsvd1;
u8 pci_func_num;
u8 rsvd2;
u32 rsvd3[7];
u32 rsvd0[10];
} __packed;
struct be_cmd_req_cntl_attribs {
......@@ -2083,6 +2099,7 @@ struct be_port_res_desc {
#define NV_TYPE_VXLAN 3
#define SOCVID_SHIFT 2 /* Strip outer vlan */
#define RCVID_SHIFT 4 /* Report vlan */
#define PF_NUM_IGNORE 255
u8 nv_flags;
u8 rsvd2;
__le16 nv_port; /* vxlan/gre port */
......@@ -2246,7 +2263,8 @@ struct be_cmd_resp_get_iface_list {
};
/*************** Set logical link ********************/
#define PLINK_TRACK_SHIFT 8
#define PLINK_ENABLE BIT(0)
#define PLINK_TRACK BIT(8)
struct be_cmd_req_set_ll_link {
struct be_cmd_req_hdr hdr;
u32 link_config; /* Bit 0: UP_DOWN, Bit 9: PLINK */
......@@ -2321,19 +2339,11 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter,
u8 page_num, u8 *data);
int be_cmd_query_cable_type(struct be_adapter *adapter);
int be_cmd_query_sfp_info(struct be_adapter *adapter);
int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 flash_oper, u32 flash_opcode, u32 img_offset,
u32 buf_size);
int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 data_size, u32 data_offset,
const char *obj_name, u32 *data_written,
u8 *change_status, u8 *addn_status);
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_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,
u16 img_optype, u32 img_offset, u32 crc_offset);
int lancer_fw_download(struct be_adapter *adapter, const struct firmware *fw);
int be_fw_download(struct be_adapter *adapter, const struct firmware *fw);
int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
struct be_dma_mem *nonemb_cmd);
int be_cmd_fw_init(struct be_adapter *adapter);
......@@ -2355,9 +2365,9 @@ int be_cmd_config_qos(struct be_adapter *adapter, u32 max_rate,
void be_detect_error(struct be_adapter *adapter);
int be_cmd_get_die_temperature(struct be_adapter *adapter);
int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
int be_cmd_get_fat_dump_len(struct be_adapter *adapter, u32 *dump_size);
int be_cmd_get_fat_dump(struct be_adapter *adapter, u32 buf_len, void *buf);
int be_cmd_req_native_mode(struct be_adapter *adapter);
int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size);
int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);
int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
u32 domain);
int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,
......
......@@ -250,6 +250,19 @@ static u32 lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name)
return data_read;
}
static int be_get_dump_len(struct be_adapter *adapter)
{
u32 dump_size = 0;
if (lancer_chip(adapter))
dump_size = lancer_cmd_get_file_len(adapter,
LANCER_FW_DUMP_FILE);
else
dump_size = adapter->fat_dump_len;
return dump_size;
}
static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
u32 buf_len, void *buf)
{
......@@ -291,37 +304,18 @@ static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
return status;
}
static int be_get_reg_len(struct net_device *netdev)
static int be_read_dump_data(struct be_adapter *adapter, u32 dump_len,
void *buf)
{
struct be_adapter *adapter = netdev_priv(netdev);
u32 log_size = 0;
if (!check_privilege(adapter, MAX_PRIVILEGES))
return 0;
int status = 0;
if (be_physfn(adapter)) {
if (lancer_chip(adapter))
log_size = lancer_cmd_get_file_len(adapter,
LANCER_FW_DUMP_FILE);
status = lancer_cmd_read_file(adapter, LANCER_FW_DUMP_FILE,
dump_len, buf);
else
be_cmd_get_reg_len(adapter, &log_size);
}
return log_size;
}
status = be_cmd_get_fat_dump(adapter, dump_len, buf);
static void
be_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *buf)
{
struct be_adapter *adapter = netdev_priv(netdev);
if (be_physfn(adapter)) {
memset(buf, 0, regs->len);
if (lancer_chip(adapter))
lancer_cmd_read_file(adapter, LANCER_FW_DUMP_FILE,
regs->len, buf);
else
be_cmd_get_regs(adapter, regs->len, buf);
}
return status;
}
static int be_get_coalesce(struct net_device *netdev,
......@@ -914,6 +908,34 @@ static int be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
return be_load_fw(adapter, efl->data);
}
static int
be_get_dump_flag(struct net_device *netdev, struct ethtool_dump *dump)
{
struct be_adapter *adapter = netdev_priv(netdev);
if (!check_privilege(adapter, MAX_PRIVILEGES))
return -EOPNOTSUPP;
dump->len = be_get_dump_len(adapter);
dump->version = 1;
dump->flag = 0x1; /* FW dump is enabled */
return 0;
}
static int
be_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump,
void *buf)
{
struct be_adapter *adapter = netdev_priv(netdev);
int status;
if (!check_privilege(adapter, MAX_PRIVILEGES))
return -EOPNOTSUPP;
status = be_read_dump_data(adapter, dump->len, buf);
return be_cmd_status(status);
}
static int be_get_eeprom_len(struct net_device *netdev)
{
struct be_adapter *adapter = netdev_priv(netdev);
......@@ -1311,8 +1333,6 @@ const struct ethtool_ops be_ethtool_ops = {
.set_msglevel = be_set_msg_level,
.get_sset_count = be_get_sset_count,
.get_ethtool_stats = be_get_ethtool_stats,
.get_regs_len = be_get_reg_len,
.get_regs = be_get_regs,
.flash_device = be_do_flash,
.self_test = be_self_test,
.get_rxnfc = be_get_rxnfc,
......@@ -1321,6 +1341,8 @@ const struct ethtool_ops be_ethtool_ops = {
.get_rxfh_key_size = be_get_rxfh_key_size,
.get_rxfh = be_get_rxfh,
.set_rxfh = be_set_rxfh,
.get_dump_flag = be_get_dump_flag,
.get_dump_data = be_get_dump_data,
.get_channels = be_get_channels,
.set_channels = be_set_channels,
.get_module_info = be_get_module_info,
......
This diff is collapsed.
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