Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp123532rwb; Sat, 17 Sep 2022 02:05:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6oV47pUDYROpzkekWbciXx5Gi9UK10WSSjeFkavLMM/3gvVwlJlWmW+4Wm/t/xp5/Jp3QR X-Received: by 2002:a63:1a23:0:b0:434:4395:8b5a with SMTP id a35-20020a631a23000000b0043443958b5amr7779341pga.428.1663405532869; Sat, 17 Sep 2022 02:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663405532; cv=none; d=google.com; s=arc-20160816; b=QgbGkP+GwskGBQWCYOcOH5GKgO8lSb5Xuakyq/r1ffM8U5+uRqR0Ul909MEu2UZEuP 5GYLVRJjj3W3FM0lCIw14jQPcLrYXx6GPuLypqWKvryJ37z99O4Yz/LLfnQ9td9OKj5P BJ0qoZnq0h2fyx0Lga81RWLl2SqSwDmJ1lblQ5b5uZcozwdwuTp6F0EC7QeX6S0tqwHw vh1wmbpphWQLMLn9NOhht6NdTy5K5c8WKRDJRIjpZyWwDPM0ki7thAZyzgfSOaWYi9Cr 5ClSbjd9zRsbOyvw7XNkElaeOvl4TGYv0GfoEgUxxefouwzOd50SX0wAb9s3NFGE9rqZ Id6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=8VEyWt/RYAY3zpkgir+Y3PaZ3FmEx5dtQi+QxOJw0aA=; b=BYEr6ihfLdJEe/b2X1kcD8QyovJuYCy4ZZsc0LuRTrKIvdEN4xsBlH92qsZzTU4Ixn d5aC6WxmYHZ5PlENcydnqgnkP8aVnp+G/M1XvuPqO5bO1M9DepK0aLyO+eJ2wqxK8FSX 6+iCNn7o425BpfqWM2J/p2EHUIU5ri6lYUV1LUCcrjujomhos1OO/dd1hz2doKoTTdeq 7qGeRm/PfzL7cBiRuv3172ZjbitXNZ6TEQErjQb53G/oRxSqvebF1UynwCZzPzvI5uf7 dvr2oi4IeKuc/pWR8B4svAUGRHpXSWkW76C0LSpAL1jDe1vkK0fQGR2fkle4LGXOrBpC 2nIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=MYG1Db67; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f37-20020a635125000000b0043457129bf7si7165327pgb.809.2022.09.17.02.05.19; Sat, 17 Sep 2022 02:05:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=MYG1Db67; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229662AbiIQJAW (ORCPT + 99 others); Sat, 17 Sep 2022 05:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbiIQJAU (ORCPT ); Sat, 17 Sep 2022 05:00:20 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87F191D0C5; Sat, 17 Sep 2022 02:00:18 -0700 (PDT) Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 673A340004; Sat, 17 Sep 2022 09:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1663405216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8VEyWt/RYAY3zpkgir+Y3PaZ3FmEx5dtQi+QxOJw0aA=; b=MYG1Db67qpNBXmwj+s8DOP/MOl01Z07609no99A8mJAxaRtZcejq34G2SZrChj95Y+giJW uk5EwjOv1ZTYoh7Ea9Yr4+QXn7Iss1lqY0FqsYwP5psD2dF+KrcgDTehqa8W3rAhG1akX1 NtBXkYiz0TzXu+YlWJHw7oOCjYQoNsC3+xeTUjOTdVjTYkCT7ClJaVnbmUdNtNy4KUJWTm sdrOanqjcsFST0uHAEkqlmr1IDgYuA3KuQnT6LFhMhn0zrBoIcTI4IIsU5NJhuwF+AyteM 9JIMTHO/ajk07RpsxySEj2yUf7Srm0yh9KRtK8iYHr8iYBckUCHHDvb2y2xStw== Date: Sat, 17 Sep 2022 11:00:13 +0200 From: Maxime Chevallier To: Vladimir Oltean Cc: "davem@davemloft.net" , Rob Herring , Krzysztof Kozlowski , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , "thomas.petazzoni@bootlin.com" , Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , "linux-arm-kernel@lists.infradead.org" , Luka Perkov , Robert Marko Subject: Re: [PATCH net-next v4 2/5] net: dsa: add out-of-band tagging protocol Message-ID: <20220917110013.78710782@fedora> In-Reply-To: <20220917001521.wskocisy53vozska@skbuf> References: <20220909152454.7462-1-maxime.chevallier@bootlin.com> <20220909152454.7462-3-maxime.chevallier@bootlin.com> <20220917001521.wskocisy53vozska@skbuf> Organization: Bootlin X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 Hello Vladimir, Thanks for the comment :) On Sat, 17 Sep 2022 00:15:22 +0000 Vladimir Oltean wrote: > Hi Maxime, > > On Fri, Sep 09, 2022 at 05:24:51PM +0200, Maxime Chevallier wrote: > > +int dsa_oob_tag_push(struct sk_buff *skb, struct dsa_oob_tag_info > > *ti) +{ > > + struct dsa_oob_tag_info *tag_info; > > + > > + tag_info = (struct dsa_oob_tag_info *)skb->head; > > + > > + tag_info->proto = ti->proto; > > + tag_info->dp = ti->dp; > > + > > + return 0; > > +} > > +EXPORT_SYMBOL(dsa_oob_tag_push); > > + > > +int dsa_oob_tag_pop(struct sk_buff *skb, struct dsa_oob_tag_info > > *ti) +{ > > + struct dsa_oob_tag_info *tag_info; > > + > > + tag_info = (struct dsa_oob_tag_info *)skb->head; > > + > > + if (tag_info->proto != DSA_TAG_PROTO_OOB) > > + return -EINVAL; > > + > > + ti->proto = tag_info->proto; > > + ti->dp = tag_info->dp; > > + > > + return 0; > > +} > > +EXPORT_SYMBOL(dsa_oob_tag_pop); > > + > > +static struct sk_buff *oob_tag_xmit(struct sk_buff *skb, > > + struct net_device *dev) > > +{ > > + struct dsa_port *dp = dsa_slave_to_port(dev); > > + struct dsa_oob_tag_info tag_info; > > + > > + tag_info.dp = dp->index; > > + tag_info.proto = DSA_TAG_PROTO_OOB; > > + > > + if (dsa_oob_tag_push(skb, &tag_info)) > > + return NULL; > > + > > + return skb; > > +} > > I don't have too many comments on this patch set, except for a very > fundamental one. It is impossible to pass a DSA out of band header > between the switch tagging protocol driver and the host Ethernet > controller via the beginning of skb->head, and just putting some magic > bytes there and hoping that no random junk in the buffer will have the > same value (and that skb_push() calls will not eat into your tag_info > structure which isn't accounted for in any way by skb->data). > > Please create an skb extension for this, it is the only unambiguous > way to deal with the given hardware, which will not give lots of > headaches in the future. I have no problem with the skb extension approach, my goal from the start was to find the correct way to approach this tagging process. I'll spin a new version with the skb extension approach then, unless someone else sees a problem with using skb extensions ? Thanks, Maxime