Skip to content

Commit c866011

Browse files
符桂铭opsiff
authored andcommitted
net/hinic3:Add Huawei Intelligent Network Card Driver:hinic3
The NIC driver supports the following features: *1. Supports IPv4/IPv6 TCP/UDP checksum, TSO, LRO offload and RSS functions. 2. Supports interrupt aggregation parameter configuration and interrupt adaptation. 3. Supports 802.1Q VLAN (Virtual Local Area Network) offloading and filtering. 4. Supports NIC SR-IOV (Single Root I/O Virtualization). 5. Support PF promiscuous mode 6. Supports VF QinQ mode. 7. Supports VF link state configuration and QoS configuration. 8. Support VF MAC address management. 9. Support VF spoofchk check. 10. Support port lighting. 11. Support Ethernet mouth self-negotiation, support pause frame. [ WangYuli: Support COMPILE_TEST and fix follow compile error: ] drivers/net/ethernet/huawei/hinic3/adapter/sw_cmdq/sw_cmdq_ops.c:78:34: error: expression does not compute the number of elements in this array; element type is 'u16' (aka 'unsigned short'), not 'u32' (aka 'unsigned int') [-Werror,-Wsizeof-array-div] 78 | size = sizeof(indir_tbl->entry) / sizeof(u32); | ~~~~~~~~~~~~~~~~ ^ Link: https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel/pulls/377 signed-off-by:Fuguiming<fuguiming@huawei.com> Co-developed-by: WangYuli <wangyuli@uniontech.com> Signed-off-by: WangYuli <wangyuli@uniontech.com>
1 parent aa114b3 commit c866011

144 files changed

Lines changed: 74209 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
============================================================
4+
Linux Kernel Driver for Huawei Intelligent NIC(HiNIC3) family
5+
============================================================
6+
7+
Overview:
8+
=========
9+
HiNIC3 is a network interface card for the Data Center Area.
10+
11+
The driver supports a range of link-speed devices (10GbE, 25GbE, 40GbE, etc.).
12+
The driver supports also a negotiated and extendable feature set.
13+
14+
Some HiNIC3 devices support SR-IOV. This driver is used for Physical Function
15+
(PF).
16+
17+
HiNIC3 devices support MSI-X interrupt vector for each Tx/Rx queue and
18+
adaptive interrupt moderation.
19+
20+
HiNIC3 devices support also various offload features such as checksum offload,
21+
TCP Transmit Segmentation Offload(TSO), Receive-Side Scaling(RSS) and
22+
LRO(Large Receive Offload).
23+
24+
25+
Supported PCI vendor ID/device IDs:
26+
===================================
27+
28+
19e5:1822 - HiNIC3 PF
29+
30+
31+
Driver Architecture and Source Code:
32+
====================================
33+
34+
hinic3_dev - Implement a Logical Network device that is independent from
35+
specific HW details about HW data structure formats.
36+
37+
hinic3_hwdev - Implement the HW details of the device and include the components
38+
for accessing the PCI NIC.
39+
40+
hinic3_hwdev contains the following components:
41+
===============================================
42+
43+
HW Interface:
44+
=============
45+
46+
The interface for accessing the pci device (DMA memory and PCI BARs).
47+
(hinic3_hw_if.c, hinic3_hw_if.h)
48+
49+
Configuration Status Registers Area that describes the HW Registers on the
50+
configuration and status BAR0. (hinic3_hw_csr.h)
51+
52+
MGMT components:
53+
================
54+
55+
Asynchronous Event Queues(AEQs) - The event queues for receiving messages from
56+
the MGMT modules on the cards. (hinic3_hw_eqs.c, hinic3_hw_eqs.h)
57+
58+
Application Programmable Interface commands(API CMD) - Interface for sending
59+
MGMT commands to the card. (hinic3_hw_api_cmd.c, hinic3_hw_api_cmd.h)
60+
61+
Management (MGMT) - the PF to MGMT channel that uses API CMD for sending MGMT
62+
commands to the card and receives notifications from the MGMT modules on the
63+
card by AEQs. Also set the addresses of the IO CMDQs in HW.
64+
(hinic3_hw_mgmt.c, hinic3_hw_mgmt.h)
65+
66+
IO components:
67+
==============
68+
69+
Completion Event Queues(CEQs) - The completion Event Queues that describe IO
70+
tasks that are finished. (hinic3_hw_eqs.c, hinic3_hw_eqs.h)
71+
72+
Work Queues(WQ) - Contain the memory and operations for use by CMD queues and
73+
the Queue Pairs. The WQ is a Memory Block in a Page. The Block contains
74+
pointers to Memory Areas that are the Memory for the Work Queue Elements(WQEs).
75+
(hinic3_hw_wq.c, hinic3_hw_wq.h)
76+
77+
Command Queues(CMDQ) - The queues for sending commands for IO management and is
78+
used to set the QPs addresses in HW. The commands completion events are
79+
accumulated on the CEQ that is configured to receive the CMDQ completion events.
80+
(hinic3_hw_cmdq.c, hinic3_hw_cmdq.h)
81+
82+
Queue Pairs(QPs) - The HW Receive and Send queues for Receiving and Transmitting
83+
Data. (hinic3_hw_qp.c, hinic3_hw_qp.h, hinic3_hw_qp_ctxt.h)
84+
85+
IO - de/constructs all the IO components. (hinic3_hw_io.c, hinic3_hw_io.h)
86+
87+
CQM components:
88+
==========
89+
90+
The CQM module organizes the memory in the large system in a format (CLA table)
91+
and allocates the memory to the chip (BAT table). The chip can use the memory in
92+
the large system to save context information and queue information (SCQ\SRQ).
93+
(cqm_bat_cla.c, cqm_bat_cla.h, cqm_bitmap_table.c, cqm_bitmap_table.h)
94+
95+
When a packet is transmitted from the PCIe link, the chip parses the 5-tuple
96+
such as sid, did, and hostid. Fill the parsed data in the queue
97+
(in the form of scqe). In this way, the driver can directly obtain data from the
98+
queue (through MPDK polling) and then process the data. In this way, the
99+
uninstallation is implemented.
100+
(cqm_main.c, cqm_main.h, cqm_db.c, cqm_db.h)
101+
102+
HW device:
103+
==========
104+
105+
HW device - de/constructs the HW Interface, the MGMT components on the
106+
initialization of the driver and the IO components on the case of Interface
107+
UP/DOWN Events. (hinic3_hw_dev.c, hinic3_hw_dev.h)
108+
109+
110+
hinic3_dev contains the following components:
111+
===============================================
112+
113+
PCI ID table - Contains the supported PCI Vendor/Device IDs.
114+
(hinic3_pci_tbl.h)
115+
116+
Port Commands - Send commands to the HW device for port management
117+
(MAC, Vlan, MTU, ...). (hinic3_port.c, hinic3_port.h)
118+
119+
Tx Queues - Logical Tx Queues that use the HW Send Queues for transmit.
120+
The Logical Tx queue is not dependent on the format of the HW Send Queue.
121+
(hinic3_tx.c, hinic3_tx.h)
122+
123+
Rx Queues - Logical Rx Queues that use the HW Receive Queues for receive.
124+
The Logical Rx queue is not dependent on the format of the HW Receive Queue.
125+
(hinic3_rx.c, hinic3_rx.h)
126+
127+
hinic_dev - de/constructs the Logical Tx and Rx Queues.
128+
(hinic3_main.c, hinic3_dev.h)
129+
130+
131+
Miscellaneous:
132+
=============
133+
134+
Common functions that are used by HW and Logical Device.
135+
(hinic3_common.c, hinic3_common.h)
136+
137+
138+
Support
139+
=======
140+
141+
If an issue is identified with the released source code on the supported kernel
142+
with a supported adapter, email the specific information related to the issue to
143+
wulike1@huawei.com.

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9689,6 +9689,13 @@ S: Maintained
96899689
F: Documentation/networking/device_drivers/ethernet/huawei/hinic.rst
96909690
F: drivers/net/ethernet/huawei/hinic/
96919691

9692+
HUAWEI ETHERNET DRIVER
9693+
M: FuGuiming <fuguiming@huawei.com>
9694+
L: netdev@vger.kernel.org
9695+
S: Maintained
9696+
F: Documentation/networking/device_drivers/ethernet/huawei/hinic3.rst
9697+
F: drivers/net/ethernet/huawei/hinic3/
9698+
96929699
HUGETLB SUBSYSTEM
96939700
M: Mike Kravetz <mike.kravetz@oracle.com>
96949701
M: Muchun Song <muchun.song@linux.dev>

drivers/net/ethernet/huawei/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ config NET_VENDOR_HUAWEI
1616
if NET_VENDOR_HUAWEI
1717

1818
source "drivers/net/ethernet/huawei/hinic/Kconfig"
19+
source "drivers/net/ethernet/huawei/hinic3/Kconfig"
1920

2021
endif # NET_VENDOR_HUAWEI

drivers/net/ethernet/huawei/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
#
55

66
obj-$(CONFIG_HINIC) += hinic/
7+
obj-$(CONFIG_HINIC3) += hinic3/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#
3+
# Huawei driver configuration
4+
#
5+
6+
config HINIC3
7+
tristate "Huawei Intelligent Network Interface Card 3rd"
8+
depends on PCI_MSI && NUMA && PCI_IOV && DCB
9+
depends on X86 || ARM64 || COMPILE_TEST
10+
help
11+
This driver supports HiNIC PCIE Ethernet cards.
12+
To compile this driver as part of the kernel, choose Y here.
13+
If unsure, choose N.
14+
The default is N.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/
3+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/hw/
4+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/cqm/
5+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/adapter/hw_cmdq/
6+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/adapter/sw_cmdq/
7+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/
8+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/cqm/
9+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/public/
10+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/cfg_mgmt/
11+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/mpu/
12+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/bond/
13+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/vmsec/
14+
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/bond/
15+
16+
obj-$(CONFIG_HINIC3) += hinic3.o
17+
hinic3-objs := hw/hinic3_hwdev.o \
18+
hw/hinic3_hw_cfg.o \
19+
hw/hinic3_hw_comm.o \
20+
hw/hinic3_prof_adap.o \
21+
hw/hinic3_sriov.o \
22+
hw/hinic3_lld.o \
23+
hw/hinic3_dev_mgmt.o \
24+
hw/hinic3_common.o \
25+
hw/hinic3_hwif.o \
26+
hw/hinic3_wq.o \
27+
hw/hinic3_cmdq.o \
28+
hw/hinic3_eqs.o \
29+
hw/hinic3_mbox.o \
30+
hw/hinic3_mgmt.o \
31+
hw/hinic3_api_cmd.o \
32+
hw/hinic3_hw_api.o \
33+
hw/hinic3_sml_lt.o \
34+
hw/hinic3_hw_mt.o \
35+
hw/hinic3_nictool.o \
36+
hw/hinic3_devlink.o \
37+
hw/hinic3_cmdq_enhance.o \
38+
hw/ossl_knl_linux.o \
39+
hw/hinic3_multi_host_mgmt.o \
40+
adapter/hw_cmdq/hw_cmdq_ops.o \
41+
adapter/sw_cmdq/sw_cmdq_ops.o \
42+
bond/hinic3_bond.o \
43+
hinic3_main.o \
44+
hinic3_cmdq_adapter.o \
45+
hinic3_tx.o \
46+
hinic3_rx.o \
47+
hinic3_rss.o \
48+
hinic3_ntuple.o \
49+
hinic3_dcb.o \
50+
hinic3_ethtool.o \
51+
hinic3_ethtool_stats.o \
52+
hinic3_dbg.o \
53+
hinic3_irq.o \
54+
hinic3_filter.o \
55+
hinic3_netdev_ops.o \
56+
hinic3_nic_prof.o \
57+
hinic3_nic_cfg.o \
58+
hinic3_mag_cfg.o \
59+
hinic3_nic_cfg_vf.o \
60+
hinic3_rss_cfg.o \
61+
hinic3_nic_event.o \
62+
hinic3_nic_io.o \
63+
hinic3_nic_dbg.o \
64+
cqm/cqm_bat_cla.o \
65+
cqm/cqm_bitmap_table.o \
66+
cqm/cqm_object_intern.o \
67+
cqm/cqm_bloomfilter.o \
68+
cqm/cqm_cmd.o \
69+
cqm/cqm_db.o \
70+
cqm/cqm_object.o \
71+
cqm/cqm_main.o \
72+
cqm/cqm_memsec.o

0 commit comments

Comments
 (0)