Skip to content

Commit

Permalink
bnxt_en: New Broadcom ethernet driver.
Browse files Browse the repository at this point in the history
Broadcom ethernet driver for the new family of NetXtreme-C/E
ethernet devices.

v5:
  - Removed empty blank lines at end of files (noted by David Miller).
  - Moved busy poll helper functions to bnxt.h to at least make the
    .c file look less cluttered with #ifdef (noted by Stephen Hemminger).

v4:
  - Broke up 2 long message strings with "\n" (suggested by John Linville)
  - Constify an array of strings (suggested by Stephen Hemminger)
  - Improve bnxt_vf_pciid() (suggested by Stephen Hemminger)
  - Use PCI_VDEVICE() to populate pci_device_id table for more compact
    source.

v3:
  - Fixed 2 more sparse warnings.
  - Removed some unused structures in .h files.

v2:
  - Fixed all kbuild test robot reported warnings.
  - Fixed many of the checkpatch.pl errors and warnings.
  - Fixed the Kconfig description (noted by Dmitry Kravkov).

Acked-by: Eddie Wai <[email protected]>
Acked-by: Jeffrey Huang <[email protected]>
Signed-off-by: Prashant Sreedharan <[email protected]>
Signed-off-by: Michael Chan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Michael Chan authored and davem330 committed Oct 23, 2015
1 parent 0a31ada commit c0c050c
Showing 12 changed files with 13,034 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/net/ethernet/broadcom/Kconfig
Original file line number Diff line number Diff line change
@@ -170,4 +170,23 @@ config SYSTEMPORT
Broadcom BCM7xxx Set Top Box family chipset using an internal
Ethernet switch.

config BNXT
tristate "Broadcom NetXtreme-C/E support"
depends on PCI
select FW_LOADER
select LIBCRC32C
---help---
This driver supports Broadcom NetXtreme-C/E 10/25/40/50 gigabit
Ethernet cards. To compile this driver as a module, choose M here:
the module will be called bnxt_en. This is recommended.

config BNXT_SRIOV
bool "Broadcom NetXtreme-C/E SR-IOV support"
depends on BNXT && PCI_IOV
default y
---help---
This configuration parameter enables Single Root Input Output
Virtualization support in the NetXtreme-C/E products. This
allows for virtual function acceleration in virtual environments.

endif # NET_VENDOR_BROADCOM
1 change: 1 addition & 0 deletions drivers/net/ethernet/broadcom/Makefile
Original file line number Diff line number Diff line change
@@ -12,3 +12,4 @@ obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o
obj-$(CONFIG_TIGON3) += tg3.o
obj-$(CONFIG_BGMAC) += bgmac.o
obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o
obj-$(CONFIG_BNXT) += bnxt/
3 changes: 3 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
obj-$(CONFIG_BNXT) += bnxt_en.o

bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o
5,746 changes: 5,746 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c

Large diffs are not rendered by default.

1,081 changes: 1,081 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.h

Large diffs are not rendered by default.

1,149 changes: 1,149 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Broadcom NetXtreme-C/E network driver.
*
* Copyright (c) 2014-2015 Broadcom Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*/

#ifndef BNXT_ETHTOOL_H
#define BNXT_ETHTOOL_H

extern const struct ethtool_ops bnxt_ethtool_ops;

u32 bnxt_fw_to_ethtool_speed(u16);

#endif
104 changes: 104 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_fw_hdr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/* Broadcom NetXtreme-C/E network driver.
*
* Copyright (c) 2014-2015 Broadcom Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*/

#ifndef __BNXT_FW_HDR_H__
#define __BNXT_FW_HDR_H__

#define BNXT_FIRMWARE_BIN_SIGNATURE 0x1a4d4342 /* "BCM"+0x1a */

enum SUPPORTED_FAMILY {
DEVICE_5702_3_4_FAMILY, /* 0 - Denali, Vinson, K2 */
DEVICE_5705_FAMILY, /* 1 - Bachelor */
DEVICE_SHASTA_FAMILY, /* 2 - 5751 */
DEVICE_5706_FAMILY, /* 3 - Teton */
DEVICE_5714_FAMILY, /* 4 - Hamilton */
DEVICE_STANFORD_FAMILY, /* 5 - 5755 */
DEVICE_STANFORD_ME_FAMILY, /* 6 - 5756 */
DEVICE_SOLEDAD_FAMILY, /* 7 - 5761[E] */
DEVICE_CILAI_FAMILY, /* 8 - 57780/60/90/91 */
DEVICE_ASPEN_FAMILY, /* 9 - 57781/85/61/65/91/95 */
DEVICE_ASPEN_PLUS_FAMILY, /* 10 - 57786 */
DEVICE_LOGAN_FAMILY, /* 11 - Any device in the Logan family
*/
DEVICE_LOGAN_5762, /* 12 - Logan Enterprise (aka Columbia)
*/
DEVICE_LOGAN_57767, /* 13 - Logan Client */
DEVICE_LOGAN_57787, /* 14 - Logan Consumer */
DEVICE_LOGAN_5725, /* 15 - Logan Server (TruManage-enabled)
*/
DEVICE_SAWTOOTH_FAMILY, /* 16 - 5717/18 */
DEVICE_COTOPAXI_FAMILY, /* 17 - 5719 */
DEVICE_SNAGGLETOOTH_FAMILY, /* 18 - 5720 */
DEVICE_CUMULUS_FAMILY, /* 19 - Cumulus/Whitney */
MAX_DEVICE_FAMILY
};

enum SUPPORTED_CODE {
CODE_ASF1, /* 0 - ASF VERSION 1.03 <deprecated> */
CODE_ASF2, /* 1 - ASF VERSION 2.00 <deprecated> */
CODE_PASSTHRU, /* 2 - PassThru <deprecated> */
CODE_PT_SEC, /* 3 - PassThru with security <deprecated> */
CODE_UMP, /* 4 - UMP <deprecated> */
CODE_BOOT, /* 5 - Bootcode */
CODE_DASH, /* 6 - TruManage (DASH + ASF + PMCI)
* Management firmwares
*/
CODE_MCTP_PASSTHRU, /* 7 - NCSI / MCTP Passt-hrough firmware */
CODE_PM_OFFLOAD, /* 8 - Power-Management Proxy Offload firmwares
*/
CODE_MDNS_SD_OFFLOAD, /* 9 - Multicast DNS Service Discovery Proxys
* Offload firmware
*/
CODE_DISC_OFFLOAD, /* 10 - Discovery Offload firmware */
CODE_MUSTANG, /* 11 - I2C Error reporting APE firmwares
* <deprecated>
*/
CODE_ARP_BATCH, /* 12 - ARP Batch firmware */
CODE_SMASH, /* 13 - TruManage (SMASH + DCMI/IPMI + PMCI)
* Management firmware
*/
CODE_APE_DIAG, /* 14 - APE Test Diag firmware */
CODE_APE_PATCH, /* 15 - APE Patch firmware */
CODE_TANG_PATCH, /* 16 - TANG Patch firmware */
CODE_KONG_FW, /* 17 - KONG firmware */
CODE_KONG_PATCH, /* 18 - KONG Patch firmware */
CODE_BONO_FW, /* 19 - BONO firmware */
CODE_BONO_PATCH, /* 20 - BONO Patch firmware */

MAX_CODE_TYPE,
};

enum SUPPORTED_MEDIA {
MEDIA_COPPER, /* 0 */
MEDIA_FIBER, /* 1 */
MEDIA_NONE, /* 2 */
MEDIA_COPPER_FIBER, /* 3 */
MAX_MEDIA_TYPE,
};

struct bnxt_fw_header {
__le32 signature; /* constains the constant value of
* BNXT_Firmware_Bin_Signatures
*/
u8 flags; /* reserved for ChiMP use */
u8 code_type; /* enum SUPPORTED_CODE */
u8 device; /* enum SUPPORTED_FAMILY */
u8 media; /* enum SUPPORTED_MEDIA */
u8 version[16]; /* the null terminated version string to
* indicate the version of the
* file, this will be copied from the binary
* file version string
*/
u8 build;
u8 revision;
u8 minor_ver;
u8 major_ver;
};

#endif
4,046 changes: 4,046 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_nvm_defs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* Broadcom NetXtreme-C/E network driver.
*
* Copyright (c) 2014-2015 Broadcom Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*/

#ifndef _BNXT_NVM_DEFS_H_
#define _BNXT_NVM_DEFS_H_

enum bnxt_nvm_directory_type {
BNX_DIR_TYPE_UNUSED = 0,
BNX_DIR_TYPE_PKG_LOG = 1,
BNX_DIR_TYPE_CHIMP_PATCH = 3,
BNX_DIR_TYPE_BOOTCODE = 4,
BNX_DIR_TYPE_VPD = 5,
BNX_DIR_TYPE_EXP_ROM_MBA = 6,
BNX_DIR_TYPE_AVS = 7,
BNX_DIR_TYPE_PCIE = 8,
BNX_DIR_TYPE_PORT_MACRO = 9,
BNX_DIR_TYPE_APE_FW = 10,
BNX_DIR_TYPE_APE_PATCH = 11,
BNX_DIR_TYPE_KONG_FW = 12,
BNX_DIR_TYPE_KONG_PATCH = 13,
BNX_DIR_TYPE_BONO_FW = 14,
BNX_DIR_TYPE_BONO_PATCH = 15,
BNX_DIR_TYPE_TANG_FW = 16,
BNX_DIR_TYPE_TANG_PATCH = 17,
BNX_DIR_TYPE_BOOTCODE_2 = 18,
BNX_DIR_TYPE_CCM = 19,
BNX_DIR_TYPE_PCI_CFG = 20,
BNX_DIR_TYPE_TSCF_UCODE = 21,
BNX_DIR_TYPE_ISCSI_BOOT = 22,
BNX_DIR_TYPE_ISCSI_BOOT_IPV6 = 24,
BNX_DIR_TYPE_ISCSI_BOOT_IPV4N6 = 25,
BNX_DIR_TYPE_ISCSI_BOOT_CFG6 = 26,
BNX_DIR_TYPE_EXT_PHY = 27,
BNX_DIR_TYPE_SHARED_CFG = 40,
BNX_DIR_TYPE_PORT_CFG = 41,
BNX_DIR_TYPE_FUNC_CFG = 42,
BNX_DIR_TYPE_MGMT_CFG = 48,
BNX_DIR_TYPE_MGMT_DATA = 49,
BNX_DIR_TYPE_MGMT_WEB_DATA = 50,
BNX_DIR_TYPE_MGMT_WEB_META = 51,
BNX_DIR_TYPE_MGMT_EVENT_LOG = 52,
BNX_DIR_TYPE_MGMT_AUDIT_LOG = 53
};

#define BNX_DIR_ORDINAL_FIRST 0

#define BNX_DIR_EXT_INACTIVE (1 << 0)
#define BNX_DIR_EXT_UPDATE (1 << 1)

#define BNX_DIR_ATTR_NO_CHKSUM (1 << 0)
#define BNX_DIR_ATTR_PROP_STREAM (1 << 1)

#endif /* Don't add anything after this line */
787 changes: 787 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Broadcom NetXtreme-C/E network driver.
*
* Copyright (c) 2014-2015 Broadcom Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*/

#ifndef BNXT_SRIOV_H
#define BNXT_SRIOV_H

int bnxt_get_vf_config(struct net_device *, int, struct ifla_vf_info *);
int bnxt_set_vf_mac(struct net_device *, int, u8 *);
int bnxt_set_vf_vlan(struct net_device *, int, u16, u8);
int bnxt_set_vf_bw(struct net_device *, int, int, int);
int bnxt_set_vf_link_state(struct net_device *, int, int);
int bnxt_set_vf_spoofchk(struct net_device *, int, bool);
int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs);
void bnxt_sriov_disable(struct bnxt *);
void bnxt_hwrm_exec_fwd_req(struct bnxt *);
#endif

0 comments on commit c0c050c

Please sign in to comment.