-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net-next/hinic: Initialize hw interface
Initialize hw interface as part of the nic initialization for accessing hw. Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com> Signed-off-by: Zhao Chen <zhaochen6@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Aviad Krawczyk
authored and
David S. Miller
committed
Aug 22, 2017
1 parent
89c9c16
commit 51ba902
Showing
14 changed files
with
1,042 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
Linux Kernel Driver for Huawei Intelligent NIC(HiNIC) family | ||
============================================================ | ||
|
||
Overview: | ||
========= | ||
HiNIC is a network interface card for the Data Center Area. | ||
|
||
The driver supports a range of link-speed devices (10GbE, 25GbE, 40GbE, etc.). | ||
The driver supports also a negotiated and extendable feature set. | ||
|
||
Some HiNIC devices support SR-IOV. This driver is used for Physical Function | ||
(PF). | ||
|
||
HiNIC devices support MSI-X interrupt vector for each Tx/Rx queue and | ||
adaptive interrupt moderation. | ||
|
||
HiNIC devices support also various offload features such as checksum offload, | ||
TCP Transmit Segmentation Offload(TSO), Receive-Side Scaling(RSS) and | ||
LRO(Large Receive Offload). | ||
|
||
|
||
Supported PCI vendor ID/device IDs: | ||
=================================== | ||
|
||
19e5:1822 - HiNIC PF | ||
|
||
|
||
Driver Architecture and Source Code: | ||
==================================== | ||
|
||
hinic_dev - Implement a Logical Network device that is independent from | ||
specific HW details about HW data structure formats. | ||
|
||
hinic_hwdev - Implement the HW details of the device and include the components | ||
for accessing the PCI NIC. | ||
|
||
hinic_hwdev contains the following components: | ||
=============================================== | ||
|
||
HW Interface: | ||
============= | ||
|
||
The interface for accessing the pci device (DMA memory and PCI BARs). | ||
(hinic_hw_if.c, hinic_hw_if.h) | ||
|
||
Configuration Status Registers Area that describes the HW Registers on the | ||
configuration and status BAR0. (hinic_hw_csr.h) | ||
|
||
MGMT components: | ||
================ | ||
|
||
Asynchronous Event Queues(AEQs) - The event queues for receiving messages from | ||
the MGMT modules on the cards. (hinic_hw_eqs.c, hinic_hw_eqs.h) | ||
|
||
Application Programmable Interface commands(API CMD) - Interface for sending | ||
MGMT commands to the card. (hinic_hw_api_cmd.c, hinic_hw_api_cmd.h) | ||
|
||
Management (MGMT) - the PF to MGMT channel that uses API CMD for sending MGMT | ||
commands to the card and receives notifications from the MGMT modules on the | ||
card by AEQs. Also set the addresses of the IO CMDQs in HW. | ||
(hinic_hw_mgmt.c, hinic_hw_mgmt.h) | ||
|
||
IO components: | ||
============== | ||
|
||
Completion Event Queues(CEQs) - The completion Event Queues that describe IO | ||
tasks that are finished. (hinic_hw_eqs.c, hinic_hw_eqs.h) | ||
|
||
Work Queues(WQ) - Contain the memory and operations for use by CMD queues and | ||
the Queue Pairs. The WQ is a Memory Block in a Page. The Block contains | ||
pointers to Memory Areas that are the Memory for the Work Queue Elements(WQEs). | ||
(hinic_hw_wq.c, hinic_hw_wq.h) | ||
|
||
Command Queues(CMDQ) - The queues for sending commands for IO management and is | ||
used to set the QPs addresses in HW. The commands completion events are | ||
accumulated on the CEQ that is configured to receive the CMDQ completion events. | ||
(hinic_hw_cmdq.c, hinic_hw_cmdq.h) | ||
|
||
Queue Pairs(QPs) - The HW Receive and Send queues for Receiving and Transmitting | ||
Data. (hinic_hw_qp.c, hinic_hw_qp.h, hinic_hw_qp_ctxt.h) | ||
|
||
IO - de/constructs all the IO components. (hinic_hw_io.c, hinic_hw_io.h) | ||
|
||
HW device: | ||
========== | ||
|
||
HW device - de/constructs the HW Interface, the MGMT components on the | ||
initialization of the driver and the IO components on the case of Interface | ||
UP/DOWN Events. (hinic_hw_dev.c, hinic_hw_dev.h) | ||
|
||
|
||
hinic_dev contains the following components: | ||
=============================================== | ||
|
||
PCI ID table - Contains the supported PCI Vendor/Device IDs. | ||
(hinic_pci_tbl.h) | ||
|
||
Port Commands - Send commands to the HW device for port management | ||
(MAC, Vlan, MTU, ...). (hinic_port.c, hinic_port.h) | ||
|
||
Tx Queues - Logical Tx Queues that use the HW Send Queues for transmit. | ||
The Logical Tx queue is not dependent on the format of the HW Send Queue. | ||
(hinic_tx.c, hinic_tx.h) | ||
|
||
Rx Queues - Logical Rx Queues that use the HW Receive Queues for receive. | ||
The Logical Rx queue is not dependent on the format of the HW Receive Queue. | ||
(hinic_rx.c, hinic_rx.h) | ||
|
||
hinic_dev - de/constructs the Logical Tx and Rx Queues. | ||
(hinic_main.c, hinic_dev.h) | ||
|
||
|
||
Miscellaneous: | ||
============= | ||
|
||
Common functions that are used by HW and Logical Device. | ||
(hinic_common.c, hinic_common.h) | ||
|
||
|
||
Support | ||
======= | ||
|
||
If an issue is identified with the released source code on the supported kernel | ||
with a supported adapter, email the specific information related to the issue to | ||
aviad.krawczyk@huawei.com. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Huawei driver configuration | ||
# | ||
|
||
config NET_VENDOR_HUAWEI | ||
bool "Huawei devices" | ||
default y | ||
---help--- | ||
If you have a network (Ethernet) card belonging to this class, say Y. | ||
Note that the answer to this question doesn't directly affect the | ||
kernel: saying N will just cause the configurator to skip all | ||
the questions about Huawei cards. If you say Y, you will be asked | ||
for your specific card in the following questions. | ||
|
||
if NET_VENDOR_HUAWEI | ||
|
||
source "drivers/net/ethernet/huawei/hinic/Kconfig" | ||
|
||
endif # NET_VENDOR_HUAWEI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# Makefile for the Huawei device drivers. | ||
# | ||
|
||
obj-$(CONFIG_HINIC) += hinic/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Huawei driver configuration | ||
# | ||
|
||
config HINIC | ||
tristate "Huawei Intelligent PCIE Network Interface Card" | ||
depends on (PCI_MSI && X86) | ||
default m | ||
---help--- | ||
This driver supports HiNIC PCIE Ethernet cards. | ||
To compile this driver as part of the kernel, choose Y here. | ||
If unsure, choose N. | ||
The default is compiled as module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
obj-$(CONFIG_HINIC) += hinic.o | ||
|
||
hinic-y := hinic_main.o hinic_hw_dev.o hinic_hw_if.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Huawei HiNIC PCI Express Linux driver | ||
* Copyright(c) 2017 Huawei Technologies Co., Ltd | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* for more details. | ||
* | ||
*/ | ||
|
||
#ifndef HINIC_DEV_H | ||
#define HINIC_DEV_H | ||
|
||
#include <linux/netdevice.h> | ||
#include <linux/types.h> | ||
|
||
#include "hinic_hw_dev.h" | ||
|
||
#define HINIC_DRV_NAME "hinic" | ||
|
||
struct hinic_dev { | ||
struct net_device *netdev; | ||
struct hinic_hwdev *hwdev; | ||
|
||
u32 msg_enable; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Huawei HiNIC PCI Express Linux driver | ||
* Copyright(c) 2017 Huawei Technologies Co., Ltd | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* for more details. | ||
* | ||
*/ | ||
|
||
#ifndef HINIC_HW_CSR_H | ||
#define HINIC_HW_CSR_H | ||
|
||
/* HW interface registers */ | ||
#define HINIC_CSR_FUNC_ATTR0_ADDR 0x0 | ||
#define HINIC_CSR_FUNC_ATTR1_ADDR 0x4 | ||
|
||
#define HINIC_DMA_ATTR_BASE 0xC80 | ||
#define HINIC_ELECTION_BASE 0x4200 | ||
|
||
#define HINIC_DMA_ATTR_STRIDE 0x4 | ||
#define HINIC_CSR_DMA_ATTR_ADDR(idx) \ | ||
(HINIC_DMA_ATTR_BASE + (idx) * HINIC_DMA_ATTR_STRIDE) | ||
|
||
#define HINIC_PPF_ELECTION_STRIDE 0x4 | ||
#define HINIC_CSR_MAX_PORTS 4 | ||
|
||
#define HINIC_CSR_PPF_ELECTION_ADDR(idx) \ | ||
(HINIC_ELECTION_BASE + (idx) * HINIC_PPF_ELECTION_STRIDE) | ||
|
||
#endif |
Oops, something went wrong.