1 Star 0 Fork 76

jammyjellyfish/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0218-linux-igb_uio-fix-build-for-switch-fall-through.patch 2.39 KB
一键复制 编辑 原始数据 按行查看 历史
From e68a705cc5dc3d1333bbcd722fe4e9a6ba3ee648 Mon Sep 17 00:00:00 2001
From: Ferruh Yigit <[email protected]>
Date: Thu, 16 Dec 2021 12:03:49 +0000
Subject: [PATCH] linux/igb_uio: fix build for switch fall through
Linux is using '-Wimplicit-fallthrough=5' compiler option, which doesn't
take any fall through comments into account but only uses compiler
'fallthrough' attribute to document fall through action is intended.
"falls through" comment was used in the code which is causing a build
error now, this patch converts comment to the 'fallthrough' macro
defined in the Linux.
To cover the case where an old Linux version doesn't have the macro,
defined it in the compatibility header too.
Signed-off-by: Ferruh Yigit <[email protected]>
---
linux/igb_uio/compat.h | 14 ++++++++++++++
linux/igb_uio/igb_uio.c | 6 +++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/kernel/linux/igb_uio/compat.h b/kernel/linux/igb_uio/compat.h
index 8dbb896..71172f4 100644
--- a/kernel/linux/igb_uio/compat.h
+++ b/kernel/linux/igb_uio/compat.h
@@ -152,3 +152,17 @@ static inline bool igbuio_kernel_is_locked_down(void)
return false;
#endif
}
+
+#ifndef fallthrough
+
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(__fallthrough__)
+#define fallthrough __attribute__((__fallthrough__))
+#else
+#define fallthrough do {} while (0) /* fallthrough */
+#endif
+
+#endif
diff --git a/kernel/linux/igb_uio/igb_uio.c b/kernel/linux/igb_uio/igb_uio.c
index ea439d1..33e0e02 100644
--- a/kernel/linux/igb_uio/igb_uio.c
+++ b/kernel/linux/igb_uio/igb_uio.c
@@ -250,7 +250,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
}
#endif
- /* falls through - to MSI */
+ fallthrough;
case RTE_INTR_MODE_MSI:
#ifndef HAVE_ALLOC_IRQ_VECTORS
if (pci_enable_msi(udev->pdev) == 0) {
@@ -269,7 +269,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
break;
}
#endif
- /* falls through - to INTX */
+ fallthrough;
case RTE_INTR_MODE_LEGACY:
if (pci_intx_mask_supported(udev->pdev)) {
dev_dbg(&udev->pdev->dev, "using INTX");
@@ -279,7 +279,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
break;
}
dev_notice(&udev->pdev->dev, "PCI INTX mask not supported\n");
- /* falls through - to no IRQ */
+ fallthrough;
case RTE_INTR_MODE_NONE:
udev->mode = RTE_INTR_MODE_NONE;
udev->info.irq = UIO_IRQ_NONE;
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jammyjellyfish/dpdk.git
[email protected]:jammyjellyfish/dpdk.git
jammyjellyfish
dpdk
dpdk
master

搜索帮助