From patchwork Fri Mar 11 17:18:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 12778421 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DC3CC433FE for ; Fri, 11 Mar 2022 17:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350714AbiCKRTo (ORCPT ); Fri, 11 Mar 2022 12:19:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350701AbiCKRTj (ORCPT ); Fri, 11 Mar 2022 12:19:39 -0500 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD82E540D for ; Fri, 11 Mar 2022 09:18:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647019115; x=1678555115; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cOPa8b1ggar4hcTeucBpmRcDsrxkQql4RjdyytRuI/s=; b=hTzetwIsdgVA90okvAvmerPgHsgrpHyzfKbVrcgPkpmhq7hVKh1e+eXS F2fdSRa1DNmj77Tr3scMXtcECpSY53PvHBXJqyKolOdid0cb/baEjqPMz SAt22JYD4aDUvRSo4nDNr681/YD0ljmjXQwE1EJ2yk8YgT5fEOLVlROBr EFAA5AeEIKzyvlA0Yas6XRg4ASMSzYsUzLY8K742CfzI7BnusmGENdPyY YzfXvdHlVEakoNPfqzIbchJU0tVtW9PL8+bqg8aEG3KvFmOEzEdC+0u0b GMl6QMpsbVoa8Ct4knitWpQYh2azW0tQZsNcLGwa0EoTienapA1wgWWVJ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10283"; a="316335131" X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="316335131" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 09:18:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="612215411" Received: from anguy11-desk2.jf.intel.com ([10.166.244.147]) by fmsmga004.fm.intel.com with ESMTP; 11 Mar 2022 09:18:33 -0800 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org Cc: Wojciech Drewek , netdev@vger.kernel.org, anthony.l.nguyen@intel.com, marcin.szycik@linux.intel.com, michal.swiatkowski@linux.intel.com, jiri@resnulli.us, pablo@netfilter.org, laforge@gnumonks.org, xiyou.wangcong@gmail.com, jhs@mojatatu.com, osmocom-net-gprs@lists.osmocom.org Subject: [PATCH net-next v11 5/7] gtp: Add support for checking GTP device type Date: Fri, 11 Mar 2022 09:18:19 -0800 Message-Id: <20220311171821.3785992-6-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220311171821.3785992-1-anthony.l.nguyen@intel.com> References: <20220311171821.3785992-1-anthony.l.nguyen@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Wojciech Drewek Add a function that checks if a net device type is GTP. Signed-off-by: Wojciech Drewek Reviewed-by: Harald Welte Signed-off-by: Tony Nguyen --- include/net/gtp.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/net/gtp.h b/include/net/gtp.h index 23c2aaae8a42..c1d6169df331 100644 --- a/include/net/gtp.h +++ b/include/net/gtp.h @@ -63,6 +63,12 @@ struct gtp_pdu_session_info { /* According to 3GPP TS 38.415. */ u8 qfi; }; +static inline bool netif_is_gtp(const struct net_device *dev) +{ + return dev->rtnl_link_ops && + !strcmp(dev->rtnl_link_ops->kind, "gtp"); +} + #define GTP1_F_NPDU 0x01 #define GTP1_F_SEQ 0x02 #define GTP1_F_EXTHDR 0x04