From patchwork Thu Dec 16 12:03:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 105159 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67BECA00C3; Thu, 16 Dec 2021 13:03:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E358740696; Thu, 16 Dec 2021 13:03:55 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 22E2B40143 for ; Thu, 16 Dec 2021 13:03:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639656234; x=1671192234; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TrSnIgegkerrM7ELTZOj15WNa3ZKyPITnu8GIhaBuE8=; b=S8s/y7Ej7bp/jtz0L6vVt41AD11oakiYaeb93rcA7vmqZ2IQFAYxrqi7 v0S8pp9lgrrclo51VSkp058FZpmzV5lMjW3o5bIOc5oF1HbBtEpl75iGS Wo+d3R+Y8efdYD2/P8O74aiZWW6i5+SYSQpjR7BIFhYP1H/un3UkNTv5v T+dxnKp2Vo6t1Bd4JKjXV20INeT476JfZ0ldIcMjpjAEr2na2ycDNSeRp kX4K1vh0mgPHhTTznXsm4H4p8OzdlnAT5s1Jse8e2qpKnetB1t4GAIJ+g UmK/A7SiccX6REV2i2ue8fzCtdq3nhNyzWbcHXPSCXdlnBd1PiU4y5FNP Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10199"; a="220151369" X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="220151369" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2021 04:03:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="605483612" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.27]) by FMSMGA003.fm.intel.com with ESMTP; 16 Dec 2021 04:03:52 -0800 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit , Stephen Hemminger Subject: [dpdk-kmods v2] linux/igb_uio: fix build for switch fall through Date: Thu, 16 Dec 2021 12:03:49 +0000 Message-Id: <20211216120349.2088759-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211215184859.1859870-1-ferruh.yigit@intel.com> References: <20211215184859.1859870-1-ferruh.yigit@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- Cc: Stephen Hemminger v2: * Add both dummy and attribute fallthrough macro definition to compatibility header. --- linux/igb_uio/compat.h | 14 ++++++++++++++ linux/igb_uio/igb_uio.c | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/linux/igb_uio/compat.h b/linux/igb_uio/compat.h index 8dbb896ae118..71172f40cff1 100644 --- a/linux/igb_uio/compat.h +++ b/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/linux/igb_uio/igb_uio.c b/linux/igb_uio/igb_uio.c index ea439d131de1..33e0e0286b69 100644 --- a/linux/igb_uio/igb_uio.c +++ b/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;