Skip to content

Commit 51ba902

Browse files
Aviad Krawczykdavem330
authored andcommitted
net-next/hinic: Initialize hw interface
Initialize hw interface as part of the nic initialization for accessing hw. Signed-off-by: Aviad Krawczyk <[email protected]> Signed-off-by: Zhao Chen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 89c9c16 commit 51ba902

File tree

14 files changed

+1042
-0
lines changed

14 files changed

+1042
-0
lines changed

Documentation/networking/hinic.txt

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
Linux Kernel Driver for Huawei Intelligent NIC(HiNIC) family
2+
============================================================
3+
4+
Overview:
5+
=========
6+
HiNIC is a network interface card for the Data Center Area.
7+
8+
The driver supports a range of link-speed devices (10GbE, 25GbE, 40GbE, etc.).
9+
The driver supports also a negotiated and extendable feature set.
10+
11+
Some HiNIC devices support SR-IOV. This driver is used for Physical Function
12+
(PF).
13+
14+
HiNIC devices support MSI-X interrupt vector for each Tx/Rx queue and
15+
adaptive interrupt moderation.
16+
17+
HiNIC devices support also various offload features such as checksum offload,
18+
TCP Transmit Segmentation Offload(TSO), Receive-Side Scaling(RSS) and
19+
LRO(Large Receive Offload).
20+
21+
22+
Supported PCI vendor ID/device IDs:
23+
===================================
24+
25+
19e5:1822 - HiNIC PF
26+
27+
28+
Driver Architecture and Source Code:
29+
====================================
30+
31+
hinic_dev - Implement a Logical Network device that is independent from
32+
specific HW details about HW data structure formats.
33+
34+
hinic_hwdev - Implement the HW details of the device and include the components
35+
for accessing the PCI NIC.
36+
37+
hinic_hwdev contains the following components:
38+
===============================================
39+
40+
HW Interface:
41+
=============
42+
43+
The interface for accessing the pci device (DMA memory and PCI BARs).
44+
(hinic_hw_if.c, hinic_hw_if.h)
45+
46+
Configuration Status Registers Area that describes the HW Registers on the
47+
configuration and status BAR0. (hinic_hw_csr.h)
48+
49+
MGMT components:
50+
================
51+
52+
Asynchronous Event Queues(AEQs) - The event queues for receiving messages from
53+
the MGMT modules on the cards. (hinic_hw_eqs.c, hinic_hw_eqs.h)
54+
55+
Application Programmable Interface commands(API CMD) - Interface for sending
56+
MGMT commands to the card. (hinic_hw_api_cmd.c, hinic_hw_api_cmd.h)
57+
58+
Management (MGMT) - the PF to MGMT channel that uses API CMD for sending MGMT
59+
commands to the card and receives notifications from the MGMT modules on the
60+
card by AEQs. Also set the addresses of the IO CMDQs in HW.
61+
(hinic_hw_mgmt.c, hinic_hw_mgmt.h)
62+
63+
IO components:
64+
==============
65+
66+
Completion Event Queues(CEQs) - The completion Event Queues that describe IO
67+
tasks that are finished. (hinic_hw_eqs.c, hinic_hw_eqs.h)
68+
69+
Work Queues(WQ) - Contain the memory and operations for use by CMD queues and
70+
the Queue Pairs. The WQ is a Memory Block in a Page. The Block contains
71+
pointers to Memory Areas that are the Memory for the Work Queue Elements(WQEs).
72+
(hinic_hw_wq.c, hinic_hw_wq.h)
73+
74+
Command Queues(CMDQ) - The queues for sending commands for IO management and is
75+
used to set the QPs addresses in HW. The commands completion events are
76+
accumulated on the CEQ that is configured to receive the CMDQ completion events.
77+
(hinic_hw_cmdq.c, hinic_hw_cmdq.h)
78+
79+
Queue Pairs(QPs) - The HW Receive and Send queues for Receiving and Transmitting
80+
Data. (hinic_hw_qp.c, hinic_hw_qp.h, hinic_hw_qp_ctxt.h)
81+
82+
IO - de/constructs all the IO components. (hinic_hw_io.c, hinic_hw_io.h)
83+
84+
HW device:
85+
==========
86+
87+
HW device - de/constructs the HW Interface, the MGMT components on the
88+
initialization of the driver and the IO components on the case of Interface
89+
UP/DOWN Events. (hinic_hw_dev.c, hinic_hw_dev.h)
90+
91+
92+
hinic_dev contains the following components:
93+
===============================================
94+
95+
PCI ID table - Contains the supported PCI Vendor/Device IDs.
96+
(hinic_pci_tbl.h)
97+
98+
Port Commands - Send commands to the HW device for port management
99+
(MAC, Vlan, MTU, ...). (hinic_port.c, hinic_port.h)
100+
101+
Tx Queues - Logical Tx Queues that use the HW Send Queues for transmit.
102+
The Logical Tx queue is not dependent on the format of the HW Send Queue.
103+
(hinic_tx.c, hinic_tx.h)
104+
105+
Rx Queues - Logical Rx Queues that use the HW Receive Queues for receive.
106+
The Logical Rx queue is not dependent on the format of the HW Receive Queue.
107+
(hinic_rx.c, hinic_rx.h)
108+
109+
hinic_dev - de/constructs the Logical Tx and Rx Queues.
110+
(hinic_main.c, hinic_dev.h)
111+
112+
113+
Miscellaneous:
114+
=============
115+
116+
Common functions that are used by HW and Logical Device.
117+
(hinic_common.c, hinic_common.h)
118+
119+
120+
Support
121+
=======
122+
123+
If an issue is identified with the released source code on the supported kernel
124+
with a supported adapter, email the specific information related to the issue to
125+

drivers/net/ethernet/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ source "drivers/net/ethernet/freescale/Kconfig"
7878
source "drivers/net/ethernet/fujitsu/Kconfig"
7979
source "drivers/net/ethernet/hisilicon/Kconfig"
8080
source "drivers/net/ethernet/hp/Kconfig"
81+
source "drivers/net/ethernet/huawei/Kconfig"
8182
source "drivers/net/ethernet/ibm/Kconfig"
8283
source "drivers/net/ethernet/intel/Kconfig"
8384
source "drivers/net/ethernet/i825xx/Kconfig"

drivers/net/ethernet/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ obj-$(CONFIG_NET_VENDOR_FREESCALE) += freescale/
4141
obj-$(CONFIG_NET_VENDOR_FUJITSU) += fujitsu/
4242
obj-$(CONFIG_NET_VENDOR_HISILICON) += hisilicon/
4343
obj-$(CONFIG_NET_VENDOR_HP) += hp/
44+
obj-$(CONFIG_NET_VENDOR_HUAWEI) += huawei/
4445
obj-$(CONFIG_NET_VENDOR_IBM) += ibm/
4546
obj-$(CONFIG_NET_VENDOR_INTEL) += intel/
4647
obj-$(CONFIG_NET_VENDOR_I825XX) += i825xx/

drivers/net/ethernet/huawei/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Huawei driver configuration
3+
#
4+
5+
config NET_VENDOR_HUAWEI
6+
bool "Huawei devices"
7+
default y
8+
---help---
9+
If you have a network (Ethernet) card belonging to this class, say Y.
10+
Note that the answer to this question doesn't directly affect the
11+
kernel: saying N will just cause the configurator to skip all
12+
the questions about Huawei cards. If you say Y, you will be asked
13+
for your specific card in the following questions.
14+
15+
if NET_VENDOR_HUAWEI
16+
17+
source "drivers/net/ethernet/huawei/hinic/Kconfig"
18+
19+
endif # NET_VENDOR_HUAWEI

drivers/net/ethernet/huawei/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Makefile for the Huawei device drivers.
3+
#
4+
5+
obj-$(CONFIG_HINIC) += hinic/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Huawei driver configuration
3+
#
4+
5+
config HINIC
6+
tristate "Huawei Intelligent PCIE Network Interface Card"
7+
depends on (PCI_MSI && X86)
8+
default m
9+
---help---
10+
This driver supports HiNIC PCIE Ethernet cards.
11+
To compile this driver as part of the kernel, choose Y here.
12+
If unsure, choose N.
13+
The default is compiled as module.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
obj-$(CONFIG_HINIC) += hinic.o
2+
3+
hinic-y := hinic_main.o hinic_hw_dev.o hinic_hw_if.o
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Huawei HiNIC PCI Express Linux driver
3+
* Copyright(c) 2017 Huawei Technologies Co., Ltd
4+
*
5+
* This program is free software; you can redistribute it and/or modify it
6+
* under the terms and conditions of the GNU General Public License,
7+
* version 2, as published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* for more details.
13+
*
14+
*/
15+
16+
#ifndef HINIC_DEV_H
17+
#define HINIC_DEV_H
18+
19+
#include <linux/netdevice.h>
20+
#include <linux/types.h>
21+
22+
#include "hinic_hw_dev.h"
23+
24+
#define HINIC_DRV_NAME "hinic"
25+
26+
struct hinic_dev {
27+
struct net_device *netdev;
28+
struct hinic_hwdev *hwdev;
29+
30+
u32 msg_enable;
31+
};
32+
33+
#endif
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Huawei HiNIC PCI Express Linux driver
3+
* Copyright(c) 2017 Huawei Technologies Co., Ltd
4+
*
5+
* This program is free software; you can redistribute it and/or modify it
6+
* under the terms and conditions of the GNU General Public License,
7+
* version 2, as published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* for more details.
13+
*
14+
*/
15+
16+
#ifndef HINIC_HW_CSR_H
17+
#define HINIC_HW_CSR_H
18+
19+
/* HW interface registers */
20+
#define HINIC_CSR_FUNC_ATTR0_ADDR 0x0
21+
#define HINIC_CSR_FUNC_ATTR1_ADDR 0x4
22+
23+
#define HINIC_DMA_ATTR_BASE 0xC80
24+
#define HINIC_ELECTION_BASE 0x4200
25+
26+
#define HINIC_DMA_ATTR_STRIDE 0x4
27+
#define HINIC_CSR_DMA_ATTR_ADDR(idx) \
28+
(HINIC_DMA_ATTR_BASE + (idx) * HINIC_DMA_ATTR_STRIDE)
29+
30+
#define HINIC_PPF_ELECTION_STRIDE 0x4
31+
#define HINIC_CSR_MAX_PORTS 4
32+
33+
#define HINIC_CSR_PPF_ELECTION_ADDR(idx) \
34+
(HINIC_ELECTION_BASE + (idx) * HINIC_PPF_ELECTION_STRIDE)
35+
36+
#endif

0 commit comments

Comments
 (0)