Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6887746ybh; Thu, 8 Aug 2019 07:12:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5mwcWwpEWMfP3bymWwQ5i6EcWjZvtgxqVrbEuJVWfFWc6SfHoY9vwsypmdd5k5QwuHo29 X-Received: by 2002:a17:90a:1ae2:: with SMTP id p89mr4130429pjp.26.1565273560040; Thu, 08 Aug 2019 07:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565273560; cv=none; d=google.com; s=arc-20160816; b=kdng6wc5cebY9y5JJqtC4LYwnenG35AW9/JJvSs6cBpdaaOf03uipG0RKoBfqSbffq RyQ9LGGjwtgtF2k6GjXK6o+SoUsOp2+k3gYIX4kCpAQHsDC1nx0upna9yogSDgUyB2re I/al0zkhpuq79eoZ/hHAJLuxMYXvdMIWq4heEk78UfXaCZTz5rq5famKglMxHl3dpoSn XrWOCjZwNI6cg+zPWzSgVzJI7xxLZQptkDEU4lbDNZGTxdkKnoN1VhNSvAQOoU7XXZyN gEEC0kWpURGKigitXUj0EIRyYn1YDA5oI5tP0P8EutdfILrk9YhCuapLsJnTIdd12J5N P24Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=olGqrHbWgJYBHSzhDhIqeRkucCOQdIbOWtku0QPIOc0=; b=SlhlUbJRGLSmgeEEeypCiSQ9zx0bcjOTt6ep/l41quBitB0mmP6zIvTEdMI529W9Em X/ciMPjsFL330davfJtwXPVO6hhQMvik3bxVo7ND4TJs8IA/e8F+Mpq9YbymArzj1zIy 8c9spIOZ3UMrsw4MuWdKMFV/XLAVEdocNvlZXbugH01pTnTI4QF3OwYewjqUnA/Unzju 6PMVKqWdPpdrAzulmFz+ynPQ0xYjEV7xE7MFXTogNUyon9/3Q0933PjfRQVP6ZDPUCHQ PTGFdzZ4+mJYQzOU2+bPgEFHgS0RhhC0vKX3aj2DNiaX9+bYtLVOxyU80BFN6yrzXEeY lzJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e92si47736945pld.312.2019.08.08.07.12.23; Thu, 08 Aug 2019 07:12:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403927AbfHHOLA (ORCPT + 99 others); Thu, 8 Aug 2019 10:11:00 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:41341 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389983AbfHHOKL (ORCPT ); Thu, 8 Aug 2019 10:10:11 -0400 X-Originating-IP: 86.250.200.211 Received: from localhost (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: antoine.tenart@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 588F460010; Thu, 8 Aug 2019 14:10:09 +0000 (UTC) From: Antoine Tenart To: davem@davemloft.net, sd@queasysnail.net, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com Cc: Antoine Tenart , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com, allan.nielsen@microchip.com, camelia.groza@nxp.com, Simon.Edelhaus@aquantia.com Subject: [PATCH net-next v2 4/9] net: introduce MACsec ops and add a reference in net_device Date: Thu, 8 Aug 2019 16:05:55 +0200 Message-Id: <20190808140600.21477-5-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190808140600.21477-1-antoine.tenart@bootlin.com> References: <20190808140600.21477-1-antoine.tenart@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces MACsec ops for drivers to support offloading MACsec operations. A reference to those ops is added in net_device. Signed-off-by: Antoine Tenart --- include/linux/netdevice.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 88292953aa6f..59ff123d62e3 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -53,6 +53,7 @@ struct netpoll_info; struct device; struct phy_device; struct dsa_port; +struct macsec_context; struct sfp_bus; /* 802.11 specific */ @@ -910,6 +911,29 @@ struct xfrmdev_ops { }; #endif +#if defined(CONFIG_MACSEC) +struct macsec_ops { + /* Device wide */ + int (*mdo_dev_open)(struct macsec_context *ctx); + int (*mdo_dev_stop)(struct macsec_context *ctx); + /* SecY */ + int (*mdo_add_secy)(struct macsec_context *ctx); + int (*mdo_upd_secy)(struct macsec_context *ctx); + int (*mdo_del_secy)(struct macsec_context *ctx); + /* Security channels */ + int (*mdo_add_rxsc)(struct macsec_context *ctx); + int (*mdo_upd_rxsc)(struct macsec_context *ctx); + int (*mdo_del_rxsc)(struct macsec_context *ctx); + /* Security associations */ + int (*mdo_add_rxsa)(struct macsec_context *ctx); + int (*mdo_upd_rxsa)(struct macsec_context *ctx); + int (*mdo_del_rxsa)(struct macsec_context *ctx); + int (*mdo_add_txsa)(struct macsec_context *ctx); + int (*mdo_upd_txsa)(struct macsec_context *ctx); + int (*mdo_del_txsa)(struct macsec_context *ctx); +}; +#endif + struct dev_ifalias { struct rcu_head rcuhead; char ifalias[]; @@ -1755,6 +1779,8 @@ enum netdev_priv_flags { * * @wol_enabled: Wake-on-LAN is enabled * + * @macsec_ops: MACsec offloading ops + * * FIXME: cleanup struct net_device such that network protocol info * moves out. */ @@ -2036,6 +2062,11 @@ struct net_device { struct lock_class_key *qdisc_running_key; bool proto_down; unsigned wol_enabled:1; + +#if IS_ENABLED(CONFIG_MACSEC) + /* MACsec management functions */ + const struct macsec_ops *macsec_ops; +#endif }; #define to_net_dev(d) container_of(d, struct net_device, dev) -- 2.21.0