From patchwork Wed Nov 6 07:34:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1190159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 477JGT04Yjz9sP6 for ; Wed, 6 Nov 2019 18:35:13 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8D663BA9; Wed, 6 Nov 2019 07:35:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0D565BA9 for ; Wed, 6 Nov 2019 07:35:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 099D3710 for ; Wed, 6 Nov 2019 07:35:08 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from roid@mellanox.com) with ESMTPS (AES256-SHA encrypted); 6 Nov 2019 09:35:04 +0200 Received: from dev-r-vrt-139.mtr.labs.mlnx (dev-r-vrt-139.mtr.labs.mlnx [10.212.139.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id xA67Z4L1021554; Wed, 6 Nov 2019 09:35:04 +0200 From: Roi Dayan To: dev@openvswitch.org Date: Wed, 6 Nov 2019 09:34:46 +0200 Message-Id: <20191106073446.3292-1-roid@mellanox.com> X-Mailer: git-send-email 2.8.4 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Simon Horman Subject: [ovs-dev] [PATCH v3] compat: Add compat fix for old kernels X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org In kernels older than 4.8, struct tcf_t didn't have the firstuse. If openvswitch is compiled with the compat pkt_cls.h then there is a struct size mismatch between openvswitch and the kernel which cause parsing netlink actions to fail. After this commit parsing the netlink actions pass even if compiled with the compat pkt_cls.h. Signed-off-by: Roi Dayan --- Notes: v2->v3: - use AC_CHECK_MEMBER macro instead of AC_COMPILE_IFELSE v1->v2: - fix mix of tabs and spaces in acinclude.m4 acinclude.m4 | 2 ++ include/linux/pkt_cls.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index a0507cfe019e..bc5b1c667eff 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -185,6 +185,8 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [ [AC_DEFINE([HAVE_TCA_FLOWER_KEY_ENC_IP_TTL_MASK], [1], [Define to 1 if TCA_FLOWER_KEY_ENC_IP_TTL_MASK is available.])]) + AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include ]) + AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include ], [ int x = TCA_VLAN_PUSH_VLAN_PRIORITY; diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index 4adea59e7c36..2f7e328c48c8 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h @@ -64,7 +64,9 @@ struct tcf_t { __u64 install; __u64 lastuse; __u64 expires; +#ifdef HAVE_STRUCT_TCF_T_FIRSTUSE __u64 firstuse; +#endif }; #define tc_gen \