2018-04-02 22:34:32 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2021-01-27 16:09:43 +00:00
|
|
|
* Copyright(c) 2014-2021 Broadcom
|
2018-04-02 22:34:32 +00:00
|
|
|
* All rights reserved.
|
2016-06-15 21:23:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BNXT_H_
|
|
|
|
#define _BNXT_H_
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
2017-06-01 17:06:59 +00:00
|
|
|
#include <stdbool.h>
|
2016-06-15 21:23:02 +00:00
|
|
|
#include <sys/queue.h>
|
|
|
|
|
2017-07-07 00:04:19 +00:00
|
|
|
#include <rte_pci.h>
|
2017-10-26 10:06:08 +00:00
|
|
|
#include <rte_bus_pci.h>
|
2021-01-29 16:48:19 +00:00
|
|
|
#include <ethdev_driver.h>
|
2016-06-15 21:23:02 +00:00
|
|
|
#include <rte_memory.h>
|
|
|
|
#include <rte_lcore.h>
|
|
|
|
#include <rte_spinlock.h>
|
2017-12-05 07:26:56 +00:00
|
|
|
#include <rte_time.h>
|
2016-06-15 21:23:02 +00:00
|
|
|
|
2016-06-15 21:23:08 +00:00
|
|
|
#include "bnxt_cpr.h"
|
2019-10-02 01:23:34 +00:00
|
|
|
#include "bnxt_util.h"
|
2016-06-15 21:23:08 +00:00
|
|
|
|
2020-04-15 08:18:41 +00:00
|
|
|
#include "tf_core.h"
|
2020-04-15 08:18:53 +00:00
|
|
|
#include "bnxt_ulp.h"
|
2020-07-02 23:28:28 +00:00
|
|
|
#include "bnxt_tf_common.h"
|
2020-04-15 08:18:41 +00:00
|
|
|
|
2019-10-10 09:44:32 +00:00
|
|
|
/* Vendor ID */
|
|
|
|
#define PCI_VENDOR_ID_BROADCOM 0x14E4
|
|
|
|
|
|
|
|
/* Device IDs */
|
|
|
|
#define BROADCOM_DEV_ID_STRATUS_NIC_VF1 0x1606
|
|
|
|
#define BROADCOM_DEV_ID_STRATUS_NIC_VF2 0x1609
|
|
|
|
#define BROADCOM_DEV_ID_STRATUS_NIC 0x1614
|
|
|
|
#define BROADCOM_DEV_ID_57414_VF 0x16c1
|
|
|
|
#define BROADCOM_DEV_ID_57304_VF 0x16cb
|
|
|
|
#define BROADCOM_DEV_ID_57417_MF 0x16cc
|
|
|
|
#define BROADCOM_DEV_ID_NS2 0x16cd
|
|
|
|
#define BROADCOM_DEV_ID_57406_VF 0x16d3
|
|
|
|
#define BROADCOM_DEV_ID_57412 0x16d6
|
|
|
|
#define BROADCOM_DEV_ID_57414 0x16d7
|
|
|
|
#define BROADCOM_DEV_ID_57416_RJ45 0x16d8
|
|
|
|
#define BROADCOM_DEV_ID_57417_RJ45 0x16d9
|
|
|
|
#define BROADCOM_DEV_ID_5741X_VF 0x16dc
|
|
|
|
#define BROADCOM_DEV_ID_57412_MF 0x16de
|
|
|
|
#define BROADCOM_DEV_ID_57317_RJ45 0x16e0
|
|
|
|
#define BROADCOM_DEV_ID_5731X_VF 0x16e1
|
|
|
|
#define BROADCOM_DEV_ID_57417_SFP 0x16e2
|
|
|
|
#define BROADCOM_DEV_ID_57416_SFP 0x16e3
|
|
|
|
#define BROADCOM_DEV_ID_57317_SFP 0x16e4
|
|
|
|
#define BROADCOM_DEV_ID_57407_MF 0x16ea
|
|
|
|
#define BROADCOM_DEV_ID_57414_MF 0x16ec
|
|
|
|
#define BROADCOM_DEV_ID_57416_MF 0x16ee
|
|
|
|
#define BROADCOM_DEV_ID_57508 0x1750
|
|
|
|
#define BROADCOM_DEV_ID_57504 0x1751
|
|
|
|
#define BROADCOM_DEV_ID_57502 0x1752
|
2019-10-24 07:44:29 +00:00
|
|
|
#define BROADCOM_DEV_ID_57508_MF1 0x1800
|
|
|
|
#define BROADCOM_DEV_ID_57504_MF1 0x1801
|
|
|
|
#define BROADCOM_DEV_ID_57502_MF1 0x1802
|
|
|
|
#define BROADCOM_DEV_ID_57508_MF2 0x1803
|
|
|
|
#define BROADCOM_DEV_ID_57504_MF2 0x1804
|
|
|
|
#define BROADCOM_DEV_ID_57502_MF2 0x1805
|
2019-10-10 09:44:32 +00:00
|
|
|
#define BROADCOM_DEV_ID_57500_VF1 0x1806
|
|
|
|
#define BROADCOM_DEV_ID_57500_VF2 0x1807
|
|
|
|
#define BROADCOM_DEV_ID_58802 0xd802
|
|
|
|
#define BROADCOM_DEV_ID_58804 0xd804
|
|
|
|
#define BROADCOM_DEV_ID_58808 0x16f0
|
|
|
|
#define BROADCOM_DEV_ID_58802_VF 0xd800
|
2020-12-20 05:24:25 +00:00
|
|
|
#define BROADCOM_DEV_ID_58812 0xd812
|
|
|
|
#define BROADCOM_DEV_ID_58814 0xd814
|
|
|
|
#define BROADCOM_DEV_ID_58818 0xd818
|
|
|
|
#define BROADCOM_DEV_ID_58818_VF 0xd82e
|
2019-10-10 09:44:32 +00:00
|
|
|
|
2020-08-28 05:01:12 +00:00
|
|
|
#define BROADCOM_DEV_957508_N2100 0x5208
|
|
|
|
#define IS_BNXT_DEV_957508_N2100(bp) \
|
|
|
|
((bp)->pdev->id.subsystem_device_id == BROADCOM_DEV_957508_N2100)
|
|
|
|
|
2018-09-29 01:59:54 +00:00
|
|
|
#define BNXT_MAX_MTU 9574
|
2016-06-15 21:23:04 +00:00
|
|
|
#define VLAN_TAG_SIZE 4
|
2019-10-02 17:17:31 +00:00
|
|
|
#define BNXT_NUM_VLANS 2
|
|
|
|
#define BNXT_MAX_PKT_LEN (BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +\
|
|
|
|
RTE_ETHER_CRC_LEN +\
|
|
|
|
(BNXT_NUM_VLANS * VLAN_TAG_SIZE))
|
2019-10-24 07:44:17 +00:00
|
|
|
/* FW adds extra 4 bytes for FCS */
|
|
|
|
#define BNXT_VNIC_MRU(mtu)\
|
|
|
|
((mtu) + RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS)
|
2018-06-28 20:15:47 +00:00
|
|
|
#define BNXT_VF_RSV_NUM_RSS_CTX 1
|
|
|
|
#define BNXT_VF_RSV_NUM_L2_CTX 4
|
|
|
|
/* TODO: For now, do not support VMDq/RFS on VFs. */
|
|
|
|
#define BNXT_VF_RSV_NUM_VNIC 1
|
2017-06-01 17:07:15 +00:00
|
|
|
#define BNXT_MAX_LED 4
|
2018-06-28 20:15:30 +00:00
|
|
|
#define BNXT_MIN_RING_DESC 16
|
|
|
|
#define BNXT_MAX_TX_RING_DESC 4096
|
|
|
|
#define BNXT_MAX_RX_RING_DESC 8192
|
2018-06-28 20:15:35 +00:00
|
|
|
#define BNXT_DB_SIZE 0x80
|
2017-06-01 17:07:15 +00:00
|
|
|
|
2019-10-04 03:48:57 +00:00
|
|
|
#define TPA_MAX_AGGS 64
|
|
|
|
#define TPA_MAX_AGGS_TH 1024
|
|
|
|
|
|
|
|
#define TPA_MAX_NUM_SEGS 32
|
|
|
|
#define TPA_MAX_SEGS_TH 8 /* 32 segments in 4-segment units */
|
|
|
|
#define TPA_MAX_SEGS 5 /* 32 segments in log2 units */
|
|
|
|
|
|
|
|
#define BNXT_TPA_MAX_AGGS(bp) \
|
2020-12-01 19:15:23 +00:00
|
|
|
(BNXT_CHIP_P5(bp) ? TPA_MAX_AGGS_TH : \
|
2019-10-04 03:48:57 +00:00
|
|
|
TPA_MAX_AGGS)
|
|
|
|
|
|
|
|
#define BNXT_TPA_MAX_SEGS(bp) \
|
2020-12-01 19:15:23 +00:00
|
|
|
(BNXT_CHIP_P5(bp) ? TPA_MAX_SEGS_TH : \
|
2019-10-04 03:48:57 +00:00
|
|
|
TPA_MAX_SEGS)
|
|
|
|
|
2020-09-09 15:52:57 +00:00
|
|
|
/*
|
|
|
|
* Define the number of async completion rings to be used. Set to zero for
|
|
|
|
* configurations in which the maximum number of packet completion rings
|
|
|
|
* for packet completions is desired or when async completion handling
|
|
|
|
* cannot be interrupt-driven.
|
|
|
|
*/
|
|
|
|
#ifdef RTE_EXEC_ENV_FREEBSD
|
|
|
|
/* In FreeBSD OS, nic_uio driver does not support interrupts */
|
2020-12-05 00:15:05 +00:00
|
|
|
#define BNXT_NUM_ASYNC_CPR(bp) 0U
|
2019-07-24 16:49:32 +00:00
|
|
|
#else
|
2020-12-05 00:15:05 +00:00
|
|
|
#define BNXT_NUM_ASYNC_CPR(bp) 1U
|
2019-07-24 16:49:32 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-10 01:41:49 +00:00
|
|
|
#define BNXT_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET
|
|
|
|
#define BNXT_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET
|
|
|
|
|
2018-09-29 01:59:59 +00:00
|
|
|
/* Chimp Communication Channel */
|
|
|
|
#define GRCPF_REG_CHIMP_CHANNEL_OFFSET 0x0
|
|
|
|
#define GRCPF_REG_CHIMP_COMM_TRIGGER 0x100
|
|
|
|
/* Kong Communication Channel */
|
|
|
|
#define GRCPF_REG_KONG_CHANNEL_OFFSET 0xA00
|
|
|
|
#define GRCPF_REG_KONG_COMM_TRIGGER 0xB00
|
|
|
|
|
2018-06-28 20:15:32 +00:00
|
|
|
#define BNXT_INT_LAT_TMR_MIN 75
|
|
|
|
#define BNXT_INT_LAT_TMR_MAX 150
|
|
|
|
#define BNXT_NUM_CMPL_AGGR_INT 36
|
|
|
|
#define BNXT_CMPL_AGGR_DMA_TMR 37
|
|
|
|
#define BNXT_NUM_CMPL_DMA_AGGR 36
|
|
|
|
#define BNXT_CMPL_AGGR_DMA_TMR_DURING_INT 50
|
|
|
|
#define BNXT_NUM_CMPL_DMA_AGGR_DURING_INT 12
|
|
|
|
|
2020-07-29 14:04:59 +00:00
|
|
|
#define BNXT_DEFAULT_VNIC_STATE_MASK \
|
|
|
|
HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_MASK
|
|
|
|
#define BNXT_DEFAULT_VNIC_STATE_SFT \
|
|
|
|
HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_SFT
|
|
|
|
#define BNXT_DEFAULT_VNIC_ALLOC \
|
|
|
|
HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_DEF_VNIC_ALLOC
|
|
|
|
#define BNXT_DEFAULT_VNIC_FREE \
|
|
|
|
HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_DEF_VNIC_FREE
|
|
|
|
#define BNXT_DEFAULT_VNIC_CHANGE_PF_ID_MASK \
|
|
|
|
HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_PF_ID_MASK
|
|
|
|
#define BNXT_DEFAULT_VNIC_CHANGE_PF_ID_SFT \
|
|
|
|
HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_PF_ID_SFT
|
|
|
|
#define BNXT_DEFAULT_VNIC_CHANGE_VF_ID_MASK \
|
|
|
|
HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_MASK
|
|
|
|
#define BNXT_DEFAULT_VNIC_CHANGE_VF_ID_SFT \
|
|
|
|
HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_VF_ID_SFT
|
|
|
|
|
2020-10-09 11:11:21 +00:00
|
|
|
#define BNXT_HWRM_CMD_TO_FORWARD(cmd) \
|
|
|
|
(bp->pf->vf_req_fwd[(cmd) / 32] |= (1 << ((cmd) % 32)))
|
|
|
|
|
2017-06-01 17:07:15 +00:00
|
|
|
struct bnxt_led_info {
|
2020-05-15 07:01:51 +00:00
|
|
|
uint8_t num_leds;
|
2017-06-01 17:07:15 +00:00
|
|
|
uint8_t led_id;
|
|
|
|
uint8_t led_type;
|
|
|
|
uint8_t led_group_id;
|
|
|
|
uint8_t unused;
|
|
|
|
uint16_t led_state_caps;
|
|
|
|
#define BNXT_LED_ALT_BLINK_CAP(x) ((x) & \
|
|
|
|
rte_cpu_to_le_16(HWRM_PORT_LED_QCFG_OUTPUT_LED0_STATE_BLINKALT))
|
|
|
|
|
|
|
|
uint16_t led_color_caps;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bnxt_led_cfg {
|
|
|
|
uint8_t led_id;
|
|
|
|
uint8_t led_state;
|
|
|
|
uint8_t led_color;
|
|
|
|
uint8_t unused;
|
|
|
|
uint16_t led_blink_on;
|
|
|
|
uint16_t led_blink_off;
|
|
|
|
uint8_t led_group_id;
|
|
|
|
uint8_t rsvd;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define BNXT_LED_DFLT_ENA \
|
|
|
|
(HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_ID | \
|
|
|
|
HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_STATE | \
|
|
|
|
HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_BLINK_ON | \
|
|
|
|
HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_BLINK_OFF | \
|
|
|
|
HWRM_PORT_LED_CFG_INPUT_ENABLES_LED0_GROUP_ID)
|
|
|
|
|
|
|
|
#define BNXT_LED_DFLT_ENA_SHIFT 6
|
|
|
|
|
|
|
|
#define BNXT_LED_DFLT_ENABLES(x) \
|
|
|
|
rte_cpu_to_le_32(BNXT_LED_DFLT_ENA << (BNXT_LED_DFLT_ENA_SHIFT * (x)))
|
2016-06-15 21:23:04 +00:00
|
|
|
|
2017-06-01 17:06:59 +00:00
|
|
|
struct bnxt_vlan_table_entry {
|
|
|
|
uint16_t tpid;
|
|
|
|
uint16_t vid;
|
2020-02-09 17:29:23 +00:00
|
|
|
} __rte_packed;
|
2017-06-01 17:06:59 +00:00
|
|
|
|
2017-07-21 03:22:31 +00:00
|
|
|
struct bnxt_vlan_antispoof_table_entry {
|
|
|
|
uint16_t tpid;
|
|
|
|
uint16_t vid;
|
|
|
|
uint16_t mask;
|
2020-02-09 17:29:23 +00:00
|
|
|
} __rte_packed;
|
2017-07-21 03:22:31 +00:00
|
|
|
|
2017-06-01 17:06:59 +00:00
|
|
|
struct bnxt_child_vf_info {
|
|
|
|
void *req_buf;
|
|
|
|
struct bnxt_vlan_table_entry *vlan_table;
|
2017-07-21 03:22:31 +00:00
|
|
|
struct bnxt_vlan_antispoof_table_entry *vlan_as_table;
|
2017-06-01 17:06:59 +00:00
|
|
|
STAILQ_HEAD(, bnxt_filter_info) filter;
|
|
|
|
uint32_t func_cfg_flags;
|
|
|
|
uint32_t l2_rx_mask;
|
|
|
|
uint16_t fid;
|
2017-06-01 17:07:17 +00:00
|
|
|
uint16_t max_tx_rate;
|
2017-06-01 17:07:21 +00:00
|
|
|
uint16_t dflt_vlan;
|
2017-06-01 17:07:17 +00:00
|
|
|
uint16_t vlan_count;
|
|
|
|
uint8_t mac_spoof_en;
|
|
|
|
uint8_t vlan_spoof_en;
|
2017-06-01 17:06:59 +00:00
|
|
|
bool random_mac;
|
2017-06-30 14:20:17 +00:00
|
|
|
bool persist_stats;
|
2016-06-15 21:23:02 +00:00
|
|
|
};
|
|
|
|
|
2020-07-02 23:27:51 +00:00
|
|
|
struct bnxt_parent_info {
|
|
|
|
#define BNXT_PF_FID_INVALID 0xFFFF
|
|
|
|
uint16_t fid;
|
|
|
|
uint16_t vnic;
|
|
|
|
uint16_t port_id;
|
|
|
|
uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
|
|
|
|
};
|
|
|
|
|
2016-06-15 21:23:02 +00:00
|
|
|
struct bnxt_pf_info {
|
|
|
|
#define BNXT_FIRST_PF_FID 1
|
2020-05-15 11:10:41 +00:00
|
|
|
#define BNXT_MAX_VFS(bp) ((bp)->pf->max_vfs)
|
2020-07-02 23:27:48 +00:00
|
|
|
#define BNXT_MAX_VF_REPS 64
|
2020-05-15 11:10:41 +00:00
|
|
|
#define BNXT_TOTAL_VFS(bp) ((bp)->pf->total_vfs)
|
2016-06-15 21:23:02 +00:00
|
|
|
#define BNXT_FIRST_VF_FID 128
|
|
|
|
#define BNXT_PF_RINGS_USED(bp) bnxt_get_num_queues(bp)
|
2020-05-15 11:10:41 +00:00
|
|
|
#define BNXT_PF_RINGS_AVAIL(bp) ((bp)->pf->max_cp_rings - \
|
|
|
|
BNXT_PF_RINGS_USED(bp))
|
2017-09-29 07:17:24 +00:00
|
|
|
uint16_t port_id;
|
2016-06-15 21:23:02 +00:00
|
|
|
uint16_t first_vf_id;
|
|
|
|
uint16_t active_vfs;
|
|
|
|
uint16_t max_vfs;
|
2018-06-28 20:15:27 +00:00
|
|
|
uint16_t total_vfs; /* Total VFs possible.
|
|
|
|
* Not necessarily enabled.
|
|
|
|
*/
|
2017-06-01 17:06:59 +00:00
|
|
|
uint32_t func_cfg_flags;
|
2016-06-15 21:23:02 +00:00
|
|
|
void *vf_req_buf;
|
2017-10-20 12:31:31 +00:00
|
|
|
rte_iova_t vf_req_buf_dma_addr;
|
2016-06-15 21:23:02 +00:00
|
|
|
uint32_t vf_req_fwd[8];
|
2017-06-01 17:06:59 +00:00
|
|
|
uint16_t total_vnics;
|
|
|
|
struct bnxt_child_vf_info *vf_info;
|
|
|
|
#define BNXT_EVB_MODE_NONE 0
|
|
|
|
#define BNXT_EVB_MODE_VEB 1
|
|
|
|
#define BNXT_EVB_MODE_VEPA 2
|
|
|
|
uint8_t evb_mode;
|
2016-06-15 21:23:02 +00:00
|
|
|
};
|
|
|
|
|
2019-12-21 02:29:35 +00:00
|
|
|
/* Max wait time for link up is 10s and link down is 500ms */
|
2020-10-06 16:01:56 +00:00
|
|
|
#define BNXT_MAX_LINK_WAIT_CNT 200
|
|
|
|
#define BNXT_MIN_LINK_WAIT_CNT 10
|
2019-12-21 02:29:35 +00:00
|
|
|
#define BNXT_LINK_WAIT_INTERVAL 50
|
2016-06-15 21:23:05 +00:00
|
|
|
struct bnxt_link_info {
|
2016-10-11 21:47:50 +00:00
|
|
|
uint32_t phy_flags;
|
2016-06-15 21:23:05 +00:00
|
|
|
uint8_t mac_type;
|
|
|
|
uint8_t phy_link_status;
|
|
|
|
uint8_t loop_back;
|
|
|
|
uint8_t link_up;
|
|
|
|
uint8_t duplex;
|
|
|
|
uint8_t pause;
|
|
|
|
uint8_t force_pause;
|
|
|
|
uint8_t auto_pause;
|
|
|
|
uint8_t auto_mode;
|
|
|
|
#define PHY_VER_LEN 3
|
|
|
|
uint8_t phy_ver[PHY_VER_LEN];
|
|
|
|
uint16_t link_speed;
|
|
|
|
uint16_t support_speeds;
|
|
|
|
uint16_t auto_link_speed;
|
2018-02-07 01:16:14 +00:00
|
|
|
uint16_t force_link_speed;
|
2016-06-15 21:23:05 +00:00
|
|
|
uint16_t auto_link_speed_mask;
|
|
|
|
uint32_t preemphasis;
|
2017-11-09 17:46:28 +00:00
|
|
|
uint8_t phy_type;
|
|
|
|
uint8_t media_type;
|
2020-08-20 03:51:02 +00:00
|
|
|
uint16_t support_auto_speeds;
|
|
|
|
uint8_t link_signal_mode;
|
|
|
|
uint16_t force_pam4_link_speed;
|
|
|
|
uint16_t support_pam4_speeds;
|
|
|
|
uint16_t auto_pam4_link_speeds;
|
|
|
|
uint16_t support_pam4_auto_speeds;
|
|
|
|
uint8_t req_signal_mode;
|
2016-06-15 21:23:05 +00:00
|
|
|
};
|
|
|
|
|
2016-06-15 21:23:02 +00:00
|
|
|
#define BNXT_COS_QUEUE_COUNT 8
|
|
|
|
struct bnxt_cos_queue_info {
|
|
|
|
uint8_t id;
|
|
|
|
uint8_t profile;
|
|
|
|
};
|
|
|
|
|
2017-09-28 21:43:39 +00:00
|
|
|
struct rte_flow {
|
|
|
|
STAILQ_ENTRY(rte_flow) next;
|
|
|
|
struct bnxt_filter_info *filter;
|
|
|
|
struct bnxt_vnic_info *vnic;
|
|
|
|
};
|
|
|
|
|
2021-04-26 06:07:55 +00:00
|
|
|
#define BNXT_PTP_RX_PND_CNT 10
|
2019-10-02 01:23:35 +00:00
|
|
|
#define BNXT_PTP_FLAGS_PATH_TX 0x0
|
|
|
|
#define BNXT_PTP_FLAGS_PATH_RX 0x1
|
|
|
|
#define BNXT_PTP_FLAGS_CURRENT_TIME 0x2
|
2021-02-24 15:55:53 +00:00
|
|
|
#define BNXT_PTP_CURRENT_TIME_MASK 0xFFFF00000000ULL
|
2019-10-02 01:23:35 +00:00
|
|
|
|
2017-12-05 07:26:56 +00:00
|
|
|
struct bnxt_ptp_cfg {
|
|
|
|
#define BNXT_GRCPF_REG_WINDOW_BASE_OUT 0x400
|
|
|
|
#define BNXT_GRCPF_REG_SYNC_TIME 0x480
|
|
|
|
#define BNXT_CYCLECOUNTER_MASK 0xffffffffffffffffULL
|
|
|
|
struct rte_timecounter tc;
|
|
|
|
struct rte_timecounter tx_tstamp_tc;
|
|
|
|
struct rte_timecounter rx_tstamp_tc;
|
|
|
|
struct bnxt *bp;
|
|
|
|
#define BNXT_MAX_TX_TS 1
|
|
|
|
uint16_t rxctl;
|
2019-10-02 01:23:34 +00:00
|
|
|
#define BNXT_PTP_MSG_SYNC BIT(0)
|
|
|
|
#define BNXT_PTP_MSG_DELAY_REQ BIT(1)
|
|
|
|
#define BNXT_PTP_MSG_PDELAY_REQ BIT(2)
|
|
|
|
#define BNXT_PTP_MSG_PDELAY_RESP BIT(3)
|
|
|
|
#define BNXT_PTP_MSG_FOLLOW_UP BIT(8)
|
|
|
|
#define BNXT_PTP_MSG_DELAY_RESP BIT(9)
|
|
|
|
#define BNXT_PTP_MSG_PDELAY_RESP_FOLLOW_UP BIT(10)
|
|
|
|
#define BNXT_PTP_MSG_ANNOUNCE BIT(11)
|
|
|
|
#define BNXT_PTP_MSG_SIGNALING BIT(12)
|
|
|
|
#define BNXT_PTP_MSG_MANAGEMENT BIT(13)
|
2017-12-05 07:26:56 +00:00
|
|
|
#define BNXT_PTP_MSG_EVENTS (BNXT_PTP_MSG_SYNC | \
|
|
|
|
BNXT_PTP_MSG_DELAY_REQ | \
|
|
|
|
BNXT_PTP_MSG_PDELAY_REQ | \
|
|
|
|
BNXT_PTP_MSG_PDELAY_RESP)
|
|
|
|
uint8_t tx_tstamp_en:1;
|
|
|
|
int rx_filter;
|
|
|
|
|
|
|
|
#define BNXT_PTP_RX_TS_L 0
|
|
|
|
#define BNXT_PTP_RX_TS_H 1
|
|
|
|
#define BNXT_PTP_RX_SEQ 2
|
|
|
|
#define BNXT_PTP_RX_FIFO 3
|
|
|
|
#define BNXT_PTP_RX_FIFO_PENDING 0x1
|
|
|
|
#define BNXT_PTP_RX_FIFO_ADV 4
|
|
|
|
#define BNXT_PTP_RX_REGS 5
|
|
|
|
|
|
|
|
#define BNXT_PTP_TX_TS_L 0
|
|
|
|
#define BNXT_PTP_TX_TS_H 1
|
|
|
|
#define BNXT_PTP_TX_SEQ 2
|
|
|
|
#define BNXT_PTP_TX_FIFO 3
|
|
|
|
#define BNXT_PTP_TX_FIFO_EMPTY 0x2
|
|
|
|
#define BNXT_PTP_TX_REGS 4
|
|
|
|
uint32_t rx_regs[BNXT_PTP_RX_REGS];
|
|
|
|
uint32_t rx_mapped_regs[BNXT_PTP_RX_REGS];
|
|
|
|
uint32_t tx_regs[BNXT_PTP_TX_REGS];
|
|
|
|
uint32_t tx_mapped_regs[BNXT_PTP_TX_REGS];
|
2019-10-02 01:23:35 +00:00
|
|
|
|
|
|
|
/* On Thor, the Rx timestamp is present in the Rx completion record */
|
|
|
|
uint64_t rx_timestamp;
|
2021-02-24 15:55:53 +00:00
|
|
|
uint64_t current_time;
|
2017-12-05 07:26:56 +00:00
|
|
|
};
|
|
|
|
|
2018-06-28 20:15:32 +00:00
|
|
|
struct bnxt_coal {
|
|
|
|
uint16_t num_cmpl_aggr_int;
|
|
|
|
uint16_t num_cmpl_dma_aggr;
|
|
|
|
uint16_t num_cmpl_dma_aggr_during_int;
|
|
|
|
uint16_t int_lat_tmr_max;
|
|
|
|
uint16_t int_lat_tmr_min;
|
|
|
|
uint16_t cmpl_aggr_dma_tmr;
|
|
|
|
uint16_t cmpl_aggr_dma_tmr_during_int;
|
|
|
|
};
|
|
|
|
|
2019-06-02 17:42:44 +00:00
|
|
|
/* 64-bit doorbell */
|
2020-12-20 05:24:25 +00:00
|
|
|
#define DBR_EPOCH_MASK 0x01000000UL
|
|
|
|
#define DBR_EPOCH_SFT 24
|
2019-06-02 17:42:44 +00:00
|
|
|
#define DBR_XID_SFT 32
|
|
|
|
#define DBR_PATH_L2 (0x1ULL << 56)
|
2020-12-20 05:24:25 +00:00
|
|
|
#define DBR_VALID (0x1ULL << 58)
|
2019-06-02 17:42:44 +00:00
|
|
|
#define DBR_TYPE_SQ (0x0ULL << 60)
|
|
|
|
#define DBR_TYPE_SRQ (0x2ULL << 60)
|
|
|
|
#define DBR_TYPE_CQ (0x4ULL << 60)
|
|
|
|
#define DBR_TYPE_NQ (0xaULL << 60)
|
2019-07-17 10:41:33 +00:00
|
|
|
#define DBR_TYPE_NQ_ARM (0xbULL << 60)
|
2019-06-02 17:42:44 +00:00
|
|
|
|
2020-12-20 05:24:25 +00:00
|
|
|
#define DB_PF_OFFSET 0x10000
|
|
|
|
#define DB_VF_OFFSET 0x4000
|
|
|
|
|
2020-12-01 19:15:23 +00:00
|
|
|
#define BNXT_RSS_TBL_SIZE_P5 512U
|
|
|
|
#define BNXT_RSS_ENTRIES_PER_CTX_P5 64
|
|
|
|
#define BNXT_MAX_RSS_CTXTS_P5 \
|
|
|
|
(BNXT_RSS_TBL_SIZE_P5 / BNXT_RSS_ENTRIES_PER_CTX_P5)
|
2019-06-02 17:42:44 +00:00
|
|
|
|
2021-02-24 15:55:48 +00:00
|
|
|
#define BNXT_MAX_QUEUE 8
|
|
|
|
#define BNXT_MAX_TQM_SP_RINGS 1
|
|
|
|
#define BNXT_MAX_TQM_FP_LEGACY_RINGS 8
|
|
|
|
#define BNXT_MAX_TQM_FP_RINGS 9
|
|
|
|
#define BNXT_MAX_TQM_LEGACY_RINGS \
|
|
|
|
(BNXT_MAX_TQM_SP_RINGS + BNXT_MAX_TQM_FP_LEGACY_RINGS)
|
|
|
|
#define BNXT_MAX_TQM_RINGS \
|
|
|
|
(BNXT_MAX_TQM_SP_RINGS + BNXT_MAX_TQM_FP_RINGS)
|
|
|
|
#define BNXT_BACKING_STORE_CFG_LEGACY_LEN 256
|
|
|
|
#define BNXT_BACKING_STORE_CFG_LEN \
|
|
|
|
sizeof(struct hwrm_func_backing_store_cfg_input)
|
2019-06-02 17:42:44 +00:00
|
|
|
#define BNXT_PAGE_SHFT 12
|
|
|
|
#define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHFT)
|
|
|
|
#define MAX_CTX_PAGES (BNXT_PAGE_SIZE / 8)
|
|
|
|
|
|
|
|
#define PTU_PTE_VALID 0x1UL
|
|
|
|
#define PTU_PTE_LAST 0x2UL
|
|
|
|
#define PTU_PTE_NEXT_TO_LAST 0x4UL
|
|
|
|
|
|
|
|
struct bnxt_ring_mem_info {
|
|
|
|
int nr_pages;
|
|
|
|
int page_size;
|
|
|
|
uint32_t flags;
|
|
|
|
#define BNXT_RMEM_VALID_PTE_FLAG 1
|
|
|
|
#define BNXT_RMEM_RING_PTE_FLAG 2
|
|
|
|
|
|
|
|
void **pg_arr;
|
|
|
|
rte_iova_t *dma_arr;
|
|
|
|
const struct rte_memzone *mz;
|
|
|
|
|
|
|
|
uint64_t *pg_tbl;
|
|
|
|
rte_iova_t pg_tbl_map;
|
|
|
|
const struct rte_memzone *pg_tbl_mz;
|
|
|
|
|
|
|
|
int vmem_size;
|
|
|
|
void **vmem;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bnxt_ctx_pg_info {
|
|
|
|
uint32_t entries;
|
|
|
|
void *ctx_pg_arr[MAX_CTX_PAGES];
|
|
|
|
rte_iova_t ctx_dma_arr[MAX_CTX_PAGES];
|
|
|
|
struct bnxt_ring_mem_info ring_mem;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bnxt_ctx_mem_info {
|
|
|
|
uint32_t qp_max_entries;
|
|
|
|
uint16_t qp_min_qp1_entries;
|
|
|
|
uint16_t qp_max_l2_entries;
|
|
|
|
uint16_t qp_entry_size;
|
|
|
|
uint16_t srq_max_l2_entries;
|
|
|
|
uint32_t srq_max_entries;
|
|
|
|
uint16_t srq_entry_size;
|
|
|
|
uint16_t cq_max_l2_entries;
|
|
|
|
uint32_t cq_max_entries;
|
|
|
|
uint16_t cq_entry_size;
|
|
|
|
uint16_t vnic_max_vnic_entries;
|
|
|
|
uint16_t vnic_max_ring_table_entries;
|
|
|
|
uint16_t vnic_entry_size;
|
|
|
|
uint32_t stat_max_entries;
|
|
|
|
uint16_t stat_entry_size;
|
|
|
|
uint16_t tqm_entry_size;
|
|
|
|
uint32_t tqm_min_entries_per_ring;
|
|
|
|
uint32_t tqm_max_entries_per_ring;
|
|
|
|
uint32_t mrav_max_entries;
|
|
|
|
uint16_t mrav_entry_size;
|
|
|
|
uint16_t tim_entry_size;
|
|
|
|
uint32_t tim_max_entries;
|
|
|
|
uint8_t tqm_entries_multiple;
|
2020-05-06 06:27:09 +00:00
|
|
|
uint8_t tqm_fp_rings_count;
|
2019-06-02 17:42:44 +00:00
|
|
|
|
|
|
|
uint32_t flags;
|
|
|
|
#define BNXT_CTX_FLAG_INITED 0x01
|
|
|
|
|
|
|
|
struct bnxt_ctx_pg_info qp_mem;
|
|
|
|
struct bnxt_ctx_pg_info srq_mem;
|
|
|
|
struct bnxt_ctx_pg_info cq_mem;
|
|
|
|
struct bnxt_ctx_pg_info vnic_mem;
|
|
|
|
struct bnxt_ctx_pg_info stat_mem;
|
2021-02-24 15:55:48 +00:00
|
|
|
struct bnxt_ctx_pg_info *tqm_mem[BNXT_MAX_TQM_RINGS];
|
2019-06-02 17:42:44 +00:00
|
|
|
};
|
|
|
|
|
2020-04-16 04:27:01 +00:00
|
|
|
struct bnxt_ctx_mem_buf_info {
|
|
|
|
void *va;
|
|
|
|
rte_iova_t dma;
|
|
|
|
uint16_t ctx_id;
|
|
|
|
size_t size;
|
|
|
|
};
|
|
|
|
|
2019-10-02 01:23:23 +00:00
|
|
|
/* Maximum Firmware Reset bail out value in milliseconds */
|
|
|
|
#define BNXT_MAX_FW_RESET_TIMEOUT 6000
|
|
|
|
/* Minimum time required for the firmware readiness in milliseconds */
|
|
|
|
#define BNXT_MIN_FW_READY_TIMEOUT 2000
|
|
|
|
/* Frequency for the firmware readiness check in milliseconds */
|
|
|
|
#define BNXT_FW_READY_WAIT_INTERVAL 100
|
|
|
|
|
|
|
|
#define US_PER_MS 1000
|
|
|
|
#define NS_PER_US 1000
|
|
|
|
|
2019-10-02 01:23:26 +00:00
|
|
|
struct bnxt_error_recovery_info {
|
|
|
|
/* All units in milliseconds */
|
|
|
|
uint32_t driver_polling_freq;
|
|
|
|
uint32_t master_func_wait_period;
|
|
|
|
uint32_t normal_func_wait_period;
|
|
|
|
uint32_t master_func_wait_period_after_reset;
|
|
|
|
uint32_t max_bailout_time_after_reset;
|
|
|
|
#define BNXT_FW_STATUS_REG 0
|
|
|
|
#define BNXT_FW_HEARTBEAT_CNT_REG 1
|
|
|
|
#define BNXT_FW_RECOVERY_CNT_REG 2
|
|
|
|
#define BNXT_FW_RESET_INPROG_REG 3
|
2019-10-02 01:23:27 +00:00
|
|
|
#define BNXT_FW_STATUS_REG_CNT 4
|
|
|
|
uint32_t status_regs[BNXT_FW_STATUS_REG_CNT];
|
|
|
|
uint32_t mapped_status_regs[BNXT_FW_STATUS_REG_CNT];
|
2019-10-02 01:23:26 +00:00
|
|
|
uint32_t reset_inprogress_reg_mask;
|
|
|
|
#define BNXT_NUM_RESET_REG 16
|
|
|
|
uint8_t reg_array_cnt;
|
|
|
|
uint32_t reset_reg[BNXT_NUM_RESET_REG];
|
|
|
|
uint32_t reset_reg_val[BNXT_NUM_RESET_REG];
|
|
|
|
uint8_t delay_after_reset[BNXT_NUM_RESET_REG];
|
2019-10-02 01:23:34 +00:00
|
|
|
#define BNXT_FLAG_ERROR_RECOVERY_HOST BIT(0)
|
|
|
|
#define BNXT_FLAG_ERROR_RECOVERY_CO_CPU BIT(1)
|
|
|
|
#define BNXT_FLAG_MASTER_FUNC BIT(2)
|
|
|
|
#define BNXT_FLAG_RECOVERY_ENABLED BIT(3)
|
2019-10-02 01:23:26 +00:00
|
|
|
uint32_t flags;
|
2019-10-02 01:23:29 +00:00
|
|
|
|
|
|
|
uint32_t last_heart_beat;
|
|
|
|
uint32_t last_reset_counter;
|
2019-10-02 01:23:26 +00:00
|
|
|
};
|
|
|
|
|
2020-04-21 21:33:46 +00:00
|
|
|
/* Frequency for the FUNC_DRV_IF_CHANGE retry in milliseconds */
|
|
|
|
#define BNXT_IF_CHANGE_RETRY_INTERVAL 50
|
|
|
|
/* Maximum retry count for FUNC_DRV_IF_CHANGE */
|
|
|
|
#define BNXT_IF_CHANGE_RETRY_COUNT 40
|
|
|
|
|
2020-01-28 07:29:22 +00:00
|
|
|
struct bnxt_mark_info {
|
|
|
|
uint32_t mark_id;
|
|
|
|
bool valid;
|
|
|
|
};
|
|
|
|
|
2020-07-02 23:27:48 +00:00
|
|
|
struct bnxt_rep_info {
|
|
|
|
struct rte_eth_dev *vfr_eth_dev;
|
2020-07-02 23:27:49 +00:00
|
|
|
pthread_mutex_t vfr_lock;
|
2020-07-29 14:04:59 +00:00
|
|
|
pthread_mutex_t vfr_start_lock;
|
|
|
|
bool conduit_valid;
|
2020-07-02 23:27:48 +00:00
|
|
|
};
|
|
|
|
|
2019-10-02 01:23:27 +00:00
|
|
|
/* address space location of register */
|
|
|
|
#define BNXT_FW_STATUS_REG_TYPE_MASK 3
|
|
|
|
/* register is located in PCIe config space */
|
|
|
|
#define BNXT_FW_STATUS_REG_TYPE_CFG 0
|
|
|
|
/* register is located in GRC address space */
|
|
|
|
#define BNXT_FW_STATUS_REG_TYPE_GRC 1
|
|
|
|
/* register is located in BAR0 */
|
|
|
|
#define BNXT_FW_STATUS_REG_TYPE_BAR0 2
|
|
|
|
/* register is located in BAR1 */
|
|
|
|
#define BNXT_FW_STATUS_REG_TYPE_BAR1 3
|
|
|
|
|
|
|
|
#define BNXT_FW_STATUS_REG_TYPE(reg) ((reg) & BNXT_FW_STATUS_REG_TYPE_MASK)
|
|
|
|
#define BNXT_FW_STATUS_REG_OFF(reg) ((reg) & ~BNXT_FW_STATUS_REG_TYPE_MASK)
|
|
|
|
|
|
|
|
#define BNXT_GRCP_WINDOW_2_BASE 0x2000
|
2019-10-02 01:23:30 +00:00
|
|
|
#define BNXT_GRCP_WINDOW_3_BASE 0x3000
|
2019-10-02 01:23:27 +00:00
|
|
|
|
2020-04-21 21:33:50 +00:00
|
|
|
#define BNXT_GRCP_BASE_MASK 0xfffff000
|
|
|
|
#define BNXT_GRCP_OFFSET_MASK 0x00000ffc
|
|
|
|
|
|
|
|
#define BNXT_FW_STATUS_HEALTHY 0x8000
|
2019-10-02 01:23:31 +00:00
|
|
|
#define BNXT_FW_STATUS_SHUTDOWN 0x100000
|
|
|
|
|
2020-07-02 23:27:48 +00:00
|
|
|
#define BNXT_ETH_RSS_SUPPORT ( \
|
|
|
|
ETH_RSS_IPV4 | \
|
|
|
|
ETH_RSS_NONFRAG_IPV4_TCP | \
|
|
|
|
ETH_RSS_NONFRAG_IPV4_UDP | \
|
|
|
|
ETH_RSS_IPV6 | \
|
|
|
|
ETH_RSS_NONFRAG_IPV6_TCP | \
|
2020-09-18 23:33:41 +00:00
|
|
|
ETH_RSS_NONFRAG_IPV6_UDP | \
|
|
|
|
ETH_RSS_LEVEL_MASK)
|
2020-07-02 23:27:48 +00:00
|
|
|
|
|
|
|
#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \
|
|
|
|
DEV_TX_OFFLOAD_IPV4_CKSUM | \
|
|
|
|
DEV_TX_OFFLOAD_TCP_CKSUM | \
|
|
|
|
DEV_TX_OFFLOAD_UDP_CKSUM | \
|
|
|
|
DEV_TX_OFFLOAD_TCP_TSO | \
|
|
|
|
DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \
|
|
|
|
DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \
|
|
|
|
DEV_TX_OFFLOAD_GRE_TNL_TSO | \
|
|
|
|
DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
|
|
|
|
DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
|
|
|
|
DEV_TX_OFFLOAD_QINQ_INSERT | \
|
|
|
|
DEV_TX_OFFLOAD_MULTI_SEGS)
|
|
|
|
|
|
|
|
#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
|
|
|
|
DEV_RX_OFFLOAD_VLAN_STRIP | \
|
|
|
|
DEV_RX_OFFLOAD_IPV4_CKSUM | \
|
|
|
|
DEV_RX_OFFLOAD_UDP_CKSUM | \
|
|
|
|
DEV_RX_OFFLOAD_TCP_CKSUM | \
|
|
|
|
DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
|
2020-12-17 19:24:31 +00:00
|
|
|
DEV_RX_OFFLOAD_OUTER_UDP_CKSUM | \
|
2020-07-02 23:27:48 +00:00
|
|
|
DEV_RX_OFFLOAD_JUMBO_FRAME | \
|
|
|
|
DEV_RX_OFFLOAD_KEEP_CRC | \
|
|
|
|
DEV_RX_OFFLOAD_VLAN_EXTEND | \
|
|
|
|
DEV_RX_OFFLOAD_TCP_LRO | \
|
|
|
|
DEV_RX_OFFLOAD_SCATTER | \
|
|
|
|
DEV_RX_OFFLOAD_RSS_HASH)
|
|
|
|
|
2017-06-30 14:20:13 +00:00
|
|
|
#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input)
|
2020-05-15 08:31:59 +00:00
|
|
|
|
|
|
|
struct bnxt_flow_stat_info {
|
|
|
|
uint16_t max_fc;
|
|
|
|
uint16_t flow_count;
|
|
|
|
struct bnxt_ctx_mem_buf_info rx_fc_in_tbl;
|
|
|
|
struct bnxt_ctx_mem_buf_info rx_fc_out_tbl;
|
|
|
|
struct bnxt_ctx_mem_buf_info tx_fc_in_tbl;
|
|
|
|
struct bnxt_ctx_mem_buf_info tx_fc_out_tbl;
|
|
|
|
};
|
|
|
|
|
2021-05-31 05:53:01 +00:00
|
|
|
struct bnxt_ring_stats {
|
|
|
|
/* Number of transmitted unicast packets */
|
|
|
|
uint64_t tx_ucast_pkts;
|
|
|
|
/* Number of transmitted multicast packets */
|
|
|
|
uint64_t tx_mcast_pkts;
|
|
|
|
/* Number of transmitted broadcast packets */
|
|
|
|
uint64_t tx_bcast_pkts;
|
|
|
|
/* Number of packets discarded in transmit path */
|
|
|
|
uint64_t tx_discard_pkts;
|
|
|
|
/* Number of packets in transmit path with error */
|
|
|
|
uint64_t tx_error_pkts;
|
|
|
|
/* Number of transmitted bytes for unicast traffic */
|
|
|
|
uint64_t tx_ucast_bytes;
|
|
|
|
/* Number of transmitted bytes for multicast traffic */
|
|
|
|
uint64_t tx_mcast_bytes;
|
|
|
|
/* Number of transmitted bytes for broadcast traffic */
|
|
|
|
uint64_t tx_bcast_bytes;
|
|
|
|
/* Number of received unicast packets */
|
|
|
|
uint64_t rx_ucast_pkts;
|
|
|
|
/* Number of received multicast packets */
|
|
|
|
uint64_t rx_mcast_pkts;
|
|
|
|
/* Number of received broadcast packets */
|
|
|
|
uint64_t rx_bcast_pkts;
|
|
|
|
/* Number of packets discarded in receive path */
|
|
|
|
uint64_t rx_discard_pkts;
|
|
|
|
/* Number of packets in receive path with errors */
|
|
|
|
uint64_t rx_error_pkts;
|
|
|
|
/* Number of received bytes for unicast traffic */
|
|
|
|
uint64_t rx_ucast_bytes;
|
|
|
|
/* Number of received bytes for multicast traffic */
|
|
|
|
uint64_t rx_mcast_bytes;
|
|
|
|
/* Number of received bytes for broadcast traffic */
|
|
|
|
uint64_t rx_bcast_bytes;
|
|
|
|
/* Number of aggregated unicast packets */
|
|
|
|
uint64_t rx_agg_pkts;
|
|
|
|
/* Number of aggregated unicast bytes */
|
|
|
|
uint64_t rx_agg_bytes;
|
|
|
|
/* Number of aggregation events */
|
|
|
|
uint64_t rx_agg_events;
|
|
|
|
/* Number of aborted aggregations */
|
|
|
|
uint64_t rx_agg_aborts;
|
|
|
|
};
|
|
|
|
|
2016-06-15 21:23:02 +00:00
|
|
|
struct bnxt {
|
|
|
|
void *bar0;
|
|
|
|
|
|
|
|
struct rte_eth_dev *eth_dev;
|
|
|
|
struct rte_pci_device *pdev;
|
2018-04-20 14:22:00 +00:00
|
|
|
void *doorbell_base;
|
2020-12-20 05:24:25 +00:00
|
|
|
int legacy_db_size;
|
2016-06-15 21:23:02 +00:00
|
|
|
|
|
|
|
uint32_t flags;
|
2019-10-02 01:23:34 +00:00
|
|
|
#define BNXT_FLAG_REGISTERED BIT(0)
|
|
|
|
#define BNXT_FLAG_VF BIT(1)
|
|
|
|
#define BNXT_FLAG_PORT_STATS BIT(2)
|
|
|
|
#define BNXT_FLAG_JUMBO BIT(3)
|
|
|
|
#define BNXT_FLAG_SHORT_CMD BIT(4)
|
|
|
|
#define BNXT_FLAG_UPDATE_HASH BIT(5)
|
|
|
|
#define BNXT_FLAG_PTP_SUPPORTED BIT(6)
|
|
|
|
#define BNXT_FLAG_MULTI_HOST BIT(7)
|
|
|
|
#define BNXT_FLAG_EXT_RX_PORT_STATS BIT(8)
|
|
|
|
#define BNXT_FLAG_EXT_TX_PORT_STATS BIT(9)
|
|
|
|
#define BNXT_FLAG_KONG_MB_EN BIT(10)
|
|
|
|
#define BNXT_FLAG_TRUSTED_VF_EN BIT(11)
|
|
|
|
#define BNXT_FLAG_DFLT_VNIC_SET BIT(12)
|
2020-12-01 19:15:23 +00:00
|
|
|
#define BNXT_FLAG_CHIP_P5 BIT(13)
|
2019-10-02 01:23:34 +00:00
|
|
|
#define BNXT_FLAG_STINGRAY BIT(14)
|
|
|
|
#define BNXT_FLAG_FW_RESET BIT(15)
|
|
|
|
#define BNXT_FLAG_FATAL_ERROR BIT(16)
|
2019-12-10 15:05:29 +00:00
|
|
|
#define BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE BIT(17)
|
|
|
|
#define BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED BIT(18)
|
|
|
|
#define BNXT_FLAG_EXT_STATS_SUPPORTED BIT(19)
|
|
|
|
#define BNXT_FLAG_NEW_RM BIT(20)
|
2020-01-28 07:29:20 +00:00
|
|
|
#define BNXT_FLAG_NPAR_PF BIT(21)
|
2019-12-10 15:05:29 +00:00
|
|
|
#define BNXT_FLAG_FW_CAP_ONE_STEP_TX_TS BIT(22)
|
2020-04-16 04:27:01 +00:00
|
|
|
#define BNXT_FLAG_FC_THREAD BIT(23)
|
2019-12-21 02:38:49 +00:00
|
|
|
#define BNXT_FLAG_RX_VECTOR_PKT_MODE BIT(24)
|
2020-05-15 08:31:59 +00:00
|
|
|
#define BNXT_FLAG_FLOW_XSTATS_EN BIT(25)
|
2020-05-15 05:04:36 +00:00
|
|
|
#define BNXT_FLAG_DFLT_MAC_SET BIT(26)
|
2021-05-30 08:58:57 +00:00
|
|
|
#define BNXT_FLAG_GFID_ENABLE BIT(27)
|
|
|
|
#define BNXT_FLAG_RFS_NEEDS_VNIC BIT(28)
|
|
|
|
#define BNXT_FLAG_FLOW_CFA_RFS_RING_TBL_IDX_V2 BIT(29)
|
2020-12-20 05:24:27 +00:00
|
|
|
#define BNXT_RFS_NEEDS_VNIC(bp) ((bp)->flags & BNXT_FLAG_RFS_NEEDS_VNIC)
|
2016-06-15 21:23:02 +00:00
|
|
|
#define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF))
|
|
|
|
#define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF)
|
2020-01-28 07:29:20 +00:00
|
|
|
#define BNXT_NPAR(bp) ((bp)->flags & BNXT_FLAG_NPAR_PF)
|
2018-01-08 20:24:30 +00:00
|
|
|
#define BNXT_MH(bp) ((bp)->flags & BNXT_FLAG_MULTI_HOST)
|
|
|
|
#define BNXT_SINGLE_PF(bp) (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp))
|
2018-09-29 01:59:59 +00:00
|
|
|
#define BNXT_USE_CHIMP_MB 0 //For non-CFA commands, everything uses Chimp.
|
|
|
|
#define BNXT_USE_KONG(bp) ((bp)->flags & BNXT_FLAG_KONG_MB_EN)
|
2018-09-29 02:00:00 +00:00
|
|
|
#define BNXT_VF_IS_TRUSTED(bp) ((bp)->flags & BNXT_FLAG_TRUSTED_VF_EN)
|
2020-12-01 19:15:23 +00:00
|
|
|
#define BNXT_CHIP_P5(bp) ((bp)->flags & BNXT_FLAG_CHIP_P5)
|
2019-07-24 16:49:32 +00:00
|
|
|
#define BNXT_STINGRAY(bp) ((bp)->flags & BNXT_FLAG_STINGRAY)
|
2020-12-01 19:15:23 +00:00
|
|
|
#define BNXT_HAS_NQ(bp) BNXT_CHIP_P5(bp)
|
|
|
|
#define BNXT_HAS_RING_GRPS(bp) (!BNXT_CHIP_P5(bp))
|
2020-05-15 08:31:59 +00:00
|
|
|
#define BNXT_FLOW_XSTATS_EN(bp) ((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
|
2020-05-15 05:04:36 +00:00
|
|
|
#define BNXT_HAS_DFLT_MAC_SET(bp) ((bp)->flags & BNXT_FLAG_DFLT_MAC_SET)
|
2020-06-12 12:50:21 +00:00
|
|
|
#define BNXT_GFID_ENABLED(bp) ((bp)->flags & BNXT_FLAG_GFID_ENABLE)
|
2016-06-15 21:23:02 +00:00
|
|
|
|
2021-02-24 15:55:53 +00:00
|
|
|
uint32_t flags2;
|
|
|
|
#define BNXT_FLAGS2_PTP_TIMESYNC_ENABLED BIT(0)
|
|
|
|
#define BNXT_FLAGS2_PTP_ALARM_SCHEDULED BIT(1)
|
2021-05-30 08:59:15 +00:00
|
|
|
#define BNXT_FLAGS2_ACCUM_STATS_EN BIT(2)
|
2021-02-24 15:55:53 +00:00
|
|
|
#define BNXT_P5_PTP_TIMESYNC_ENABLED(bp) \
|
|
|
|
((bp)->flags2 & BNXT_FLAGS2_PTP_TIMESYNC_ENABLED)
|
2021-05-30 08:59:15 +00:00
|
|
|
#define BNXT_ACCUM_STATS_EN(bp) \
|
|
|
|
((bp)->flags2 & BNXT_FLAGS2_ACCUM_STATS_EN)
|
2021-02-24 15:55:53 +00:00
|
|
|
|
2020-12-20 05:24:25 +00:00
|
|
|
uint16_t chip_num;
|
|
|
|
#define CHIP_NUM_58818 0xd818
|
|
|
|
#define BNXT_CHIP_SR2(bp) ((bp)->chip_num == CHIP_NUM_58818)
|
|
|
|
|
2019-12-10 15:05:29 +00:00
|
|
|
uint32_t fw_cap;
|
|
|
|
#define BNXT_FW_CAP_HOT_RESET BIT(0)
|
|
|
|
#define BNXT_FW_CAP_IF_CHANGE BIT(1)
|
|
|
|
#define BNXT_FW_CAP_ERROR_RECOVERY BIT(2)
|
|
|
|
#define BNXT_FW_CAP_ERR_RECOVER_RELOAD BIT(3)
|
2020-10-09 11:11:21 +00:00
|
|
|
#define BNXT_FW_CAP_HCOMM_FW_STATUS BIT(4)
|
2020-04-16 04:27:01 +00:00
|
|
|
#define BNXT_FW_CAP_ADV_FLOW_MGMT BIT(5)
|
|
|
|
#define BNXT_FW_CAP_ADV_FLOW_COUNTERS BIT(6)
|
2020-10-09 11:11:21 +00:00
|
|
|
#define BNXT_FW_CAP_LINK_ADMIN BIT(7)
|
2021-05-30 08:58:57 +00:00
|
|
|
#define BNXT_FW_CAP_TRUFLOW_EN BIT(8)
|
|
|
|
#define BNXT_TRUFLOW_EN(bp) ((bp)->fw_cap & BNXT_FW_CAP_TRUFLOW_EN)
|
2019-12-10 15:05:29 +00:00
|
|
|
|
2019-10-02 23:25:57 +00:00
|
|
|
pthread_mutex_t flow_lock;
|
2019-10-04 03:48:58 +00:00
|
|
|
|
|
|
|
uint32_t vnic_cap_flags;
|
|
|
|
#define BNXT_VNIC_CAP_COS_CLASSIFY BIT(0)
|
2020-09-18 23:33:41 +00:00
|
|
|
#define BNXT_VNIC_CAP_OUTER_RSS BIT(1)
|
2020-12-20 05:24:26 +00:00
|
|
|
#define BNXT_VNIC_CAP_RX_CMPL_V2 BIT(2)
|
2016-06-15 21:23:05 +00:00
|
|
|
unsigned int rx_nr_rings;
|
|
|
|
unsigned int rx_cp_nr_rings;
|
2019-10-02 23:25:43 +00:00
|
|
|
unsigned int rx_num_qs_per_vnic;
|
2016-06-15 21:23:05 +00:00
|
|
|
struct bnxt_rx_queue **rx_queues;
|
2017-06-01 17:07:04 +00:00
|
|
|
const void *rx_mem_zone;
|
|
|
|
struct rx_port_stats *hw_rx_port_stats;
|
2017-10-20 12:31:31 +00:00
|
|
|
rte_iova_t hw_rx_port_stats_map;
|
2018-09-29 01:59:58 +00:00
|
|
|
struct rx_port_stats_ext *hw_rx_port_stats_ext;
|
|
|
|
rte_iova_t hw_rx_port_stats_ext_map;
|
|
|
|
uint16_t fw_rx_port_stats_ext_size;
|
2016-06-15 21:23:05 +00:00
|
|
|
|
|
|
|
unsigned int tx_nr_rings;
|
|
|
|
unsigned int tx_cp_nr_rings;
|
|
|
|
struct bnxt_tx_queue **tx_queues;
|
2017-06-01 17:07:04 +00:00
|
|
|
const void *tx_mem_zone;
|
|
|
|
struct tx_port_stats *hw_tx_port_stats;
|
2017-10-20 12:31:31 +00:00
|
|
|
rte_iova_t hw_tx_port_stats_map;
|
2018-09-29 01:59:58 +00:00
|
|
|
struct tx_port_stats_ext *hw_tx_port_stats_ext;
|
|
|
|
rte_iova_t hw_tx_port_stats_ext_map;
|
|
|
|
uint16_t fw_tx_port_stats_ext_size;
|
2016-06-15 21:23:05 +00:00
|
|
|
|
2016-06-15 21:23:08 +00:00
|
|
|
/* Default completion ring */
|
2019-07-24 16:49:32 +00:00
|
|
|
struct bnxt_cp_ring_info *async_cp_ring;
|
2019-10-04 03:48:59 +00:00
|
|
|
struct bnxt_cp_ring_info *rxtx_nq_ring;
|
2016-06-15 21:23:17 +00:00
|
|
|
uint32_t max_ring_grps;
|
|
|
|
struct bnxt_ring_grp_info *grp_info;
|
2016-06-15 21:23:08 +00:00
|
|
|
|
2021-04-28 22:03:44 +00:00
|
|
|
uint16_t nr_vnics;
|
2016-06-15 21:23:11 +00:00
|
|
|
|
2019-07-18 03:36:14 +00:00
|
|
|
#define BNXT_GET_DEFAULT_VNIC(bp) (&(bp)->vnic_info[0])
|
2016-06-15 21:23:06 +00:00
|
|
|
struct bnxt_vnic_info *vnic_info;
|
|
|
|
STAILQ_HEAD(, bnxt_vnic_info) free_vnic_list;
|
|
|
|
|
2016-06-15 21:23:09 +00:00
|
|
|
struct bnxt_filter_info *filter_info;
|
|
|
|
STAILQ_HEAD(, bnxt_filter_info) free_filter_list;
|
|
|
|
|
2016-10-11 21:47:50 +00:00
|
|
|
struct bnxt_irq *irq_tbl;
|
|
|
|
|
2019-05-21 16:13:05 +00:00
|
|
|
uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
|
2016-06-15 21:23:02 +00:00
|
|
|
|
2020-04-15 08:18:39 +00:00
|
|
|
uint16_t chimp_cmd_seq;
|
2018-09-29 01:59:59 +00:00
|
|
|
uint16_t kong_cmd_seq;
|
2016-06-15 21:23:02 +00:00
|
|
|
void *hwrm_cmd_resp_addr;
|
2017-10-20 12:31:31 +00:00
|
|
|
rte_iova_t hwrm_cmd_resp_dma_addr;
|
2017-06-30 14:20:13 +00:00
|
|
|
void *hwrm_short_cmd_req_addr;
|
2017-10-20 12:31:31 +00:00
|
|
|
rte_iova_t hwrm_short_cmd_req_dma_addr;
|
2016-06-15 21:23:02 +00:00
|
|
|
rte_spinlock_t hwrm_lock;
|
2020-12-06 21:59:28 +00:00
|
|
|
/* synchronize between dev_configure_op and int handler */
|
2019-10-11 04:44:16 +00:00
|
|
|
pthread_mutex_t def_cp_lock;
|
2020-12-06 21:59:28 +00:00
|
|
|
/* synchronize between dev_start_op and async evt handler
|
|
|
|
* Locking sequence in async evt handler will be
|
|
|
|
* def_cp_lock
|
|
|
|
* health_check_lock
|
|
|
|
*/
|
2020-09-11 01:56:03 +00:00
|
|
|
pthread_mutex_t health_check_lock;
|
2020-12-24 09:37:34 +00:00
|
|
|
/* synchronize between dev_stop/dev_close_op and
|
|
|
|
* error recovery thread triggered as part of
|
|
|
|
* HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY
|
|
|
|
*/
|
|
|
|
pthread_mutex_t err_recovery_lock;
|
2016-06-15 21:23:02 +00:00
|
|
|
uint16_t max_req_len;
|
|
|
|
uint16_t max_resp_len;
|
2019-06-02 17:42:41 +00:00
|
|
|
uint16_t hwrm_max_ext_req_len;
|
2016-06-15 21:23:02 +00:00
|
|
|
|
2020-02-06 16:33:09 +00:00
|
|
|
/* default command timeout value of 500ms */
|
|
|
|
#define DFLT_HWRM_CMD_TIMEOUT 500000
|
|
|
|
/* short command timeout value of 50ms */
|
|
|
|
#define SHORT_HWRM_CMD_TIMEOUT 50000
|
2019-10-10 01:41:47 +00:00
|
|
|
/* default HWRM request timeout value */
|
|
|
|
uint32_t hwrm_cmd_timeout;
|
|
|
|
|
2020-05-15 11:05:15 +00:00
|
|
|
struct bnxt_link_info *link_info;
|
2020-05-15 18:07:32 +00:00
|
|
|
struct bnxt_cos_queue_info *rx_cos_queue;
|
|
|
|
struct bnxt_cos_queue_info *tx_cos_queue;
|
2019-10-04 03:48:58 +00:00
|
|
|
uint8_t tx_cosq_id[BNXT_COS_QUEUE_COUNT];
|
|
|
|
uint8_t rx_cosq_cnt;
|
2019-06-02 17:42:44 +00:00
|
|
|
uint8_t max_tc;
|
|
|
|
uint8_t max_lltc;
|
|
|
|
uint8_t max_q;
|
2016-06-15 21:23:02 +00:00
|
|
|
|
2017-06-01 17:06:59 +00:00
|
|
|
uint16_t fw_fid;
|
|
|
|
uint16_t max_rsscos_ctx;
|
|
|
|
uint16_t max_cp_rings;
|
|
|
|
uint16_t max_tx_rings;
|
|
|
|
uint16_t max_rx_rings;
|
2020-08-25 07:46:33 +00:00
|
|
|
#define MAX_STINGRAY_RINGS 236U
|
2020-07-02 23:27:48 +00:00
|
|
|
#define BNXT_MAX_VF_REP_RINGS 8
|
|
|
|
|
2019-06-02 17:42:44 +00:00
|
|
|
uint16_t max_nq_rings;
|
2017-06-01 17:06:59 +00:00
|
|
|
uint16_t max_l2_ctx;
|
2019-07-17 10:41:32 +00:00
|
|
|
uint16_t max_rx_em_flows;
|
2017-06-01 17:06:59 +00:00
|
|
|
uint16_t max_vnics;
|
|
|
|
uint16_t max_stat_ctx;
|
2019-10-04 03:48:57 +00:00
|
|
|
uint16_t max_tpa_v2;
|
2019-06-08 19:22:03 +00:00
|
|
|
uint16_t first_vf_id;
|
2017-06-01 17:06:59 +00:00
|
|
|
uint16_t vlan;
|
2019-10-02 17:17:44 +00:00
|
|
|
#define BNXT_OUTER_TPID_MASK 0x0000ffff
|
|
|
|
#define BNXT_OUTER_TPID_BD_MASK 0xffff0000
|
|
|
|
#define BNXT_OUTER_TPID_BD_SHFT 16
|
|
|
|
uint32_t outer_tpid_bd;
|
2020-05-15 11:10:41 +00:00
|
|
|
struct bnxt_pf_info *pf;
|
2020-07-02 23:27:51 +00:00
|
|
|
struct bnxt_parent_info *parent;
|
2020-07-02 23:27:54 +00:00
|
|
|
uint8_t port_cnt;
|
2017-06-01 17:07:03 +00:00
|
|
|
uint8_t vxlan_port_cnt;
|
|
|
|
uint8_t geneve_port_cnt;
|
|
|
|
uint16_t vxlan_port;
|
|
|
|
uint16_t geneve_port;
|
|
|
|
uint16_t vxlan_fw_dst_port_id;
|
|
|
|
uint16_t geneve_fw_dst_port_id;
|
2017-06-01 17:06:59 +00:00
|
|
|
uint32_t fw_ver;
|
2018-04-17 01:11:20 +00:00
|
|
|
uint32_t hwrm_spec_code;
|
2017-06-01 17:07:15 +00:00
|
|
|
|
2020-05-15 07:01:51 +00:00
|
|
|
struct bnxt_led_info *leds;
|
2017-12-05 07:26:56 +00:00
|
|
|
struct bnxt_ptp_cfg *ptp_cfg;
|
2018-06-28 20:15:47 +00:00
|
|
|
uint16_t vf_resv_strategy;
|
2019-06-02 17:42:44 +00:00
|
|
|
struct bnxt_ctx_mem_info *ctx;
|
2019-10-02 01:23:23 +00:00
|
|
|
|
|
|
|
uint16_t fw_reset_min_msecs;
|
|
|
|
uint16_t fw_reset_max_msecs;
|
2020-07-02 23:27:48 +00:00
|
|
|
uint16_t switch_domain_id;
|
|
|
|
uint16_t num_reps;
|
2020-07-02 23:27:49 +00:00
|
|
|
struct bnxt_rep_info *rep_info;
|
|
|
|
uint16_t *cfa_code_map;
|
2019-10-02 01:23:26 +00:00
|
|
|
/* Struct to hold adapter error recovery related info */
|
|
|
|
struct bnxt_error_recovery_info *recovery_info;
|
2020-01-28 07:29:22 +00:00
|
|
|
#define BNXT_MARK_TABLE_SZ (sizeof(struct bnxt_mark_info) * 64 * 1024)
|
2019-12-21 02:38:49 +00:00
|
|
|
/* TCAM and EM should be 16-bit only. Other modes not supported. */
|
|
|
|
#define BNXT_FLOW_ID_MASK 0x0000ffff
|
2020-01-28 07:29:22 +00:00
|
|
|
struct bnxt_mark_info *mark_table;
|
2020-04-15 08:18:41 +00:00
|
|
|
|
2020-04-15 08:18:50 +00:00
|
|
|
#define BNXT_SVIF_INVALID 0xFFFF
|
|
|
|
uint16_t func_svif;
|
|
|
|
uint16_t port_svif;
|
2020-04-15 08:18:52 +00:00
|
|
|
|
|
|
|
struct tf tfp;
|
2020-05-12 20:25:28 +00:00
|
|
|
struct bnxt_ulp_context *ulp_ctx;
|
2020-05-15 08:31:59 +00:00
|
|
|
struct bnxt_flow_stat_info *flow_stat;
|
2020-06-12 12:50:12 +00:00
|
|
|
uint16_t max_num_kflows;
|
2020-07-23 11:56:33 +00:00
|
|
|
uint16_t tx_cfa_action;
|
2021-05-31 05:53:01 +00:00
|
|
|
struct bnxt_ring_stats *prev_rx_ring_stats;
|
|
|
|
struct bnxt_ring_stats *prev_tx_ring_stats;
|
2017-06-01 17:06:59 +00:00
|
|
|
};
|
|
|
|
|
2020-08-28 11:13:22 +00:00
|
|
|
static
|
|
|
|
inline uint16_t bnxt_max_rings(struct bnxt *bp)
|
|
|
|
{
|
|
|
|
uint16_t max_tx_rings = bp->max_tx_rings;
|
|
|
|
uint16_t max_rx_rings = bp->max_rx_rings;
|
|
|
|
uint16_t max_cp_rings = bp->max_cp_rings;
|
|
|
|
uint16_t max_rings;
|
|
|
|
|
|
|
|
/* For the sake of symmetry:
|
|
|
|
* max Tx rings == max Rx rings, one stat ctx for each.
|
|
|
|
*/
|
|
|
|
if (BNXT_STINGRAY(bp)) {
|
|
|
|
max_rx_rings = RTE_MIN(RTE_MIN(max_rx_rings / 2U,
|
|
|
|
MAX_STINGRAY_RINGS),
|
|
|
|
bp->max_stat_ctx / 2U);
|
|
|
|
} else {
|
|
|
|
max_rx_rings = RTE_MIN(max_rx_rings / 2U,
|
|
|
|
bp->max_stat_ctx / 2U);
|
|
|
|
}
|
|
|
|
|
2021-04-30 20:14:13 +00:00
|
|
|
/*
|
|
|
|
* RSS table size in Thor is 512.
|
|
|
|
* Cap max Rx rings to the same value for RSS.
|
|
|
|
*/
|
|
|
|
if (BNXT_CHIP_P5(bp))
|
|
|
|
max_rx_rings = RTE_MIN(max_rx_rings, BNXT_RSS_TBL_SIZE_P5);
|
2021-04-14 23:44:49 +00:00
|
|
|
|
2020-08-28 11:13:22 +00:00
|
|
|
max_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);
|
|
|
|
if (max_cp_rings > BNXT_NUM_ASYNC_CPR(bp))
|
|
|
|
max_cp_rings -= BNXT_NUM_ASYNC_CPR(bp);
|
|
|
|
max_rings = RTE_MIN(max_cp_rings / 2U, max_tx_rings);
|
|
|
|
|
|
|
|
return max_rings;
|
|
|
|
}
|
|
|
|
|
2020-04-16 04:27:01 +00:00
|
|
|
#define BNXT_FC_TIMER 1 /* Timer freq in Sec Flow Counters */
|
|
|
|
|
2020-07-02 23:27:48 +00:00
|
|
|
/**
|
|
|
|
* Structure to store private data for each VF representor instance
|
|
|
|
*/
|
net/bnxt: support representors on remote host domain
In the Stingray use case, representors are conventionally run
inside the SoC domain representing functions that are on the
X86 domain. In order to support this mechanism of building
representors for endpoints that are not in the same host domain,
additional dev args have been in the PMD like so:
rep-based-pf=<physical index> rep-is-pf=<VF=0 or PF=1>
where `rep-based-pf` specifies the physical index of the base PF
that the representor is derived off of.
Since representor(s) can be created for endpoint PFs as well,
rename struct bnxt_vf_representor to bnxt_representor and other such
dev_ops and function names.
devargs have also been extended to specify the exact CoS queue along
with flow control enablement to be used for the conduit between the
representor and the endpoint function.
This is how a sample devargs would look with all the extended devargs
-w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,
rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
Call CFA_PAIR_ALLOC only in case of Stingray instead of CFA_VFR_ALLOC.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-09-22 07:06:30 +00:00
|
|
|
struct bnxt_representor {
|
2020-07-02 23:27:49 +00:00
|
|
|
uint16_t switch_domain_id;
|
|
|
|
uint16_t vf_id;
|
net/bnxt: support representors on remote host domain
In the Stingray use case, representors are conventionally run
inside the SoC domain representing functions that are on the
X86 domain. In order to support this mechanism of building
representors for endpoints that are not in the same host domain,
additional dev args have been in the PMD like so:
rep-based-pf=<physical index> rep-is-pf=<VF=0 or PF=1>
where `rep-based-pf` specifies the physical index of the base PF
that the representor is derived off of.
Since representor(s) can be created for endpoint PFs as well,
rename struct bnxt_vf_representor to bnxt_representor and other such
dev_ops and function names.
devargs have also been extended to specify the exact CoS queue along
with flow control enablement to be used for the conduit between the
representor and the endpoint function.
This is how a sample devargs would look with all the extended devargs
-w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,
rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
Call CFA_PAIR_ALLOC only in case of Stingray instead of CFA_VFR_ALLOC.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-09-22 07:06:30 +00:00
|
|
|
#define BNXT_REP_IS_PF BIT(0)
|
|
|
|
#define BNXT_REP_Q_R2F_VALID BIT(1)
|
|
|
|
#define BNXT_REP_Q_F2R_VALID BIT(2)
|
|
|
|
#define BNXT_REP_FC_R2F_VALID BIT(3)
|
|
|
|
#define BNXT_REP_FC_F2R_VALID BIT(4)
|
2020-10-26 03:56:08 +00:00
|
|
|
#define BNXT_REP_BASED_PF_VALID BIT(5)
|
net/bnxt: support representors on remote host domain
In the Stingray use case, representors are conventionally run
inside the SoC domain representing functions that are on the
X86 domain. In order to support this mechanism of building
representors for endpoints that are not in the same host domain,
additional dev args have been in the PMD like so:
rep-based-pf=<physical index> rep-is-pf=<VF=0 or PF=1>
where `rep-based-pf` specifies the physical index of the base PF
that the representor is derived off of.
Since representor(s) can be created for endpoint PFs as well,
rename struct bnxt_vf_representor to bnxt_representor and other such
dev_ops and function names.
devargs have also been extended to specify the exact CoS queue along
with flow control enablement to be used for the conduit between the
representor and the endpoint function.
This is how a sample devargs would look with all the extended devargs
-w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,
rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
Call CFA_PAIR_ALLOC only in case of Stingray instead of CFA_VFR_ALLOC.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-09-22 07:06:30 +00:00
|
|
|
uint32_t flags;
|
2020-07-02 23:27:50 +00:00
|
|
|
uint16_t fw_fid;
|
2020-07-29 14:04:59 +00:00
|
|
|
#define BNXT_DFLT_VNIC_ID_INVALID 0xFFFF
|
2020-07-02 23:27:50 +00:00
|
|
|
uint16_t dflt_vnic_id;
|
|
|
|
uint16_t svif;
|
2020-07-23 11:56:33 +00:00
|
|
|
uint16_t vfr_tx_cfa_action;
|
2020-10-26 03:56:08 +00:00
|
|
|
uint8_t parent_pf_idx; /* Logical PF index */
|
2020-09-11 01:55:39 +00:00
|
|
|
uint32_t dpdk_port_id;
|
net/bnxt: support representors on remote host domain
In the Stingray use case, representors are conventionally run
inside the SoC domain representing functions that are on the
X86 domain. In order to support this mechanism of building
representors for endpoints that are not in the same host domain,
additional dev args have been in the PMD like so:
rep-based-pf=<physical index> rep-is-pf=<VF=0 or PF=1>
where `rep-based-pf` specifies the physical index of the base PF
that the representor is derived off of.
Since representor(s) can be created for endpoint PFs as well,
rename struct bnxt_vf_representor to bnxt_representor and other such
dev_ops and function names.
devargs have also been extended to specify the exact CoS queue along
with flow control enablement to be used for the conduit between the
representor and the endpoint function.
This is how a sample devargs would look with all the extended devargs
-w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,
rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
Call CFA_PAIR_ALLOC only in case of Stingray instead of CFA_VFR_ALLOC.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-09-22 07:06:30 +00:00
|
|
|
uint32_t rep_based_pf;
|
|
|
|
uint8_t rep_q_r2f;
|
|
|
|
uint8_t rep_q_f2r;
|
|
|
|
uint8_t rep_fc_r2f;
|
|
|
|
uint8_t rep_fc_f2r;
|
2020-07-02 23:27:48 +00:00
|
|
|
/* Private data store of associated PF/Trusted VF */
|
2020-07-02 23:27:49 +00:00
|
|
|
struct rte_eth_dev *parent_dev;
|
|
|
|
uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
|
|
|
|
uint8_t dflt_mac_addr[RTE_ETHER_ADDR_LEN];
|
|
|
|
struct bnxt_rx_queue **rx_queues;
|
|
|
|
unsigned int rx_nr_rings;
|
|
|
|
unsigned int tx_nr_rings;
|
|
|
|
uint64_t tx_pkts[BNXT_MAX_VF_REP_RINGS];
|
|
|
|
uint64_t tx_bytes[BNXT_MAX_VF_REP_RINGS];
|
|
|
|
uint64_t rx_pkts[BNXT_MAX_VF_REP_RINGS];
|
|
|
|
uint64_t rx_bytes[BNXT_MAX_VF_REP_RINGS];
|
|
|
|
uint64_t rx_drop_pkts[BNXT_MAX_VF_REP_RINGS];
|
|
|
|
uint64_t rx_drop_bytes[BNXT_MAX_VF_REP_RINGS];
|
|
|
|
};
|
|
|
|
|
2020-10-26 03:56:08 +00:00
|
|
|
#define BNXT_REP_PF(vfr_bp) ((vfr_bp)->flags & BNXT_REP_IS_PF)
|
|
|
|
#define BNXT_REP_BASED_PF(vfr_bp) \
|
|
|
|
((vfr_bp)->flags & BNXT_REP_BASED_PF_VALID)
|
net/bnxt: support representors on remote host domain
In the Stingray use case, representors are conventionally run
inside the SoC domain representing functions that are on the
X86 domain. In order to support this mechanism of building
representors for endpoints that are not in the same host domain,
additional dev args have been in the PMD like so:
rep-based-pf=<physical index> rep-is-pf=<VF=0 or PF=1>
where `rep-based-pf` specifies the physical index of the base PF
that the representor is derived off of.
Since representor(s) can be created for endpoint PFs as well,
rename struct bnxt_vf_representor to bnxt_representor and other such
dev_ops and function names.
devargs have also been extended to specify the exact CoS queue along
with flow control enablement to be used for the conduit between the
representor and the endpoint function.
This is how a sample devargs would look with all the extended devargs
-w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,
rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
Call CFA_PAIR_ALLOC only in case of Stingray instead of CFA_VFR_ALLOC.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-09-22 07:06:30 +00:00
|
|
|
|
2020-07-02 23:27:49 +00:00
|
|
|
struct bnxt_vf_rep_tx_queue {
|
|
|
|
struct bnxt_tx_queue *txq;
|
net/bnxt: support representors on remote host domain
In the Stingray use case, representors are conventionally run
inside the SoC domain representing functions that are on the
X86 domain. In order to support this mechanism of building
representors for endpoints that are not in the same host domain,
additional dev args have been in the PMD like so:
rep-based-pf=<physical index> rep-is-pf=<VF=0 or PF=1>
where `rep-based-pf` specifies the physical index of the base PF
that the representor is derived off of.
Since representor(s) can be created for endpoint PFs as well,
rename struct bnxt_vf_representor to bnxt_representor and other such
dev_ops and function names.
devargs have also been extended to specify the exact CoS queue along
with flow control enablement to be used for the conduit between the
representor and the endpoint function.
This is how a sample devargs would look with all the extended devargs
-w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,
rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
Call CFA_PAIR_ALLOC only in case of Stingray instead of CFA_VFR_ALLOC.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-09-22 07:06:30 +00:00
|
|
|
struct bnxt_representor *bp;
|
2020-07-02 23:27:48 +00:00
|
|
|
};
|
|
|
|
|
2019-10-24 07:44:27 +00:00
|
|
|
int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
|
2019-12-21 02:29:35 +00:00
|
|
|
int bnxt_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete,
|
|
|
|
bool exp_link_status);
|
2017-06-01 17:06:59 +00:00
|
|
|
int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
|
2019-10-02 01:23:22 +00:00
|
|
|
int is_bnxt_in_error(struct bnxt *bp);
|
2016-10-11 21:47:50 +00:00
|
|
|
|
2019-10-02 01:23:27 +00:00
|
|
|
int bnxt_map_fw_health_status_regs(struct bnxt *bp);
|
2019-10-02 01:23:29 +00:00
|
|
|
uint32_t bnxt_read_fw_status_reg(struct bnxt *bp, uint32_t index);
|
|
|
|
void bnxt_schedule_fw_health_check(struct bnxt *bp);
|
2019-10-02 01:23:27 +00:00
|
|
|
|
2017-06-01 17:07:16 +00:00
|
|
|
bool is_bnxt_supported(struct rte_eth_dev *dev);
|
2018-06-28 20:15:32 +00:00
|
|
|
bool bnxt_stratus_device(struct bnxt *bp);
|
2020-07-02 23:27:48 +00:00
|
|
|
void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
|
|
|
|
uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp);
|
|
|
|
int bnxt_link_update_op(struct rte_eth_dev *eth_dev,
|
|
|
|
int wait_to_complete);
|
2020-10-26 03:56:16 +00:00
|
|
|
uint16_t bnxt_dummy_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
|
|
|
|
uint16_t nb_pkts);
|
|
|
|
uint16_t bnxt_dummy_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
|
|
|
|
uint16_t nb_pkts);
|
2020-07-02 23:27:48 +00:00
|
|
|
|
2017-09-28 21:43:39 +00:00
|
|
|
extern const struct rte_flow_ops bnxt_flow_ops;
|
2020-07-02 23:27:48 +00:00
|
|
|
|
2019-10-02 23:25:57 +00:00
|
|
|
#define bnxt_acquire_flow_lock(bp) \
|
|
|
|
pthread_mutex_lock(&(bp)->flow_lock)
|
|
|
|
|
|
|
|
#define bnxt_release_flow_lock(bp) \
|
|
|
|
pthread_mutex_unlock(&(bp)->flow_lock)
|
2018-01-26 17:31:55 +00:00
|
|
|
|
2020-01-28 07:29:17 +00:00
|
|
|
#define BNXT_VALID_VNIC_OR_RET(bp, vnic_id) do { \
|
|
|
|
if ((vnic_id) >= (bp)->max_vnics) { \
|
|
|
|
rte_flow_error_set(error, \
|
|
|
|
EINVAL, \
|
|
|
|
RTE_FLOW_ERROR_TYPE_ATTR_GROUP, \
|
|
|
|
NULL, \
|
|
|
|
"Group id is invalid!"); \
|
|
|
|
rc = -rte_errno; \
|
|
|
|
goto ret; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2020-07-02 23:27:53 +00:00
|
|
|
#define BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev) \
|
|
|
|
((eth_dev)->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
|
|
|
|
|
2018-01-26 17:31:55 +00:00
|
|
|
extern int bnxt_logtype_driver;
|
|
|
|
#define PMD_DRV_LOG_RAW(level, fmt, args...) \
|
|
|
|
rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
|
|
|
|
__func__, ## args)
|
|
|
|
|
|
|
|
#define PMD_DRV_LOG(level, fmt, args...) \
|
2020-01-28 07:29:17 +00:00
|
|
|
PMD_DRV_LOG_RAW(level, fmt, ## args)
|
2020-04-15 08:18:50 +00:00
|
|
|
|
2020-04-15 08:19:08 +00:00
|
|
|
extern const struct rte_flow_ops bnxt_ulp_rte_flow_ops;
|
2020-09-11 01:55:39 +00:00
|
|
|
int32_t bnxt_ulp_port_init(struct bnxt *bp);
|
|
|
|
void bnxt_ulp_port_deinit(struct bnxt *bp);
|
2020-07-23 11:56:33 +00:00
|
|
|
int32_t bnxt_ulp_create_df_rules(struct bnxt *bp);
|
|
|
|
void bnxt_ulp_destroy_df_rules(struct bnxt *bp, bool global);
|
2020-09-11 01:55:39 +00:00
|
|
|
int32_t
|
|
|
|
bnxt_ulp_create_vfr_default_rules(struct rte_eth_dev *vfr_ethdev);
|
|
|
|
int32_t
|
net/bnxt: support representors on remote host domain
In the Stingray use case, representors are conventionally run
inside the SoC domain representing functions that are on the
X86 domain. In order to support this mechanism of building
representors for endpoints that are not in the same host domain,
additional dev args have been in the PMD like so:
rep-based-pf=<physical index> rep-is-pf=<VF=0 or PF=1>
where `rep-based-pf` specifies the physical index of the base PF
that the representor is derived off of.
Since representor(s) can be created for endpoint PFs as well,
rename struct bnxt_vf_representor to bnxt_representor and other such
dev_ops and function names.
devargs have also been extended to specify the exact CoS queue along
with flow control enablement to be used for the conduit between the
representor and the endpoint function.
This is how a sample devargs would look with all the extended devargs
-w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,
rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
Call CFA_PAIR_ALLOC only in case of Stingray instead of CFA_VFR_ALLOC.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-09-22 07:06:30 +00:00
|
|
|
bnxt_ulp_delete_vfr_default_rules(struct bnxt_representor *vfr);
|
2021-05-30 08:59:15 +00:00
|
|
|
void bnxt_get_iface_mac(uint16_t port, enum bnxt_ulp_intf_type type,
|
|
|
|
uint8_t *mac, uint8_t *parent_mac);
|
2020-07-02 23:28:28 +00:00
|
|
|
uint16_t bnxt_get_vnic_id(uint16_t port, enum bnxt_ulp_intf_type type);
|
2021-05-30 08:59:15 +00:00
|
|
|
uint16_t bnxt_get_parent_vnic_id(uint16_t port, enum bnxt_ulp_intf_type type);
|
2021-05-30 08:59:13 +00:00
|
|
|
struct bnxt *bnxt_get_bp(uint16_t port);
|
2020-07-02 23:28:28 +00:00
|
|
|
uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif,
|
|
|
|
enum bnxt_ulp_intf_type type);
|
|
|
|
uint16_t bnxt_get_fw_func_id(uint16_t port, enum bnxt_ulp_intf_type type);
|
|
|
|
uint16_t bnxt_get_parif(uint16_t port, enum bnxt_ulp_intf_type type);
|
2020-07-02 23:27:53 +00:00
|
|
|
uint16_t bnxt_get_phy_port_id(uint16_t port);
|
|
|
|
uint16_t bnxt_get_vport(uint16_t port);
|
|
|
|
enum bnxt_ulp_intf_type
|
|
|
|
bnxt_get_interface_type(uint16_t port);
|
net/bnxt: support representors on remote host domain
In the Stingray use case, representors are conventionally run
inside the SoC domain representing functions that are on the
X86 domain. In order to support this mechanism of building
representors for endpoints that are not in the same host domain,
additional dev args have been in the PMD like so:
rep-based-pf=<physical index> rep-is-pf=<VF=0 or PF=1>
where `rep-based-pf` specifies the physical index of the base PF
that the representor is derived off of.
Since representor(s) can be created for endpoint PFs as well,
rename struct bnxt_vf_representor to bnxt_representor and other such
dev_ops and function names.
devargs have also been extended to specify the exact CoS queue along
with flow control enablement to be used for the conduit between the
representor and the endpoint function.
This is how a sample devargs would look with all the extended devargs
-w 0000:06:02.0,host-based-truflow=1,representor=[1],rep-based-pf=8,
rep-is-pf=1,rep-q-r2f=1,rep-fc-r2f=0,rep-q-f2r=1,rep-fc-f2r=1
Call CFA_PAIR_ALLOC only in case of Stingray instead of CFA_VFR_ALLOC.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-09-22 07:06:30 +00:00
|
|
|
int bnxt_rep_dev_start_op(struct rte_eth_dev *eth_dev);
|
2020-04-15 08:18:50 +00:00
|
|
|
|
2020-04-16 04:27:01 +00:00
|
|
|
void bnxt_cancel_fc_thread(struct bnxt *bp);
|
|
|
|
void bnxt_flow_cnt_alarm_cb(void *arg);
|
|
|
|
int bnxt_flow_stats_req(struct bnxt *bp);
|
|
|
|
int bnxt_flow_stats_cnt(struct bnxt *bp);
|
2020-05-22 17:42:08 +00:00
|
|
|
uint32_t bnxt_get_speed_capabilities(struct bnxt *bp);
|
2021-03-21 09:00:00 +00:00
|
|
|
int bnxt_flow_ops_get_op(struct rte_eth_dev *dev,
|
|
|
|
const struct rte_flow_ops **ops);
|
2020-07-06 08:25:01 +00:00
|
|
|
|
2016-06-15 21:23:02 +00:00
|
|
|
#endif
|