Skip to content

Commit

Permalink
net: linkdata: Add support for linkdata ethernet card
Browse files Browse the repository at this point in the history
This driver comes from WuXi Stars Micro System Technologies,
which provides support for linkdata ethernet card.

Signed-off-by: WangYuli <[email protected]>
  • Loading branch information
Avenger-285714 authored and deepin-ci-robot committed Sep 5, 2024
1 parent 24ec0fa commit 73118b0
Show file tree
Hide file tree
Showing 139 changed files with 58,020 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -197,5 +197,6 @@ source "drivers/net/ethernet/xircom/Kconfig"
source "drivers/net/ethernet/phytium/Kconfig"
source "drivers/net/ethernet/guangruntong/Kconfig"
source "drivers/net/ethernet/bzwx/Kconfig"
source "drivers/net/ethernet/linkdata/Kconfig"

endif # ETHERNET
1 change: 1 addition & 0 deletions drivers/net/ethernet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ obj-$(CONFIG_NET_VENDOR_PENSANDO) += pensando/
obj-$(CONFIG_NET_VENDOR_PHYTIUM) += phytium/
obj-$(CONFIG_NET_VENDOR_GRT) += guangruntong/
obj-$(CONFIG_NET_VENDOR_BZWX) += bzwx/
obj-$(NET_VENDOR_LINKDATA) += linkdata/
20 changes: 20 additions & 0 deletions drivers/net/ethernet/linkdata/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Linkdata network device configuration
#

config NET_VENDOR_LINKDATA
bool "Linkdata devices"
default y
help
If you have a network (Ethernet) card from Linkdata, 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 Intel cards. If you say Y, you will be asked for
your specific card in the following questions.

if NET_VENDOR_LINKDATA
source "drivers/net/ethernet/linkdata/sxe/Kconfig"
source "drivers/net/ethernet/linkdata/sxevf/Kconfig"
endif # NET_VENDOR_LINKDATA
6 changes: 6 additions & 0 deletions drivers/net/ethernet/linkdata/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Linkdata network device drivers.
#
obj-$(CONFIG_SXE) += sxe/
obj-$(CONFIG_SXE_VF) += sxevf/
16 changes: 16 additions & 0 deletions drivers/net/ethernet/linkdata/sxe/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# sxe network device configuration
#

config SXE
tristate "sxe PCI Express adapters support"
depends on PCI
select MDIO
select PHYLIB
select PTP_1588_CLOCK
help
This driver supports sxe PCI Express family of adapters.

To compile this driver as a module, choose M here. The module
will be called ngbe.
54 changes: 54 additions & 0 deletions drivers/net/ethernet/linkdata/sxe/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SPDX-License-Identifier: GPL-2.0
CONFIG_MODULE_SIG=n

#当前目录下的Makefile路径
MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
#当前路径
CURDIR :=$(shell dirname $(MAKEPATH))

ifneq ($(KERNELRELEASE),)
#编译
CONFIG_SXE ?= m
obj-$(CONFIG_SXE) += sxe.o
sxe-objs += $(patsubst %.c, sxepf/%.o, $(notdir $(wildcard $(CURDIR)/sxepf/*.c)))
sxe-objs += $(patsubst %.c, base/trace/%.o, $(notdir $(wildcard $(CURDIR)/base/trace/*.c)))
sxe-objs += $(patsubst %.c, base/log/%.o, $(notdir $(wildcard $(CURDIR)/base/log/*.c)))

#添加编译选项和编译宏
ccflags-y += -Werror -Wmaybe-uninitialized -frecord-gcc-switches
ccflags-y += -I$(CURDIR)/sxepf
ccflags-y += -I$(CURDIR)/include/sxe
ccflags-y += -I$(CURDIR)/include
ccflags-y += -I$(CURDIR)/base/compat
ccflags-y += -I$(CURDIR)/base/trace
ccflags-y += -I$(CURDIR)/base/log
ccflags-y += -DSXE_HOST_DRIVER
ccflags-y += -DSXE_DRIVER_RELEASE
ccflags-$(CONFIG_DCB) += -DSXE_DCB_CONFIGURE
ifneq ($(CONFIG_DCA), )
ccflags-y += -DSXE_TPH_CONFIGURE
endif

# 生成 linux kernel version code
ifneq ($(wildcard $(CURDIR)/vercode_build.sh),)
KER_DIR=$(srctree)
SPECIFIC_LINUX=$(shell bash $(CURDIR)/vercode_build.sh $(KER_DIR))
ifneq ($(SPECIFIC_LINUX),)
ccflags-y += -DSPECIFIC_LINUX
ccflags-y += -D$(SPECIFIC_LINUX)
endif
endif

else # KERNELRELEASE
#内核树路径
KDIR := /lib/modules/$(shell uname -r)/build

all:
@$(MAKE) -C $(KDIR) M=$(CURDIR) modules

clean:
@rm -rf *.o *.d *.ko Module.* modules.* *.mod* .*.d .*.cmd .tmp_versions *readme.txt
@rm -rf ./sxepf/*.o ./sxepf/.*.cmd
@rm -rf ./base/log/*.o ./base/trace/*.o

endif # KERNELRELEASE
28 changes: 28 additions & 0 deletions drivers/net/ethernet/linkdata/sxe/base/compat/sxe_compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef __SXE_COMPAT_H__
#define __SXE_COMPAT_H__

#include "sxe_compat_gcc.h"

#include "sxe_compat_inc.h"

#include "sxe_compat_vercode.h"

#ifdef SPECIFIC_LINUX
#include "sxe_compat_spec.h"
#elif RHEL_RELEASE_CODE
#include "sxe_compat_rhel.h"
#elif UBUNTU_VERSION_CODE
#include "sxe_compat_ubuntu.h"
#elif OPENEULER_VERSION_CODE
#include "sxe_compat_euler.h"
#elif KYLIN_RELEASE_CODE
#include "sxe_compat_kylin.h"
#elif SUSE_PRODUCT_CODE
#include "sxe_compat_suse.h"
#endif

#ifndef SXE_KERNEL_MATCHED
#include "sxe_compat_std.h"
#endif

#endif
54 changes: 54 additions & 0 deletions drivers/net/ethernet/linkdata/sxe/base/compat/sxe_compat_euler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#ifndef __SXE_COMPAT_EULER_H__
#define __SXE_COMPAT_EULER_H__

#if !OPENEULER_VERSION_CODE
#error "OPENEULER_VERSION_CODE is 0 or undefined"
#endif

#if defined OPENEULER_VERSION_CODE && (OPENEULER_VERSION_CODE == OPENEULER_VERSION(2203,1))
#define HAVE_ETHTOOL_COALESCE_EXTACK
#define HAVE_ETHTOOL_EXTENDED_RINGPARAMS
#define XDP_RXQ_INFO_REQ_API_NEED_3_PARAMS
#define HAVE_XDP_SUPPORT
#define HAVE_XDP_BUFF_DATA_META
#define HAVE_MEM_TYPE_XSK_BUFF_POOL
#define HAVE_NETDEV_BPF_XSK_BUFF_POOL
#define HAVE_AF_XDP_ZERO_COPY
#define HAVE_XDP_BUFF_FRAME_SIZE
#define HAVE_SKB_CSUM_SCTP_API
#define HAVE_NETDEV_NESTED_PRIV
#define HAVE_TIMEOUT_TXQUEUE_IDX
#define HAVE_NET_PREFETCH_API
#define HAVE_DEV_PAGE_IS_REUSABLE_API
#define HAVE_NDO_XSK_WAKEUP
#define HAVE_NDO_FDB_ADD_EXTACK
#define HAVE_NDO_BRIDGE_SETLINK_EXTACK
#define HAVE_NDO_SET_VF_LINK_STATE
#define HAVE_MACVLAN_OFFLOAD_SUPPORT
#define SXE_KERNEL_MATCHED
#endif

#if defined OPENEULER_VERSION_CODE && (OPENEULER_VERSION_CODE == OPENEULER_VERSION(2203,2))
#define HAVE_ETHTOOL_COALESCE_EXTACK
#define HAVE_ETHTOOL_EXTENDED_RINGPARAMS
#define XDP_RXQ_INFO_REQ_API_NEED_3_PARAMS
#define HAVE_XDP_SUPPORT
#define HAVE_XDP_BUFF_DATA_META
#define HAVE_MEM_TYPE_XSK_BUFF_POOL
#define HAVE_NETDEV_BPF_XSK_BUFF_POOL
#define HAVE_AF_XDP_ZERO_COPY
#define HAVE_XDP_BUFF_FRAME_SIZE
#define HAVE_SKB_CSUM_SCTP_API
#define HAVE_NETDEV_NESTED_PRIV
#define HAVE_TIMEOUT_TXQUEUE_IDX
#define HAVE_NET_PREFETCH_API
#define HAVE_DEV_PAGE_IS_REUSABLE_API
#define HAVE_NDO_XSK_WAKEUP
#define HAVE_NDO_FDB_ADD_EXTACK
#define HAVE_NDO_BRIDGE_SETLINK_EXTACK
#define HAVE_NDO_SET_VF_LINK_STATE
#define HAVE_MACVLAN_OFFLOAD_SUPPORT
#define SXE_KERNEL_MATCHED
#endif

#endif
14 changes: 14 additions & 0 deletions drivers/net/ethernet/linkdata/sxe/base/compat/sxe_compat_gcc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef __SXE_COMPAT_GCC_H__
#define __SXE_COMPAT_GCC_H__

#ifdef __has_attribute
#if __has_attribute(__fallthrough__)
# define fallthrough __attribute__((__fallthrough__))
#else
# define fallthrough do {} while (0)
#endif
#else
# define fallthrough do {} while (0)
#endif

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef __SXE_COMPAT_INC_H__
#define __SXE_COMPAT_INC_H__

#include <linux/filter.h>

#endif
77 changes: 77 additions & 0 deletions drivers/net/ethernet/linkdata/sxe/base/compat/sxe_compat_kylin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#ifndef __SXE_COMPAT_KYLIN_H__
#define __SXE_COMPAT_KYLIN_H__

#if !KYLIN_RELEASE_CODE
#error "KYLIN_RELEASE_CODE is 0 or undefined"
#endif

#if defined KYLIN_RELEASE_CODE && (KYLIN_RELEASE_CODE == KYLIN_RELEASE_VERSION(10,1))
#define HAVE_XDP_SUPPORT
#define HAVE_XDP_BUFF_DATA_META
#define XDP_XMIT_FRAME_FAILED_NEED_FREE
#define HAVE_XDP_QUERY_PROG
#define XDP_RXQ_INFO_REQ_API_NEED_3_PARAMS
#define ETH_GET_HEADLEN_API_NEED_2_PARAM
#define NEED_SKB_FRAG_OFF_API
#define NEED_SKB_FRAG_OFF_ADD_API
#define HAVE_MACVLAN_OFFLOAD_SUPPORT
#define xdp_convert_buff_to_frame convert_to_xdp_frame
#define ETH_P_LLDP 0x88CC
#define HAVE_NDO_SET_VF_LINK_STATE
#define SXE_KERNEL_MATCHED
#endif

#if defined KYLIN_RELEASE_CODE && (KYLIN_RELEASE_CODE == KYLIN_RELEASE_VERSION(10,3))
#define HAVE_XDP_BUFF_FRAME_SIZE
#define HAVE_XDP_SUPPORT
#define HAVE_XDP_BUFF_DATA_META
#define XDP_XMIT_FRAME_FAILED_NEED_FREE
#define HAVE_XDP_QUERY_PROG
#define XDP_RXQ_INFO_REQ_API_NEED_3_PARAMS
#define HAVE_DEV_PAGE_IS_REUSABLE_API
#define HAVE_MACVLAN_OFFLOAD_SUPPORT
#define HAVE_AF_XDP_ZERO_COPY
#define xdp_convert_buff_to_frame convert_to_xdp_frame
#define ETH_P_LLDP 0x88CC

#define HAVE_NDO_XSK_WAKEUP
#define HAVE_NDO_SET_VF_LINK_STATE
#define XDP_SETUP_XSK_POOL XDP_SETUP_XSK_UMEM
#define xsk_uses_need_wakeup xsk_umem_uses_need_wakeup
#define xsk_tx_peek_desc xsk_umem_consume_tx
#define xsk_tx_release xsk_umem_consume_tx_done
#define xsk_tx_completed xsk_umem_complete_tx
#define SXE_KERNEL_MATCHED
#endif

#if defined KYLIN_RELEASE_CODE && (KYLIN_RELEASE_CODE == KYLIN_RELEASE_VERSION(10,4))
#define HAVE_XDP_SUPPORT
#define HAVE_XDP_BUFF_DATA_META
#define HAVE_MEM_TYPE_XSK_BUFF_POOL
#define HAVE_XDP_BUFF_FRAME_SIZE
#define HAVE_AF_XDP_ZERO_COPY
#define XDP_RXQ_INFO_REQ_API_NEED_3_PARAMS
#define XSK_BUFF_DMA_SYNC_API_NEED_1_PARAM
#define XDP_XMIT_FRAME_FAILED_NEED_FREE
#define HAVE_XDP_QUERY_PROG
#define HAVE_NETDEV_NESTED_PRIV
#define HAVE_DEV_PAGE_IS_REUSABLE_API
#define HAVE_NDO_XSK_WAKEUP
#define HAVE_NDO_FDB_ADD_EXTACK
#define HAVE_NDO_BRIDGE_SETLINK_EXTACK
#define HAVE_NDO_SET_VF_LINK_STATE
#define HAVE_MACVLAN_OFFLOAD_SUPPORT

#define XDP_SETUP_XSK_POOL XDP_SETUP_XSK_UMEM
#define xsk_pool_get_rx_frame_size xsk_umem_get_rx_frame_size
#define xsk_pool_set_rxq_info xsk_buff_set_rxq_info
#define xsk_pool_dma_map xsk_buff_dma_map
#define xsk_pool_dma_unmap xsk_buff_dma_unmap
#define xsk_uses_need_wakeup xsk_umem_uses_need_wakeup
#define xsk_tx_peek_desc xsk_umem_consume_tx
#define xsk_tx_release xsk_umem_consume_tx_done
#define xsk_tx_completed xsk_umem_complete_tx
#define SXE_KERNEL_MATCHED
#endif

#endif
Loading

0 comments on commit 73118b0

Please sign in to comment.