Commit 4213ff79 authored by Shuai Wu's avatar Shuai Wu
Browse files

net/ethernet/huawei/hinic3: Add the CQM on which the RDMA depends

driver inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9EMOF


CVE: NA

---------------------------------

Add Huawei Intelligent Network Card RDMA Driver Dependency.

Signed-off-by: default avatarShuai Wu <wushuai51@huawei.com>
parent a5346226
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -84,6 +84,21 @@ Data. (hinic3_hw_qp.c, hinic3_hw_qp.h, hinic3_hw_qp_ctxt.h)

IO - de/constructs all the IO components. (hinic3_hw_io.c, hinic3_hw_io.h)

CQM components:
==========

The CQM module organizes the memory in the large system in a format (CLA table)
and allocates the memory to the chip (BAT table). The chip can use the memory in
the large system to save context information and queue information (SCQ\SRQ).
(cqm_bat_cla.c, cqm_bat_cla.h, cqm_bitmap_table.c, cqm_bitmap_table.h)

When a packet is transmitted from the PCIe link, the chip parses the 5-tuple
such as sid, did, and hostid. Fill the parsed data in the queue
(in the form of scqe). In this way, the driver can directly obtain data from the
queue (through MPDK polling) and then process the data. In this way, the
uninstallation is implemented.
(cqm_main.c, cqm_main.h, cqm_db.c, cqm_db.h)

HW device:
==========

+4 −0
Original line number Diff line number Diff line
@@ -9667,6 +9667,10 @@ L: netdev@vger.kernel.org
S:	Supported
F:	Documentation/networking/hinic3.rst
F:	drivers/net/ethernet/huawei/hinic3/
F:	drivers/net/ethernet/huawei/hinic3/bond/
F:	drivers/net/ethernet/huawei/hinic3/cqm/
F:	drivers/net/ethernet/huawei/hinic3/hw/
F:	drivers/net/ethernet/huawei/hinic3/include/
HUGETLB SUBSYSTEM
M:	Mike Kravetz <mike.kravetz@oracle.com>
+21 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/hw/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/cqm/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/cqm/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/public/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/cfg_mgmt/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/mpu/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/bond/
ccflags-y += -I$(srctree)/drivers/net/ethernet/huawei/hinic3/include/vmsec/

obj-$(CONFIG_HINIC3) += hinic3.o
hinic3-objs := hw/hinic3_hwdev.o \
@@ -23,6 +32,8 @@ hinic3-objs := hw/hinic3_hwdev.o \
			hw/hinic3_nictool.o \
			hw/hinic3_devlink.o \
			hw/ossl_knl_linux.o \
			hw/hinic3_multi_host_mgmt.o \
			bond/hinic3_bond.o \
			hinic3_main.o \
			hinic3_tx.o \
			hinic3_rx.o \
@@ -42,4 +53,13 @@ hinic3-objs := hw/hinic3_hwdev.o \
			hinic3_rss_cfg.o \
			hinic3_nic_event.o \
			hinic3_nic_io.o \
			hinic3_nic_dbg.o
 No newline at end of file
			hinic3_nic_dbg.o \
			cqm/cqm_bat_cla.o \
			cqm/cqm_bitmap_table.o \
			cqm/cqm_object_intern.o \
			cqm/cqm_bloomfilter.o \
			cqm/cqm_cmd.o \
			cqm/cqm_db.o \
			cqm/cqm_object.o \
			cqm/cqm_main.o \
			cqm/cqm_memsec.o
+1042 −0

File added.

Preview size limit exceeded, changes collapsed.

+98 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2021 Huawei Technologies Co., Ltd */

#ifndef HINIC3_BOND_H
#define HINIC3_BOND_H

#include <linux/netdevice.h>
#include <linux/types.h>
#include "mpu_inband_cmd_defs.h"
#include "bond_common_defs.h"

enum hinic3_bond_user {
	HINIC3_BOND_USER_OVS,
	HINIC3_BOND_USER_TOE,
	HINIC3_BOND_USER_ROCE,
	HINIC3_BOND_USER_NUM
};

enum bond_service_proc_pos {
	BOND_BEFORE_ACTIVE,
	BOND_AFTER_ACTIVE,
	BOND_BEFORE_MODIFY,
	BOND_AFTER_MODIFY,
	BOND_BEFORE_DEACTIVE,
	BOND_AFTER_DEACTIVE,
	BOND_POS_MAX
};

#define BITMAP_SET(bm, bit)     ((bm) |= (typeof(bm))(1U << (bit)))
#define BITMAP_CLR(bm, bit)     ((bm) &= ~((typeof(bm))(1U << (bit))))
#define BITMAP_JUDGE(bm, bit)    ((bm) & (typeof(bm))(1U << (bit)))

#define MPU_CMD_BOND_CREATE     17
#define MPU_CMD_BOND_DELETE     18
#define MPU_CMD_BOND_SET_ATTR   19
#define MPU_CMD_BOND_GET_ATTR   20

#define HINIC3_MAX_PORT 4
#define HINIC3_IFNAMSIZ 16
struct hinic3_bond_info_s {
	u8 slaves;
	u8 cnt;
	u8 srv[2];
	char slaves_name[HINIC3_MAX_PORT][HINIC3_IFNAMSIZ];
};

#pragma pack(1)
struct netdev_lower_state_info {
	u8 link_up : 1;
	u8 tx_enabled : 1;
	u8 rsvd : 6;
};

#pragma pack()

struct bond_tracker {
	struct netdev_lower_state_info netdev_state[BOND_PORT_MAX_NUM];
	struct net_device *ndev[BOND_PORT_MAX_NUM];
	u8 cnt;
	bool is_bonded;
};

struct bond_attr {
	u16 bond_mode;
	u16 bond_id;
	u16 up_delay;
	u16 down_delay;
	u8 active_slaves;
	u8 slaves;
	u8 lacp_collect_slaves;
	u8 xmit_hash_policy;
	u32 first_roce_func;
	u32 bond_pf_bitmap;
	u32 user_bitmap;
};

struct hinic3_bond_cmd {
	u8 ret_status;
	u8 version;
	u16 sub_cmd;
	struct bond_attr attr;
	char bond_name[16];
};

void hinic3_bond_set_user_bitmap(struct bond_attr *attr, enum hinic3_bond_user user);
int hinic3_bond_attach(const char *name, enum hinic3_bond_user user, u16 *bond_id);
int hinic3_bond_detach(u16 bond_id, enum hinic3_bond_user user);
void hinic3_bond_clean_user(enum hinic3_bond_user user);
int hinic3_bond_get_uplink_id(u16 bond_id, u32 *uplink_id);
int hinic3_bond_register_service_func(enum hinic3_bond_user user, void (*func)
				      (const char *bond_name, void *bond_attr,
				      enum bond_service_proc_pos pos));
int hinic3_bond_unregister_service_func(enum hinic3_bond_user user);
int hinic3_bond_get_slaves(u16 bond_id, struct hinic3_bond_info_s *info);
struct net_device *hinic3_bond_get_netdev_by_portid(const char *bond_name, u8 port_id);
int hinic3_get_hw_bond_infos(void *hwdev, struct hinic3_hw_bond_infos *infos, u16 channel);
int hinic3_get_bond_tracker_by_name(const char *name, struct bond_tracker *tracker);
#endif /* HINIC3_BOND_H */
Loading