Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3855889pxy; Mon, 26 Apr 2021 11:21:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2bE50UBeoIBFgW3rQOzafvlBdTq4amphD7m19FFHmmmiND2FnwwtMgv2RbfsaiFLUuCA5 X-Received: by 2002:a05:6402:31b3:: with SMTP id dj19mr11447edb.180.1619461268379; Mon, 26 Apr 2021 11:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619461268; cv=none; d=google.com; s=arc-20160816; b=TDZfLLmHrQBLJ8HcsIc/bj89Qe97z9BBg0mdxEwHJzwA8wyOWCnsMNrGym3GImjyYr SzhIGsXOQCJq47i3Aqhy8kqh6YHpnJ9UJ12Ll+iFsu+jWrPiMqYwy7UdP0M6hITZ0qnz SCVdlpNPPnbec46USqwzhtsta+K+aUAASST3DcOYDpbeSNVfLJQeUlf8hjVqoOwfp9bs MtA1L1qx8XEkn/TDuD9C0OPGiouE8iALsQ1ITMMr0XQsjlwuKSWtWvMaPE7CZZ6iUUrw K/J6FXtwz/hXs208kPWtikA1lYUSIPPgXe4d+IuGR9Uav1vKPjW8ac5qnYrnq4W94CG/ /dug== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xkTVD7TxqQ3Zluwvp9FancUs4koGyF+oIROL0cTLdhk=; b=GiEf8r+hk2RpJFineT/BqgNnqZe1tmLiEYkcfT8GxCB5EwpBfWdSwoJAcbF0rVGC6i h0zkyWHkw4vCEKI4+6BfcQp0aRZ9UQ6hXnbULFvJczjOWFOC7l4a0+pghnF4fU8hOLbk TNrDPVzg3/GPj7Aa2JsJcr5eOJzokVBOoE/VYeREn6zHbKHkmEmiBwq5ISIUDq59Xz/+ rahWDe6Jbyy1rAFj0Mv5LnNUVYk+rSnIdFCe/F+rcQvLA58dr8lv3xcaxLXZFMWA/ler nm5qhuoSxgJxfVqlCQTWXikwgcmmoJQ4Sz5j+xeE2nK5lDfYwU3j2faVHS0AeLq0aRPO yJpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XUQJEpNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i22si423100edy.578.2021.04.26.11.20.44; Mon, 26 Apr 2021 11:21:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XUQJEpNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234275AbhDZSRY (ORCPT + 99 others); Mon, 26 Apr 2021 14:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233842AbhDZSRX (ORCPT ); Mon, 26 Apr 2021 14:17:23 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77F3BC061574; Mon, 26 Apr 2021 11:16:41 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id d14so3025900edc.12; Mon, 26 Apr 2021 11:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=xkTVD7TxqQ3Zluwvp9FancUs4koGyF+oIROL0cTLdhk=; b=XUQJEpNTdYzJF4uxqnEwIbQVU13+kxG+1fTgzfVoKCcV2260aiookfc9nRP/w+YdEw UPStvO2Hb9yEzvEgSF0rro3K6J6ctKM+BJFYlgNIIAVvWw+f5ntN0nmbu4NCmGfvS2Bw jYlhT3PDOoyrZDjhcQy7oqfUja/1LFoYvwnIXU5wUeEPcxxnB5Ft83JkHKUJDRFhH6HS A9NqRwFtOlq1gJvVJbPcPGleeog6oX7zqg/uLzpRgvuPEu7InxHJLncJos5FtcmvrWng 9cqfFJjEyAQct+d5jcZq4IXOtGAkodPfj53TkwfatCdME5/LJa16VgVqjI2trzWDABiS obEA== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=xkTVD7TxqQ3Zluwvp9FancUs4koGyF+oIROL0cTLdhk=; b=E4LSHpfXqfofvccAQGC7tSfTtI1K4aGbMNkZoCcStN6ny2fv8JybKnUSnh2utRXnlc 6ne+cKSNzZICeA/brFH1k2CzzH6TlDyGOVXSKTJGsNE/qMFO2IgAWA8y7g/SMnNnkFYR 2E3ImtFEFKk/+T8QGapwZOW3uC5AXnpgyWTu93MpIsBnhe1gqY66qNkMTAGTaxE8nsOM 0/UjE9w+12NZGR297AiE3XsjRsEJGhjkDZZP+nNzp1wBQ0QlQEucER3k+n1XQOC1EKtn SR3+jgS857wvnrUHbRDGXCvx/e5hmgkrpBmHHOYEc01qRjqbiMW2zZN0dKv5MCUsyl/p nMyA== X-Gm-Message-State: AOAM533vGyqlW5KqFHL8wR29toLQXokFHTTrtrrDhTWhGUksm5++ViuJ ytiwHBgy7sukVDL3kPkczhc= X-Received: by 2002:aa7:c789:: with SMTP id n9mr23203387eds.352.1619460999822; Mon, 26 Apr 2021 11:16:39 -0700 (PDT) Received: from skbuf (5-12-16-165.residential.rdsnet.ro. [5.12.16.165]) by smtp.gmail.com with ESMTPSA id h11sm497319eds.15.2021.04.26.11.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 11:16:39 -0700 (PDT) Date: Mon, 26 Apr 2021 21:16:37 +0300 From: Vladimir Oltean To: Yangbo Lu Cc: netdev@vger.kernel.org, Richard Cochran , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , Jonathan Corbet , Kurt Kanzenbach , Andrew Lunn , Vivien Didelot , Florian Fainelli , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [net-next, v2, 3/7] net: dsa: free skb->cb usage in core driver Message-ID: <20210426181637.2rneohfxkrvwctf2@skbuf> References: <20210426093802.38652-1-yangbo.lu@nxp.com> <20210426093802.38652-4-yangbo.lu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210426093802.38652-4-yangbo.lu@nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 26, 2021 at 05:37:58PM +0800, Yangbo Lu wrote: > Free skb->cb usage in core driver and let device drivers decide to > use or not. The reason having a DSA_SKB_CB(skb)->clone was because > dsa_skb_tx_timestamp() which may set the clone pointer was called > before p->xmit() which would use the clone if any, and the device > driver has no way to initialize the clone pointer. > > Although for now putting memset(skb->cb, 0, 48) at beginning of > dsa_slave_xmit() by this patch is not very good, there is still way > to improve this. Otherwise, some other new features, like one-step > timestamp which needs a flag of skb marked in dsa_skb_tx_timestamp(), > and handles as one-step timestamp in p->xmit() will face same > situation. > > Signed-off-by: Yangbo Lu > --- > Changes for v2: > - Added this patch. > --- > drivers/net/dsa/ocelot/felix.c | 1 + > drivers/net/dsa/sja1105/sja1105_main.c | 2 +- > drivers/net/dsa/sja1105/sja1105_ptp.c | 4 +++- > drivers/net/ethernet/mscc/ocelot.c | 6 +++--- > drivers/net/ethernet/mscc/ocelot_net.c | 2 +- > include/linux/dsa/sja1105.h | 3 ++- > include/net/dsa.h | 14 -------------- > include/soc/mscc/ocelot.h | 8 ++++++++ > net/dsa/slave.c | 3 +-- > net/dsa/tag_ocelot.c | 8 ++++---- > net/dsa/tag_ocelot_8021q.c | 8 ++++---- > 11 files changed, 28 insertions(+), 31 deletions(-) > > diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c > index d679f023dc00..8980d56ee793 100644 > --- a/drivers/net/dsa/ocelot/felix.c > +++ b/drivers/net/dsa/ocelot/felix.c > @@ -1403,6 +1403,7 @@ static bool felix_txtstamp(struct dsa_switch *ds, int port, > > if (ocelot->ptp && ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) { > ocelot_port_add_txtstamp_skb(ocelot, port, clone); > + OCELOT_SKB_CB(skb)->clone = clone; > return true; > } > Uh-oh, this patch fails to build: In file included from ./include/soc/mscc/ocelot_vcap.h:9:0, from drivers/net/dsa/ocelot/felix.c:9: drivers/net/dsa/ocelot/felix.c: In function ‘felix_txtstamp’: drivers/net/dsa/ocelot/felix.c:1406:17: error: ‘skb’ undeclared (first use in this function) OCELOT_SKB_CB(skb)->clone = clone; ^ ./include/soc/mscc/ocelot.h:698:29: note: in definition of macro ‘OCELOT_SKB_CB’ ((struct ocelot_skb_cb *)((skb)->cb)) ^~~ drivers/net/dsa/ocelot/felix.c:1406:17: note: each undeclared identifier is reported only once for each function it appears in OCELOT_SKB_CB(skb)->clone = clone; ^ ./include/soc/mscc/ocelot.h:698:29: note: in definition of macro ‘OCELOT_SKB_CB’ ((struct ocelot_skb_cb *)((skb)->cb)) ^~~ It depends on changes made in patch 3.