2019-09-26 14:01:48 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2021-04-07 09:19:13 +00:00
|
|
|
* Copyright(c) 2018-2021 HiSilicon Limited.
|
2019-09-26 14:01:48 +00:00
|
|
|
*/
|
|
|
|
|
2022-09-30 07:22:13 +00:00
|
|
|
#ifndef HNS3_REGS_H
|
|
|
|
#define HNS3_REGS_H
|
2019-09-26 14:01:48 +00:00
|
|
|
|
2022-09-30 07:22:11 +00:00
|
|
|
#include <ethdev_driver.h>
|
|
|
|
#include <rte_dev_info.h>
|
|
|
|
|
2019-09-26 14:01:48 +00:00
|
|
|
/* bar registers for cmdq */
|
|
|
|
#define HNS3_CMDQ_TX_ADDR_L_REG 0x27000
|
|
|
|
#define HNS3_CMDQ_TX_ADDR_H_REG 0x27004
|
|
|
|
#define HNS3_CMDQ_TX_DEPTH_REG 0x27008
|
|
|
|
#define HNS3_CMDQ_TX_TAIL_REG 0x27010
|
|
|
|
#define HNS3_CMDQ_TX_HEAD_REG 0x27014
|
|
|
|
#define HNS3_CMDQ_RX_ADDR_L_REG 0x27018
|
|
|
|
#define HNS3_CMDQ_RX_ADDR_H_REG 0x2701c
|
|
|
|
#define HNS3_CMDQ_RX_DEPTH_REG 0x27020
|
|
|
|
#define HNS3_CMDQ_RX_TAIL_REG 0x27024
|
|
|
|
#define HNS3_CMDQ_RX_HEAD_REG 0x27028
|
|
|
|
#define HNS3_CMDQ_INTR_STS_REG 0x27104
|
|
|
|
#define HNS3_CMDQ_INTR_EN_REG 0x27108
|
|
|
|
#define HNS3_CMDQ_INTR_GEN_REG 0x2710C
|
|
|
|
|
|
|
|
/* Vector0 interrupt CMDQ event source register(RW) */
|
|
|
|
#define HNS3_VECTOR0_CMDQ_SRC_REG 0x27100
|
|
|
|
/* Vector0 interrupt CMDQ event status register(RO) */
|
|
|
|
#define HNS3_VECTOR0_CMDQ_STAT_REG 0x27104
|
|
|
|
|
|
|
|
#define HNS3_VECTOR0_OTHER_INT_STS_REG 0x20800
|
|
|
|
|
2020-08-25 11:52:59 +00:00
|
|
|
#define HNS3_RAS_PF_OTHER_INT_STS_REG 0x20B00
|
|
|
|
#define HNS3_RAS_REG_NFE_MASK 0xFF00
|
|
|
|
|
2019-09-26 14:01:48 +00:00
|
|
|
#define HNS3_MISC_VECTOR_REG_BASE 0x20400
|
|
|
|
#define HNS3_VECTOR0_OTER_EN_REG 0x20600
|
|
|
|
#define HNS3_MISC_RESET_STS_REG 0x20700
|
|
|
|
#define HNS3_GLOBAL_RESET_REG 0x20A00
|
|
|
|
#define HNS3_FUN_RST_ING 0x20C00
|
|
|
|
#define HNS3_GRO_EN_REG 0x28000
|
2021-03-23 11:21:04 +00:00
|
|
|
|
|
|
|
#define HNS3_RPU_DROP_CNT_REG 0x28004
|
2021-03-04 07:44:49 +00:00
|
|
|
#define HNS3_RXD_ADV_LAYOUT_EN_REG 0x28008
|
2019-09-26 14:01:48 +00:00
|
|
|
|
|
|
|
/* Vector0 register bits for reset */
|
|
|
|
#define HNS3_VECTOR0_FUNCRESET_INT_B 0
|
|
|
|
#define HNS3_VECTOR0_GLOBALRESET_INT_B 5
|
|
|
|
#define HNS3_VECTOR0_CORERESET_INT_B 6
|
|
|
|
#define HNS3_VECTOR0_IMPRESET_INT_B 7
|
|
|
|
|
|
|
|
/* CMDQ register bits for RX event(=MBX event) */
|
|
|
|
#define HNS3_VECTOR0_RX_CMDQ_INT_B 1
|
|
|
|
#define HNS3_VECTOR0_REG_MSIX_MASK 0x1FF00
|
|
|
|
/* RST register bits for RESET event */
|
|
|
|
#define HNS3_VECTOR0_RST_INT_B 2
|
|
|
|
|
|
|
|
#define HNS3_VF_RST_ING 0x07008
|
|
|
|
#define HNS3_VF_RST_ING_BIT BIT(16)
|
|
|
|
|
|
|
|
/* bar registers for rcb */
|
|
|
|
#define HNS3_RING_RX_BASEADDR_L_REG 0x00000
|
|
|
|
#define HNS3_RING_RX_BASEADDR_H_REG 0x00004
|
|
|
|
#define HNS3_RING_RX_BD_NUM_REG 0x00008
|
|
|
|
#define HNS3_RING_RX_BD_LEN_REG 0x0000C
|
|
|
|
#define HNS3_RING_RX_MERGE_EN_REG 0x00014
|
|
|
|
#define HNS3_RING_RX_TAIL_REG 0x00018
|
|
|
|
#define HNS3_RING_RX_HEAD_REG 0x0001C
|
|
|
|
#define HNS3_RING_RX_FBDNUM_REG 0x00020
|
|
|
|
#define HNS3_RING_RX_OFFSET_REG 0x00024
|
|
|
|
#define HNS3_RING_RX_FBD_OFFSET_REG 0x00028
|
|
|
|
#define HNS3_RING_RX_PKTNUM_RECORD_REG 0x0002C
|
|
|
|
#define HNS3_RING_RX_STASH_REG 0x00030
|
|
|
|
#define HNS3_RING_RX_BD_ERR_REG 0x00034
|
|
|
|
|
|
|
|
#define HNS3_RING_TX_BASEADDR_L_REG 0x00040
|
|
|
|
#define HNS3_RING_TX_BASEADDR_H_REG 0x00044
|
|
|
|
#define HNS3_RING_TX_BD_NUM_REG 0x00048
|
|
|
|
#define HNS3_RING_TX_PRIORITY_REG 0x0004C
|
|
|
|
#define HNS3_RING_TX_TC_REG 0x00050
|
|
|
|
#define HNS3_RING_TX_MERGE_EN_REG 0x00054
|
|
|
|
#define HNS3_RING_TX_TAIL_REG 0x00058
|
|
|
|
#define HNS3_RING_TX_HEAD_REG 0x0005C
|
|
|
|
#define HNS3_RING_TX_FBDNUM_REG 0x00060
|
|
|
|
#define HNS3_RING_TX_OFFSET_REG 0x00064
|
|
|
|
#define HNS3_RING_TX_EBD_NUM_REG 0x00068
|
|
|
|
#define HNS3_RING_TX_PKTNUM_RECORD_REG 0x0006C
|
|
|
|
#define HNS3_RING_TX_EBD_OFFSET_REG 0x00070
|
|
|
|
#define HNS3_RING_TX_BD_ERR_REG 0x00074
|
|
|
|
|
|
|
|
#define HNS3_RING_EN_REG 0x00090
|
2020-09-29 12:01:15 +00:00
|
|
|
#define HNS3_RING_RX_EN_REG 0x00098
|
|
|
|
#define HNS3_RING_TX_EN_REG 0x000d4
|
2019-09-26 14:01:48 +00:00
|
|
|
|
|
|
|
#define HNS3_RING_EN_B 0
|
|
|
|
|
|
|
|
#define HNS3_TQP_REG_OFFSET 0x80000
|
|
|
|
#define HNS3_TQP_REG_SIZE 0x200
|
|
|
|
|
net/hns3: maximize queue number
The maximum number of queues for hns3 PF and VF driver is 64 based on
hns3 network engine with revision_id equals 0x21. Based on hns3 network
engine with revision_id equals 0x30, the hns3 PF PMD driver can support
up to 1280 queues, and hns3 VF PMD driver can support up to 128 queues.
The following points need to be modified to support maximizing queue
number and maintain better compatibility:
1) Maximizing the number of queues for hns3 PF and VF PMD driver In
current version, VF is not supported when PF is driven by hns3 PMD
driver. If maximum queue numbers allocated to PF PMD driver is less
than total tqps_num allocated to this port, all remaining number of
queues are mapped to VF function, which is unreasonable. So we fix
that all remaining number of queues are mapped to PF function.
Using RTE_LIBRTE_HNS3_MAX_TQP_NUM_PER_PF which comes from
configuration file to limit the queue number allocated to PF device
based on hns3 network engine with revision_id greater than 0x30. And
PF device still keep the maximum 64 queues based on hns3 network
engine with revision_id equals 0x21.
Remove restriction of the macro HNS3_MAX_TQP_NUM_PER_FUNC on the
maximum number of queues in hns3 VF PMD driver and use the value
allocated by hns3 PF kernel netdev driver.
2) According to the queue number allocated to PF device, a variable
array for Rx and Tx queue is dynamically allocated to record the
statistics of Rx and Tx queues during the .dev_init ops
implementation function.
3) Add an extended field in hns3_pf_res_cmd to support the case that
numbers of queue are greater than 1024.
4) Use new base address of Rx or Tx queue if QUEUE_ID of Rx or Tx queue
is greater than 1024.
5) Remove queue id mask and use all bits of actual queue_id as the
queue_id to configure hardware.
6) Currently, 0~9 bits of qset_id in hns3_nq_to_qs_link_cmd used to
record actual qset id and 10 bit as VLD bit are configured to
hardware. So we also need to use 11~15 bits when actual qset_id is
greater than 1024.
7) The number of queue sets based on different network engine are
different. We use it to calculate group number and configure to
hardware in the backpressure configuration.
8) Adding check operations for number of Rx and Tx queue user configured
when mapping queue to tc Rx queue numbers under a single TC must be
less than rss_size_max supported by a single TC. Rx and Tx queue
numbers are allocated to every TC by average. So Rx and Tx queue
numbers must be an integer multiple of 2, or redundant queues are not
available.
9) We can specify which packets enter the queue with a specific queue
number, when creating flow table rules by rte_flow API. Currently,
driver uses 0~9 bits to record the queue_id. So it is necessary to
extend one bit field to record queue_id and configure to hardware, if
the queue_id is greater than 1024.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
2020-09-29 12:01:10 +00:00
|
|
|
#define HNS3_TQP_EXT_REG_OFFSET 0x100
|
|
|
|
#define HNS3_MIN_EXTEND_QUEUE_ID 1024
|
|
|
|
|
2019-09-26 14:01:48 +00:00
|
|
|
/* bar registers for tqp interrupt */
|
2021-01-22 10:18:47 +00:00
|
|
|
#define HNS3_TQP_INTR_REG_BASE 0x20000
|
|
|
|
#define HNS3_TQP_INTR_EXT_REG_BASE 0x30000
|
|
|
|
#define HNS3_TQP_INTR_CTRL_REG 0
|
|
|
|
#define HNS3_TQP_INTR_GL0_REG 0x100
|
|
|
|
#define HNS3_TQP_INTR_GL1_REG 0x200
|
|
|
|
#define HNS3_TQP_INTR_GL2_REG 0x300
|
|
|
|
#define HNS3_TQP_INTR_RL_REG 0x900
|
|
|
|
#define HNS3_TQP_INTR_TX_QL_REG 0xe00
|
|
|
|
#define HNS3_TQP_INTR_RX_QL_REG 0xf00
|
|
|
|
#define HNS3_TQP_INTR_RL_EN_B 6
|
|
|
|
|
|
|
|
#define HNS3_MIN_EXT_TQP_INTR_ID 64
|
|
|
|
#define HNS3_TQP_INTR_LOW_ORDER_OFFSET 0x4
|
|
|
|
#define HNS3_TQP_INTR_HIGH_ORDER_OFFSET 0x1000
|
|
|
|
|
2020-03-09 09:32:40 +00:00
|
|
|
#define HNS3_TQP_INTR_GL_MAX 0x1FE0
|
|
|
|
#define HNS3_TQP_INTR_GL_DEFAULT 20
|
2020-08-25 11:52:57 +00:00
|
|
|
#define HNS3_TQP_INTR_GL_UNIT_1US BIT(31)
|
2020-03-09 09:32:40 +00:00
|
|
|
#define HNS3_TQP_INTR_RL_MAX 0xEC
|
|
|
|
#define HNS3_TQP_INTR_RL_ENABLE_MASK 0x40
|
|
|
|
#define HNS3_TQP_INTR_RL_DEFAULT 0
|
2020-08-25 11:52:57 +00:00
|
|
|
#define HNS3_TQP_INTR_QL_DEFAULT 0
|
2020-03-09 09:32:40 +00:00
|
|
|
|
2021-04-01 13:38:04 +00:00
|
|
|
/* Register bit for 1588 event */
|
|
|
|
#define HNS3_VECTOR0_1588_INT_B 0
|
|
|
|
|
|
|
|
#define HNS3_PTP_BASE_ADDRESS 0x29000
|
|
|
|
|
|
|
|
#define HNS3_TX_1588_SEQID_BACK (HNS3_PTP_BASE_ADDRESS + 0x0)
|
|
|
|
#define HNS3_TX_1588_TSP_BACK_0 (HNS3_PTP_BASE_ADDRESS + 0x4)
|
|
|
|
#define HNS3_TX_1588_TSP_BACK_1 (HNS3_PTP_BASE_ADDRESS + 0x8)
|
|
|
|
#define HNS3_TX_1588_TSP_BACK_2 (HNS3_PTP_BASE_ADDRESS + 0xc)
|
|
|
|
|
|
|
|
#define HNS3_TX_1588_BACK_TSP_CNT (HNS3_PTP_BASE_ADDRESS + 0x30)
|
|
|
|
|
|
|
|
#define HNS3_CFG_TIME_SYNC_H (HNS3_PTP_BASE_ADDRESS + 0x50)
|
|
|
|
#define HNS3_CFG_TIME_SYNC_M (HNS3_PTP_BASE_ADDRESS + 0x54)
|
|
|
|
#define HNS3_CFG_TIME_SYNC_L (HNS3_PTP_BASE_ADDRESS + 0x58)
|
|
|
|
#define HNS3_CFG_TIME_SYNC_RDY (HNS3_PTP_BASE_ADDRESS + 0x5c)
|
|
|
|
|
|
|
|
#define HNS3_CFG_TIME_CYC_EN (HNS3_PTP_BASE_ADDRESS + 0x70)
|
|
|
|
|
|
|
|
#define HNS3_CURR_TIME_OUT_H (HNS3_PTP_BASE_ADDRESS + 0x74)
|
|
|
|
#define HNS3_CURR_TIME_OUT_L (HNS3_PTP_BASE_ADDRESS + 0x78)
|
|
|
|
#define HNS3_CURR_TIME_OUT_NS (HNS3_PTP_BASE_ADDRESS + 0x7c)
|
|
|
|
|
2020-03-09 09:32:40 +00:00
|
|
|
/* gl_usec convert to hardware count, as writing each 1 represents 2us */
|
|
|
|
#define HNS3_GL_USEC_TO_REG(gl_usec) ((gl_usec) >> 1)
|
|
|
|
/* rl_usec convert to hardware count, as writing each 1 represents 4us */
|
|
|
|
#define HNS3_RL_USEC_TO_REG(rl_usec) ((rl_usec) >> 2)
|
2019-09-26 14:01:48 +00:00
|
|
|
|
2019-09-26 14:02:04 +00:00
|
|
|
int hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs);
|
2022-09-30 07:22:13 +00:00
|
|
|
#endif /* HNS3_REGS_H */
|