Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp347965rdb; Sat, 19 Aug 2023 04:26:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/X6zh4hL8/C+SG4P8p1kU+8WBJszhcOUBJxtDlpsyWAt7KcxXN3TtVe66hc8mu+VcqAJb X-Received: by 2002:a05:6602:3706:b0:791:e6ca:363 with SMTP id bh6-20020a056602370600b00791e6ca0363mr3027250iob.1.1692444395300; Sat, 19 Aug 2023 04:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692444395; cv=none; d=google.com; s=arc-20160816; b=aZfEvJVHhzimIrkWw40YA1C6XweBTt4Rpn/5sLVd3Nb34GS2lcNdOGeN1MNK7aTLgl vKmYTatjM/MUnv2nTg1yzokz+mDCkQVie8sCfe6KHrp8MmUSegXCW1OZoePfmb+dfzz8 GbuGpaK350Mz0Hjn5YyX8czNNUdIYPSnLyho1ZMAGPijqSudFJpzVH3hKn5VvMccwVvk 0fNLKoR5PvyarPrHroPr3mw2mhHlFPX0Xg63zoLjG13mmjN5WHChypxSjaKTg8rSakap ub4gc2ZX7ypii8U6QahCfy4wCWOZLua+0mdZp8/7QUvmofZAewS6EeSrypH5NYA/8FkD KRYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=TjyMwEAqEuMWJJGMY7Gq+mcWSO1T2j5s1kJ4gZpuJ6U=; fh=4k0fmsiMbpEUfV6DHg1eXhGwYOLXnI3xh4DKTqyDugs=; b=y9PHYr6aRbs4CpDBL8iiBBU3o6jPeb2z2WzF+TM9QWSonyB8NX26p4ZRGwlS+g9ZJd kTqjGmFKKJKEXntQ9RZbAhDZA34Wpf5AVDFLKPaT1ZmKDu1+ZrdfHf4doJeuG68gY2u/ us4x2UGbgXz7YWWwkef2U7sMY02fCgw2DDyJmfJ3GcR7Ox3EHF3wv8AJKJVqoJu3FcDU p9Qrr/Q6sFYmB1kZEXiquEfe/8sBYKFnD/UQt51KlD+qjwM+/wtsfK86xvA+N8yiO8MK twdw4EKSbtqmM96XMWPrdRmjXkOmj6vptnnKKFdcE6NU3DIp0eJPRkdKlbCztFQF5aOQ Ry+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pi13-20020a17090b1e4d00b0026b7bee6873si5265519pjb.112.2023.08.19.04.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 04:26:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AE62C643E1; Sat, 19 Aug 2023 01:34:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349755AbjHQKbf (ORCPT + 99 others); Thu, 17 Aug 2023 06:31:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349903AbjHQKbc (ORCPT ); Thu, 17 Aug 2023 06:31:32 -0400 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0C322D5A for ; Thu, 17 Aug 2023 03:31:30 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-342-Nc7mE_lqP3uzAdE5X4GxPA-1; Thu, 17 Aug 2023 06:31:26 -0400 X-MC-Unique: Nc7mE_lqP3uzAdE5X4GxPA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1528B3C100A2; Thu, 17 Aug 2023 10:31:26 +0000 (UTC) Received: from hog (unknown [10.39.192.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54F5CC15BAD; Thu, 17 Aug 2023 10:31:24 +0000 (UTC) Date: Thu, 17 Aug 2023 12:31:23 +0200 From: Sabrina Dubroca To: "Radu Pirea (OSS)" Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC net-next v1 4/5] net: macsec: introduce mdo_insert_tx_tag Message-ID: References: <20230811153249.283984-1-radu-nicolae.pirea@oss.nxp.com> <20230811153249.283984-5-radu-nicolae.pirea@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2023-08-17, 11:25:36 +0300, Radu Pirea (OSS) wrote: > > > On 16.08.2023 23:40, Sabrina Dubroca wrote: > > 2023-08-11, 18:32:48 +0300, Radu Pirea (NXP OSS) wrote: > > > Offloading MACsec in PHYs requires inserting the SecTAG and the ICV in > > > the ethernet frame. This operation will increase the frame size with 32 > > > bytes. > > > > "up to 32 bytes"? > > Yes, up to 32 bytes. > > > > > The SecTAG and ICV can both be shorter, at least with the software > > implementation. > > > > > > [...] > > > +static struct sk_buff *insert_tx_tag(struct sk_buff *skb, > > > + struct net_device *dev) > > > +{ > > [...] > > > + > > > + ctx.secy = &macsec->secy; > > > + ctx.skb = skb; > > > > I think it would be a bit more readable to just pass the skb to > > ->mdo_insert_tx_tag instead of adding it to the context. > > Since this function requires only the skb and the phydev, I would move > mdo_insert_tx_tag from macsec_ops to a new structure called mascec_tag. What > do you think about this? I think it's ok to leave it in macsec_ops. [...] > > > @@ -4137,6 +4211,11 @@ static int macsec_newlink(struct net *net, struct net_device *dev, > > > if (err) > > > goto del_dev; > > > } > > > + > > > + dev->needed_headroom -= MACSEC_NEEDED_HEADROOM; > > > + dev->needed_headroom += ops->needed_headroom; > > > + dev->needed_tailroom -= MACSEC_NEEDED_TAILROOM; > > > + dev->needed_tailroom += ops->needed_tailroom; > > > > If the driver doesn't set ops->needed_headroom, we'll subtract > > MACSEC_NEEDED_HEADROOM and not add anything back. Is that correct for > > all existing drivers? (and same for tailroom) > > It should be. However, I will do this operation only for the PHYs that needs > to parse a tag. > > > > > You set needed_tailroom to 0 in your driver, but the commit message > > for this patch says that the HW needs space for the ICV. I'm a bit > > puzzled by this, especially since MACSEC_NEEDED_TAILROOM already > > reserves space for the ICV. > > The 32 bytes headroom will compensate for 0 bytes tailroom. Ok. One more question about the ordering of patches in this series: is macsec offload with your device functional without this and the final patch? Otherwise, I would put this patch first, and then the driver patches (either collapsed into a single patch, or preferably split out if there's a reasonable way to do it -- patch 3 is really huge and hard to review). -- Sabrina