Skip to content

Commit 5f3768c

Browse files
author
root
committed
Sync DPDK's modifies.
1. igb_uio. 2. mlx5 drivers. 3. i40e drivers. 4. Freebsd-13.1. 5. sync dts/poetry.lock
1 parent 9399a57 commit 5f3768c

File tree

12 files changed

+1089
-42
lines changed

12 files changed

+1089
-42
lines changed

dpdk/drivers/net/i40e/i40e_ethdev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
15141514
}
15151515
/* Firmware of SFP x722 does not support 802.1ad frames ability */
15161516
if (hw->device_id == I40E_DEV_ID_SFP_X722 ||
1517-
hw->device_id == I40E_DEV_ID_SFP_I_X722)
1517+
hw->device_id == I40E_DEV_ID_SFP_I_X722 ||
1518+
hw->device_id == I40E_DEV_ID_10G_BASE_T_X722)
15181519
hw->flags &= ~I40E_HW_FLAG_802_1AD_CAPABLE;
15191520

15201521
PMD_INIT_LOG(INFO, "FW %d.%d API %d.%d NVM %02d.%02d.%02d eetrack %04x",

dpdk/drivers/net/mlx5/linux/mlx5_ethdev_os.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <stdalign.h>
2424
#include <sys/un.h>
2525
#include <time.h>
26+
#include <dlfcn.h>
2627

2728
#include <ethdev_driver.h>
2829
#include <bus_pci_driver.h>
@@ -1045,6 +1046,7 @@ mlx5_sysfs_check_switch_info(bool device_dir,
10451046
* @return
10461047
* 0 on success, a negative errno value otherwise and rte_errno is set.
10471048
*/
1049+
static char *(*real_if_indextoname)(unsigned int, char *) = NULL;
10481050
int
10491051
mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
10501052
{
@@ -1065,7 +1067,16 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
10651067
char c;
10661068
ssize_t line_size;
10671069

1068-
if (!if_indextoname(ifindex, ifname)) {
1070+
// for ff tools
1071+
if (!real_if_indextoname) {
1072+
real_if_indextoname = __extension__ (char *(*)(unsigned int, char *))dlsym(RTLD_NEXT, "if_indextoname");
1073+
if (!real_if_indextoname) {
1074+
rte_errno = errno;
1075+
return -rte_errno;
1076+
}
1077+
}
1078+
1079+
if (!real_if_indextoname(ifindex, ifname)) {
10691080
rte_errno = errno;
10701081
return -rte_errno;
10711082
}

dpdk/drivers/net/mlx5/linux/mlx5_os.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/sockios.h>
1515
#include <linux/ethtool.h>
1616
#include <fcntl.h>
17+
#include <dlfcn.h>
1718

1819
#include <rte_malloc.h>
1920
#include <ethdev_driver.h>
@@ -2028,6 +2029,7 @@ mlx5_nl_esw_multiport_get(struct rte_pci_addr *pci_addr, int *enabled)
20282029

20292030
#define SYSFS_MPESW_PARAM_MAX_LEN 16
20302031

2032+
static char *(*real_if_indextoname)(unsigned int, char *) = NULL;
20312033
static int
20322034
mlx5_sysfs_esw_multiport_get(struct ibv_device *ibv, struct rte_pci_addr *pci_addr, int *enabled)
20332035
{
@@ -2057,7 +2059,16 @@ mlx5_sysfs_esw_multiport_get(struct ibv_device *ibv, struct rte_pci_addr *pci_ad
20572059
ifindex = mlx5_nl_ifindex(nl_rdma, ibv->name, i);
20582060
if (!ifindex)
20592061
continue;
2060-
if (!if_indextoname(ifindex, ifname))
2062+
2063+
// for ff tools
2064+
if (!real_if_indextoname) {
2065+
real_if_indextoname = __extension__ (char *(*)(unsigned int, char *))dlsym(RTLD_NEXT, "if_indextoname");
2066+
if (!real_if_indextoname) {
2067+
rte_errno = errno;
2068+
return -rte_errno;
2069+
}
2070+
}
2071+
if (!real_if_indextoname(ifindex, ifname))
20612072
continue;
20622073
MKSTR(sysfs_if_path, "/sys/class/net/%s", ifname);
20632074
if (mlx5_get_pci_addr(sysfs_if_path, &if_pci_addr))

dpdk/dts/poetry.lock

Lines changed: 56 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dpdk/kernel/linux/igb_uio/Kbuild

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ccflags-y := $(MODULE_CFLAGS)
2+
obj-m := igb_uio.o

dpdk/kernel/linux/igb_uio/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
KSRC ?= /lib/modules/$(shell uname -r)/build
2+
3+
all:
4+
make -C $(KSRC)/ M=$(CURDIR)
5+
6+
%:
7+
make -C $(KSRC)/ M=$(CURDIR) $@

dpdk/kernel/linux/igb_uio/compat.h

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Minimal wrappers to allow compiling igb_uio on older kernels.
4+
*/
5+
6+
#ifndef RHEL_RELEASE_VERSION
7+
#define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
8+
#endif
9+
10+
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
11+
#define pci_cfg_access_lock pci_block_user_cfg_access
12+
#define pci_cfg_access_unlock pci_unblock_user_cfg_access
13+
#endif
14+
15+
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
16+
#define HAVE_PTE_MASK_PAGE_IOMAP
17+
#endif
18+
19+
#ifndef PCI_MSIX_ENTRY_SIZE
20+
#define PCI_MSIX_ENTRY_SIZE 16
21+
#define PCI_MSIX_ENTRY_VECTOR_CTRL 12
22+
#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1
23+
#endif
24+
25+
/*
26+
* for kernels < 2.6.38 and backported patch that moves MSI-X entry definition
27+
* to pci_regs.h Those kernels has PCI_MSIX_ENTRY_SIZE defined but not
28+
* PCI_MSIX_ENTRY_CTRL_MASKBIT
29+
*/
30+
#ifndef PCI_MSIX_ENTRY_CTRL_MASKBIT
31+
#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1
32+
#endif
33+
34+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) && \
35+
(!(defined(RHEL_RELEASE_CODE) && \
36+
RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 9)))
37+
38+
static int pci_num_vf(struct pci_dev *dev)
39+
{
40+
struct iov {
41+
int pos;
42+
int nres;
43+
u32 cap;
44+
u16 ctrl;
45+
u16 total;
46+
u16 initial;
47+
u16 nr_virtfn;
48+
} *iov = (struct iov *)dev->sriov;
49+
50+
if (!dev->is_physfn)
51+
return 0;
52+
53+
return iov->nr_virtfn;
54+
}
55+
56+
#endif /* < 2.6.34 */
57+
58+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && \
59+
(!(defined(RHEL_RELEASE_CODE) && \
60+
RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)))
61+
62+
#define kstrtoul strict_strtoul
63+
64+
#endif /* < 2.6.39 */
65+
66+
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && \
67+
(!(defined(RHEL_RELEASE_CODE) && \
68+
RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 3)))
69+
70+
/* Check if INTX works to control irq's.
71+
* Set's INTX_DISABLE flag and reads it back
72+
*/
73+
static bool pci_intx_mask_supported(struct pci_dev *pdev)
74+
{
75+
bool mask_supported = false;
76+
uint16_t orig, new;
77+
78+
pci_block_user_cfg_access(pdev);
79+
pci_read_config_word(pdev, PCI_COMMAND, &orig);
80+
pci_write_config_word(pdev, PCI_COMMAND,
81+
orig ^ PCI_COMMAND_INTX_DISABLE);
82+
pci_read_config_word(pdev, PCI_COMMAND, &new);
83+
84+
if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) {
85+
dev_err(&pdev->dev, "Command register changed from "
86+
"0x%x to 0x%x: driver or hardware bug?\n", orig, new);
87+
} else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) {
88+
mask_supported = true;
89+
pci_write_config_word(pdev, PCI_COMMAND, orig);
90+
}
91+
pci_unblock_user_cfg_access(pdev);
92+
93+
return mask_supported;
94+
}
95+
96+
static bool pci_check_and_mask_intx(struct pci_dev *pdev)
97+
{
98+
bool pending;
99+
uint32_t status;
100+
101+
pci_block_user_cfg_access(pdev);
102+
pci_read_config_dword(pdev, PCI_COMMAND, &status);
103+
104+
/* interrupt is not ours, goes to out */
105+
pending = (((status >> 16) & PCI_STATUS_INTERRUPT) != 0);
106+
if (pending) {
107+
uint16_t old, new;
108+
109+
old = status;
110+
if (status != 0)
111+
new = old & (~PCI_COMMAND_INTX_DISABLE);
112+
else
113+
new = old | PCI_COMMAND_INTX_DISABLE;
114+
115+
if (old != new)
116+
pci_write_config_word(pdev, PCI_COMMAND, new);
117+
}
118+
pci_unblock_user_cfg_access(pdev);
119+
120+
return pending;
121+
}
122+
123+
#endif /* < 3.3.0 */
124+
125+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
126+
#define HAVE_PCI_IS_BRIDGE_API 1
127+
#endif
128+
129+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
130+
#define HAVE_MSI_LIST_IN_GENERIC_DEVICE 1
131+
#endif
132+
133+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
134+
#define HAVE_PCI_MSI_MASK_IRQ 1
135+
#endif
136+
137+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
138+
#define HAVE_ALLOC_IRQ_VECTORS 1
139+
#endif
140+
141+
static inline bool igbuio_kernel_is_locked_down(void)
142+
{
143+
#ifdef CONFIG_LOCK_DOWN_KERNEL
144+
#ifdef CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT
145+
return kernel_is_locked_down(NULL);
146+
#elif defined(CONFIG_EFI_SECURE_BOOT_LOCK_DOWN)
147+
return kernel_is_locked_down();
148+
#else
149+
return false;
150+
#endif
151+
#else
152+
return false;
153+
#endif
154+
}
155+
156+
#ifndef fallthrough
157+
158+
#ifndef __has_attribute
159+
#define __has_attribute(x) 0
160+
#endif
161+
162+
#if __has_attribute(__fallthrough__)
163+
#define fallthrough __attribute__((__fallthrough__))
164+
#else
165+
#define fallthrough do {} while (0) /* fallthrough */
166+
#endif
167+
168+
#endif

0 commit comments

Comments
 (0)