Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp766612ybl; Fri, 9 Aug 2019 13:36:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3pe2pZ95MRhbWeo63x2wfgcOir+tbMMedWSwKzxkzt9Yx/jLjNi2wBQawCZuZjoWl6dsJ X-Received: by 2002:a17:902:b944:: with SMTP id h4mr20527298pls.179.1565382965294; Fri, 09 Aug 2019 13:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565382965; cv=none; d=google.com; s=arc-20160816; b=ylNuzWf/WTV8Xye4x7o3jxHDdlYnxghZwIVL5gFmqgJuhffD4HcgkP2bjfaBGJOXF6 Azkes0Raxjr8FoHMRMUFZECIJKbbkEMLs5sBLp7OOkdZfnp1exX1b4Vi2K4ilxhjEFif ZBbfgx+r+hCAwf53P/egbRQOfAlisHhvgD1zNkBTWuBpEbDDZ1k+/9YcWz3iQY4SnmPc 4cOj++H40n7regnLQuJVLJ3SaE9CiBcWPrFEyRBX8+rMKWF7J1l1SSnpD4aVCfHCFrdp H82sB+QpQPFepYrOgH61evZh1as2aagokfI8nPEzZoWFAEZBOCyLkO5e9g6n5Zi2EVpH xvJA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=eGij1FbB9MgvxaYppuZV1K7DcJdfdX5GiLALsqu+zdk=; b=MpaMyDpEqx1VwTGE0tcQdpSLH98nsOlo+NGeYPT8Wo7HH4Wr1JZNptC/Cwq+B7h9dE A2I7wVvzNOk2xEWJTPymXb4ST5tJxtBXXUDuz4MFGOwVSI1l7dQ7SEG4NuliTD1QY6ju YQq0/57uDdLull3lwTiSPA4Y81tdvSda7Ggpgkb/2sJ+c8YdvgVMh71OijYw8FlP+9rM +paeR8/WHO5/VHR5DN3nuZbi+FgN/itaVJVsLq7P3qrYRzqzYEhEtqE1wskJF2cEoFA9 Ij4lNZAbH6vmnCP5ZTeak/3weIHMQkBXZFLMOrDEoAB2uHlyUGAlQ2HAMZ/su+URAAXg Vpyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=gR+D6iiB; 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 g15si48675904plo.239.2019.08.09.13.35.49; Fri, 09 Aug 2019 13:36:05 -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; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=gR+D6iiB; 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 S1726747AbfHIUfP (ORCPT + 99 others); Fri, 9 Aug 2019 16:35:15 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:45322 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbfHIUfO (ORCPT ); Fri, 9 Aug 2019 16:35:14 -0400 Received: by mail-qt1-f196.google.com with SMTP id f7so4221190qtq.12 for ; Fri, 09 Aug 2019 13:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=eGij1FbB9MgvxaYppuZV1K7DcJdfdX5GiLALsqu+zdk=; b=gR+D6iiBjbY6YUZdGyZSpYq3ujV9tCsEJVukL2O0IdzzyuHe+EoZtV0j+KDbWLGkU6 O/TH5Vh7YTJ/CAJ4WOiS2sN9CWLV8Ciw/IWZMgC24j+qcm2LvpAWvGPV87CToa3hrgJG TqRqqr2rc4MmuPWhzW5Auh5CBZ5K9cW//N6WLcy3lXYj2oagweuhosojSclSMOZNYgHj M5Fh1OMFRoRr5j+ODXWdTQC7nL9m62n5Gxy6HEHM3FcoJqHTARiZHMDLK6KRUGiHwD+y sbRlwP9FPuw+DFBQklflbCGzHZuq0eQmmkmmFGrDvC6n8TCUIUznjZ5rPMmnZWU9W0kK p8Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=eGij1FbB9MgvxaYppuZV1K7DcJdfdX5GiLALsqu+zdk=; b=ScWdpUUy356iU0jLhdqF27QoXfsG8307Ydo5s3YWTIwqEAEfB8sE4t/Kp7gxKi5F/1 yLk38cFowf2n3a7yLboPEnmrQJm/qO138qhBaiZatfCO0uhwOGWzIPBZ9QDZmJHVTRvO Og9yvzlUxJSRpegTwtM1LpWrufRMoOBl5vcVg7oJHsabazPqw+Dz9xvLZ/tbn0QPoqQZ eN6qmYindtMoYRUrxSrOX/WWJ6nZJzkiWbJxYJ66dKVXYXEqfVQpkrFJZN/UJuwqDQrC Pih5Dg/CvlvhOj5eZe8pma8aiU/Duitj0xcpjc3vOhMo5i6smh19G0D0qM6HRo1lioX4 mIBg== X-Gm-Message-State: APjAAAVc3fVd3YimAEnbz+gaeirjAdsgfyFA3eQOSvjvJ2BgXTyJ+jUI 1Leejc1f9GUPaR3GJfinDbfT9g== X-Received: by 2002:ac8:53c7:: with SMTP id c7mr19537664qtq.162.1565382913830; Fri, 09 Aug 2019 13:35:13 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id s58sm5731144qth.59.2019.08.09.13.35.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 13:35:13 -0700 (PDT) Date: Fri, 9 Aug 2019 13:35:09 -0700 From: Jakub Kicinski To: Antoine Tenart Cc: davem@davemloft.net, sd@queasysnail.net, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, 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: Re: [PATCH net-next v2 4/9] net: introduce MACsec ops and add a reference in net_device Message-ID: <20190809133509.12dbead1@cakuba.netronome.com> In-Reply-To: <20190808140600.21477-5-antoine.tenart@bootlin.com> References: <20190808140600.21477-1-antoine.tenart@bootlin.com> <20190808140600.21477-5-antoine.tenart@bootlin.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Aug 2019 16:05:55 +0200, Antoine Tenart wrote: > 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 { I think it'd be cleaner to have macsec_ops declared in macsec.h and forward declare macsec_ops rather than macsec_context. > + /* 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) >