From patchwork Mon Nov 4 08:11:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1188828 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 4765965gP3z9sPT for ; Mon, 4 Nov 2019 19:11:21 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id BA5ECB6C; Mon, 4 Nov 2019 08:11:18 +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 4B68BB65 for ; Mon, 4 Nov 2019 08:11:17 +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 B87E367F for ; Mon, 4 Nov 2019 08:11:14 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from roid@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 Nov 2019 10:11:10 +0200 Received: from mtr-vdi-191.wap.labs.mlnx. (mtr-vdi-191.wap.labs.mlnx [10.209.100.28]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id xA48BAYA021919; Mon, 4 Nov 2019 10:11:10 +0200 From: Roi Dayan To: dev@openvswitch.org Date: Mon, 4 Nov 2019 10:11:05 +0200 Message-Id: <20191104081105.10933-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] 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 --- acinclude.m4 | 8 ++++++++ include/linux/pkt_cls.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index a0507cfe019e..12513b82747d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -186,6 +186,14 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [ [Define to 1 if TCA_FLOWER_KEY_ENC_IP_TTL_MASK is available.])]) AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + struct tcf_t x; + x.firstuse = 1; + ])], + [AC_DEFINE([HAVE_TCF_T_FIRSTUSE], [1], + [Define to 1 if struct tcf_t have firstuse.])]) + + 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..b6926a79a0af 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_TCF_T_FIRSTUSE __u64 firstuse; +#endif }; #define tc_gen \