39 #define HUNTINGTON_NVRAM_CHUNK 0x80 40 #define HUNTINGTON_NVS_MAX_LENGTH 0x1000 42 #define EMCDI_IO(code) EUNIQ(EINFO_EIO, (code)) 45 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 48 #define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) 133 MCDI_HEADER_RESYNC, 1,
134 MCDI_HEADER_DATALEN, 0,
135 MCDI_HEADER_SEQ,
seqno,
136 MCDI_HEADER_ERROR, 0,
137 MCDI_HEADER_RESPONSE, 0,
138 MCDI_HEADER_XFLAGS, xflags);
140 MC_CMD_V2_EXTN_IN_EXTENDED_CMD,
cmd,
141 MC_CMD_V2_EXTN_IN_ACTUAL_LEN,
inlen);
143 hdr_len =
sizeof(
hdr);
179 unsigned int resplen, respseq,
error;
180 unsigned long finish;
213 if (
error && resplen == 0) {
215 DBGC(hunt,
"MC rebooted\n");
219 DBGC(hunt,
"MC response mismatch rxseq 0x%x txseq " 223 memcpy(&errdword, pdu1 + 8, 4);
263 size_t *outlen_actual,
bool quiet)
267 size_t local_outlen_actual;
269 if (outlen_actual ==
NULL)
270 outlen_actual = &local_outlen_actual;
278 DBGC(hunt,
"MC response to cmd 0x%x: %s\n",
338 *implemented =
MCDI_DWORD(outbuf, GET_WORKAROUNDS_OUT_IMPLEMENTED);
400 GET_PORT_ASSIGNMENT_OUT_PORT);
451 DBGC2(hunt,
"GET_PHY_CFG: flags=%x, caps=%x\n",
rc, hunt->
phy_cap);
503 ENTITY_RESET_IN_FUNCTION_RESOURCE_RESET, 1);
528 if (
MCDI_DWORD(outbuf, SET_TUNNEL_ENCAP_UDP_PORTS_OUT_FLAGS) &
531 "Rebooting MC due to clearing UDP tunnel port list\n");
605 DBGC(hunt,
"MC_CMD_FREE_VIS Failed\n");
619 unsigned int flags, speed;
622 static bool link_state =
false;
647 if (up != link_state) {
648 DBGC(hunt,
"Link %s, flags=%x, our caps=%x, lpa=%x, speed=%d, fcntl=%x, mac_fault=%x\n",
649 (up?
"up":
"down"),
flags,
661 #define MCDI_PORT_SPEED_CAPS ((1 << MC_CMD_PHY_CAP_10HDX_LBN) | \ 662 (1 << MC_CMD_PHY_CAP_10FDX_LBN) | \ 663 (1 << MC_CMD_PHY_CAP_100HDX_LBN) | \ 664 (1 << MC_CMD_PHY_CAP_100FDX_LBN) | \ 665 (1 << MC_CMD_PHY_CAP_1000HDX_LBN) | \ 666 (1 << MC_CMD_PHY_CAP_1000FDX_LBN) | \ 667 (1 << MC_CMD_PHY_CAP_10000FDX_LBN) | \ 668 (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) 705 INIT_TXQ_IN_FLAG_BUFF_MODE, 0,
706 INIT_TXQ_IN_FLAG_IP_CSUM_DIS, 1,
707 INIT_TXQ_IN_FLAG_TCP_CSUM_DIS, 1,
708 INIT_TXQ_IN_FLAG_TCP_UDP_ONLY, 0,
709 INIT_TXQ_IN_CRC_MODE, 0,
710 INIT_TXQ_IN_FLAG_TIMESTAMP, 0);
719 EFX_DWORD_1, (
uint32_t)(dma_addr >> 32),
720 EFX_DWORD_0, (
uint32_t)(dma_addr & 0xffffffff));
743 DBGC(hunt,
"MC_CMD_FINI_TXQ Failed\n");
778 FILTER_OP_IN_MATCH_DST_MAC, 1);
903 INIT_RXQ_IN_FLAG_BUFF_MODE, 0,
904 INIT_RXQ_IN_FLAG_HDR_SPLIT, 0,
905 INIT_RXQ_IN_FLAG_TIMESTAMP, 0,
906 INIT_RXQ_IN_CRC_MODE, 0,
907 INIT_RXQ_IN_FLAG_PREFIX, 1);
915 EFX_DWORD_1, (
uint32_t)(dma_addr >> 32),
916 EFX_DWORD_0, (
uint32_t)(dma_addr & 0xffffffff));
944 DBGC(hunt,
"MC_CMD_FINI_RXQ Failed\n");
987 INIT_EVQ_IN_FLAG_INTERRUPTING, 1,
988 INIT_EVQ_IN_FLAG_RPTR_DOS, 0,
989 INIT_EVQ_IN_FLAG_INT_ARMD, 0,
990 INIT_EVQ_IN_FLAG_CUT_THRU, 0,
991 INIT_EVQ_IN_FLAG_RX_MERGE, 0,
992 INIT_EVQ_IN_FLAG_TX_MERGE, 0);
1006 EFX_DWORD_1, (
uint32_t)(dma_addr >> 32),
1007 EFX_DWORD_0, (
uint32_t)(dma_addr & 0xffffffff));
1036 DBGC(hunt,
"MC_CMD_FINI_EVQ Failed\n");
1191 memset(hunt, 0,
sizeof(*hunt));
1252 while (other_hunt && !hunt->
primary) {
1318 PCI_ROM(0x1924, 0x0903,
"SFC9120",
"Solarflare SFC9120 Adapter", 0),
1319 PCI_ROM(0x1924, 0x0923,
"SFC9140",
"Solarflare SFC9140 Adapter", 0),
1320 PCI_ROM(0x1924, 0x0a03,
"SFC9220",
"Solarflare SFN8xxx Adapter", 0),
1321 PCI_ROM(0x1924, 0x0b03,
"SFC9250",
"Solarflare X25xx Adapter", 0),
void efx_hunt_irq(struct net_device *netdev, int enable)
#define MC_CMD_INIT_TXQ_IN_LEN(num)
#define MC_CMD_ERR_ENOENT
#define EINVAL
Invalid argument.
static int hunt_workaround_35388(struct hunt_nic *hunt)
#define MCDI_SET_DWORD(_buf, _field, _value)
#define MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY
static int hunt_get_port_assignment(struct hunt_nic *hunt)
static int hunt_probe(struct pci_device *pci)
struct arbelprm_rc_send_wqe rc
void efx_hunt_poll(struct net_device *netdev)
static struct net_device_operations hunt_operations
static int hunt_set_mac(struct hunt_nic *hunt)
#define TICKS_PER_SEC
Number of ticks per second.
int efx_hunt_rx_init(struct net_device *netdev, dma_addr_t *dma_addr)
static int hunt_alloc_vis(struct hunt_nic *hunt)
#define MC_CMD_FILTER_OP_IN_RX_DEST_HOST
#define EBUSY
Device or resource busy.
#define MC_CMD_FILTER_OP_IN_OP_INSERT
union efx_dword efx_dword_t
A doubleword (4 byte) datatype - little-endian in HW.
#define MCDI_QWORD(_buf, _field)
int(* open)(struct net_device *netdev)
Open network device.
#define MC_CMD_FILTER_OP_IN_OP_REMOVE
efx_dword_t * emr_out_buf
#define MC_CMD_GET_MAC_ADDRESSES_OUT_LEN
static int hunt_mcdi_init(struct hunt_nic *hunt)
#define MC_CMD_INIT_EVQ_IN_LEN(num)
#define MC_CMD_GET_LINK_OUT_LEN
static int hunt_rx_filter_insert(struct net_device *netdev, struct hunt_nic *hunt, int multicast)
struct golan_inbox_hdr hdr
Message header.
#define MC_CMD_FILTER_OP_IN_LEN
#define MCDI_POPULATE_DWORD_1(_buf, _field, _name1, _value1)
static void hunt_clear_udp_tunnel_ports(struct hunt_nic *hunt)
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
#define MC_CMD_INIT_EVQ_IN_TMR_MODE_DIS
#define EFX_TXQ_NBUFS(_ndescs)
struct arbelprm_completion_with_error error
static int hunt_mcdi_request_poll(struct hunt_nic *hunt, bool quiet)
#define MC_CMD_FILTER_OP_IN_TX_DEST_DEFAULT
#define MCDI_DWORD(_buf, _field)
#define MC_CMD_FILTER_OP_IN_OP_UNSUBSCRIBE
#define MC_CMD_FW_DONT_CARE
static int hunt_open(struct net_device *netdev)
#define MC_CMD_FCNTL_AUTO
#define ENOENT
No such file or directory.
size_t emr_out_length_used
unsigned long long uint64_t
unsigned int state
Current device state.
int efx_hunt_ev_init(struct net_device *netdev, dma_addr_t *dma_addr)
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
#define MC_CMD_WORKAROUND_IN_LEN
#define EACCES
Permission denied.
static void _efx_writel(struct efx_nic *efx, uint32_t value, unsigned int reg)
static int hunt_mcdi_quiet(struct hunt_nic *hunt, struct efx_mcdi_req_s *req)
#define MC_CMD_ERR_EINVAL
int efx_hunt_tx_init(struct net_device *netdev, dma_addr_t *dma_addr)
static int hunt_tx_init(struct net_device *netdev, struct hunt_nic *hunt)
A doubleword (4 byte) datatype - little-endian in HW.
void efx_probe(struct net_device *netdev, enum efx_revision revision)
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static int hunt_rx_init(struct net_device *netdev, struct hunt_nic *hunt)
struct device dev
Generic device.
uint32_t enabled
Bitmask of enabled AENQ groups (host -> device)
static void hunt_ev_fini(struct hunt_nic *hunt)
#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS
#define EFX_EVQ_NBUFS(_nevs)
#define MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_NO_ACTIVE_PORT
#define MC_CMD_DRV_ATTACH_OUT_LEN
Dynamic memory allocation.
#define MC_CMD_FINI_RXQ_IN_LEN
#define MC_CMD_DRV_PREBOOT_LBN
#define MC_CMD_GET_WORKAROUNDS
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static int hunt_rx_filter_init(struct net_device *netdev, struct hunt_nic *hunt)
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
#define MCDI_PTR(_buf, _field)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define MC_CMD_DRV_ATTACH
#define MC_CMD_GET_WORKAROUNDS_OUT_BUG35388
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void efx_hunt_close(struct net_device *netdev)
struct pci_driver hunt_driver __pci_driver
#define EMSGSIZE
Message too long.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
struct hunt_nic * next_primary
#define EINTR
Interrupted function call.
static void hunt_close(struct net_device *netdev)
static int hunt_rx_filter_remove(struct hunt_nic *hunt, int multicast)
#define PCI_FIRST_FUNC(busdevfn)
void * priv
Driver private data.
int(* mcdi_rpc)(struct efx_nic *efx, unsigned int cmd, const efx_dword_t *inbuf, size_t inlen, efx_dword_t *outbuf, size_t outlen, size_t *outlen_actual, bool quiet)
#define MC_CMD_GET_PORT_ASSIGNMENT
static int hunt_get_workarounds(struct hunt_nic *hunt, uint32_t *implemented, uint32_t *enabled)
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
#define EDEADLK
Resource deadlock avoided.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static struct net_device * netdev
#define EFX_MAC_FRAME_LEN(_mtu)
#define MC_CMD_INIT_EVQ_IN_COUNT_MODE_DIS
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct hunt_nic * primary_nics
#define MC_CMD_ERR_ENOSYS
static int hunt_enable_workaround_35388(struct hunt_nic *hunt)
EF10 hardware architecture definitions.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
#define EFX_POPULATE_QWORD_2(qword,...)
#define cpu_to_le32(value)
#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_LEN
#define MCDI_DECLARE_BUF(_name, _len)
static void hunt_mcdi_copyout(struct hunt_nic *hunt, uint8_t *outbuf, size_t outlen)
char * strerror(int errno)
Retrieve string representation of error number.
#define MC_CMD_ERR_EACCES
#define PCI_FMT
PCI device debug message format.
#define EFX_RXQ_NBUFS(_ndescs)
int register_netdev(struct net_device *netdev)
Register network device.
#define EFX_STATE_POLLING
struct hunt_nic::@103 mcdi
#define MC_CMD_FILTER_OP_OUT_LEN
const struct efx_nic_type * type
#define MC_CMD_ENTITY_RESET_IN_LEN
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void hunt_remove(struct pci_device *pci)
static int hunt_get_mac(struct hunt_nic *hunt)
#define MC_CMD_GET_PHY_CFG_OUT_LEN
#define MC_CMD_GET_MAC_ADDRESSES
const struct efx_nic_type hunt_nic_type
#define MC_CMD_ALLOC_VIS_IN_LEN
#define ETIME
Timer expired.
A PCI device ID list entry.
static void hunt_rx_filter_fini(struct hunt_nic *hunt)
#define EFX_DWORD_FIELD(dword, field)
#define MC_CMD_GET_WORKAROUNDS_OUT_LEN
#define EFX_POPULATE_DWORD_2(dword,...)
#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_UNLOADING_LBN
static void hunt_mcdi_fini(struct hunt_nic *hunt)
int _hunt_mcdi(struct efx_nic *efx, unsigned int cmd, const efx_dword_t *inbuf, size_t inlen, efx_dword_t *outbuf, size_t outlen, size_t *outlen_actual, bool quiet)
unsigned int rx_prefix_size
#define MCDI_POPULATE_DWORD_6(_buf, _field, _name1, _value1, _name2, _value2, _name3, _value3, _name4, _value4, _name5, _value5, _name6, _value6)
Network device operations.
struct device * dev
Underlying hardware device.
int efx_hunt_open(struct net_device *netdev)
#define EPERM
Operation not permitted.
#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_RESETTING_LBN
Network device management.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
static int hunt_get_phy_cfg(struct hunt_nic *hunt)
uint32_t busdevfn
Segment, bus, device, and function (bus:dev.fn) number.
void efx_remove(struct net_device *netdev)
static int hunt_reset(struct hunt_nic *hunt)
char name[NETDEV_NAME_LEN]
Name of this network device.
#define ES_DZ_RX_PREFIX_SIZE
#define MC_CMD_FILTER_OP_IN_OP_SUBSCRIBE
static int hunt_driver_attach(struct hunt_nic *hunt, int attach)
static void hunt_poll(struct net_device *netdev)
int efx_hunt_transmit(struct net_device *netdev, struct io_buffer *iob)
static int hunt_check_link(struct hunt_nic *hunt)
#define MC_CMD_GET_LINK_OUT_LINK_UP_LBN
static int hunt_mcdi(struct hunt_nic *hunt, struct efx_mcdi_req_s *req)
uint16_t delay
Forward delay.
unsigned int phy_cap_mask
#define MC_CMD_FCNTL_BIDIR
void * data
Start of data.
#define EIO
Input/output error.
#define EFX_POPULATE_DWORD_7(dword,...)
static struct pci_device_id hunt_nics[]
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
#define PCI_ARGS(pci)
PCI device debug message arguments.
#define MC_CMD_DRV_ATTACH_IN_LEN
#define MC_CMD_ENTITY_RESET
#define ENOSYS
Function not implemented.
#define MC_CMD_PHY_CAP_AN_LBN
#define MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN
#define MC_CMD_FINI_EVQ_IN_LEN
uint16_t offset
Offset to command line.
static void hunt_mcdi_copyin(struct hunt_nic *hunt, unsigned int cmd, uint8_t *inbuf, size_t inlen)
static int hunt_ev_init(struct net_device *netdev, struct hunt_nic *hunt)
Efx device type definition.
#define MC_CMD_ERR_EDEADLK
struct hunt_nic * primary
#define EVB_PORT_ID_ASSIGNED
void efx_hunt_free_special_buffer(void *buf, int bytes)
static int hunt_nic_is_primary(struct hunt_nic *hunt)
#define MCDI_SET_QWORD(_buf, _field, _value)
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
static void hunt_tx_fini(struct hunt_nic *hunt)
unsigned long currticks(void)
Get current system time in ticks.
#define MC_CMD_FINI_TXQ_IN_LEN
static int hunt_mac_addr(struct hunt_nic *hunt, uint8_t *ll_addr)
#define MC_CMD_GET_PHY_CFG
#define MC_CMD_WORKAROUND
#define NETDEV_IRQ_UNSUPPORTED
Network device interrupts are unsupported.
#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_LENMAX
This file is a subset of the MCDI headers generated from the yml files.
unsigned long link_poll_timer
#define NULL
NULL pointer (VOID *)
#define MC_CMD_INIT_EVQ_OUT_LEN
#define ETIMEDOUT
Connection timed out.
#define MCDI_POPULATE_DWORD_5(_buf, _field, _name1, _value1, _name2, _value2, _name3, _value3, _name4, _value4, _name5, _value5)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
#define MC_CMD_SET_MAC_IN_LEN
static void hunt_free_vis(struct hunt_nic *hunt)
A quadword (8 byte) datatype - little-endian in HW.
#define MCDI_CTL_SDU_LEN_MAX_V2
struct net_device * netdev
static void hunt_rx_fini(struct hunt_nic *hunt)
#define MC_CMD_DRV_ATTACH_EXT_OUT_LEN
#define MC_CMD_WORKAROUND_BUG35388
if(natsemi->flags &NATSEMI_64BIT) return 1
void * memset(void *dest, int character, size_t len) __nonnull
#define MC_CMD_INIT_RXQ_IN_LEN(num)