Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5351319pxb; Wed, 26 Jan 2022 10:00:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX+DHxBIz1iwhK50O8MTXeTUFrsiAMLa7aDBTadNT93o7Bja9L8LNDzpXZn8WbEDN5tCBo X-Received: by 2002:a17:907:75f7:: with SMTP id jz23mr14945113ejc.460.1643220014763; Wed, 26 Jan 2022 10:00:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643220014; cv=none; d=google.com; s=arc-20160816; b=RLK97Cn4ay0KneBJeIDyMA4FT5ui8usOSaScRQMLXNu9snxYpW37dQmYB6WSC/SwlG 21Y9Zxciz/iUWjMjyomgVYp2u6SkcPo6u//BULdRU127dyVUBs9yFSE/xYY/z56GyXWU kKMoUL3fbh7dM5vLyJ0tWscWwoqKXD6D/iyQnAimDKOiiDaGi6mpVJuIdPBdULiih7t3 AtE2580exf6PYqUNBDjSGCuAukoHxLajfws2+9MaAEokgjXQfRVbn7PC+JP/h6caxnJ2 gjAy8h1MEj8iDXbjG3Vo+AsXQ9+K1WKtvbpT162xCqQvpqBNTNWFfR0DoNeeBlBvplZt i/nw== 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:dkim-signature; bh=lMvaUNa0epuWNVjB66ksvUi4IFQlW9eBOcK2Yd36MmQ=; b=uYNE68UfIJB0uXpZexSQYw01HGHm6vNWTasu39shjd+IAVb2gDgc+42vNTIElgy7sn E6o2bWRh83th07E0QMKKCHg3Ukfxuw5nRObvZ8K7SP+CHAqm0ezSlgzgD92F0RwQNSw8 S2WPZwy1J4qwHASZ2ipsU6ShvNnM8+3k8ypoSfwxgPj2+SxJgmk7dqEZSjvCpaFSVMPZ 5EBjloxvuYEoUlANu71xDzB8kvsTnZOLpWYLHLmMeiu0EyzYTfi91xGWPaNV8qIYPrlB VIOpLTS1Y6kzrz9KTVU5y7usrXpvtg4fhDMaQ7ocKqtYRyhuFV+vN5AW1Y1KbD2kupCf yKtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fwAoJX7u; 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 e4si11257525ejl.40.2022.01.26.09.59.46; Wed, 26 Jan 2022 10:00:14 -0800 (PST) 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=20210112 header.b=fwAoJX7u; 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 S237478AbiAZEFy (ORCPT + 99 others); Tue, 25 Jan 2022 23:05:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237464AbiAZEFl (ORCPT ); Tue, 25 Jan 2022 23:05:41 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7EBEC061747; Tue, 25 Jan 2022 20:05:40 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id k25so35508710ejp.5; Tue, 25 Jan 2022 20:05:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lMvaUNa0epuWNVjB66ksvUi4IFQlW9eBOcK2Yd36MmQ=; b=fwAoJX7uENLxSN7DTZ8PqBXvJvcMTediYsfnKAuesi62gHW5S0sMY3sRwYGYjOSSww WZHn9IqZwvqcHn7q3eGzmXnz4rw+32/rHlbgx+AEQkY1LRlWft4XVEOPCO11jc8fo2uL M4Qgz7ftiLcfTPFnTSO57whNdmKoZRInoRh9PQnrXAWPMiEj0ZppY0xSMK1qF6tp6x6o gNVCHQfoHgInaF7/90STsrZDPuI0EZ2iIfv2umu8mpsYYPA9voAz7dH7g3z+SVRvwX2K isdCFOGST6ABNIIupcYk5k6zsaukQ0pfsDMH54e0/06ZjwnBiagMrHGmXu2+rH7YmTkK YPMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lMvaUNa0epuWNVjB66ksvUi4IFQlW9eBOcK2Yd36MmQ=; b=WALpaEdCwWlOAUeA8chZbT3n/au+9Ou0jBs58nsp0hCCKJr864V5pVzEuFORm0cvsk DtlDlVV7aKTJfPHwG2tT2P6VWj+C9hMmStNqnVT7WNW58hUGeU0/nVxRDaMnrBnvPWp3 5eJklxXDleikZieQHlbJb3PlQgFC/HgCdBW0Adop0E9QPfxnJyVyHAtDUL6TByzO+Aw+ zBmckxhJ2iSl3QhWnmQk4o+2Kbw22YkHSK9zXwQtdcq6VNeMPa+h0lhzMnhrqBSLHzUa TdwbARFzzJkKFfNsQtvc1BLMw0YrAlCss5XXMMLigkQ1ibIpzde7Cymw6h5FDsRLgr3k hUWg== X-Gm-Message-State: AOAM5330Wt6waJGc1tWToOqNOCkucMy/cv148vTi8ERS751wESb0R/xf Q084MipEWwhhOKr86rCB+TQ= X-Received: by 2002:a17:906:9743:: with SMTP id o3mr18624064ejy.162.1643169939262; Tue, 25 Jan 2022 20:05:39 -0800 (PST) Received: from Ansuel-xps.localdomain (93-42-71-246.ip85.fastwebnet.it. [93.42.71.246]) by smtp.gmail.com with ESMTPSA id gu2sm6823228ejb.221.2022.01.25.20.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jan 2022 20:05:38 -0800 (PST) Date: Wed, 26 Jan 2022 05:05:37 +0100 From: Ansuel Smith To: Florian Fainelli Cc: Andrew Lunn , Vivien Didelot , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [RFC PATCH v7 06/16] net: dsa: tag_qca: add define for handling mgmt Ethernet packet Message-ID: References: <20220123013337.20945-1-ansuelsmth@gmail.com> <20220123013337.20945-7-ansuelsmth@gmail.com> <70a44baa-4a1c-9c9e-6781-b1b563c787bd@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 08:02:53PM -0800, Florian Fainelli wrote: > > > On 1/25/2022 8:01 PM, Ansuel Smith wrote: > > On Tue, Jan 25, 2022 at 07:54:15PM -0800, Florian Fainelli wrote: > > > > > > > > > On 1/22/2022 5:33 PM, Ansuel Smith wrote: > > > > Add all the required define to prepare support for mgmt read/write in > > > > Ethernet packet. Any packet of this type has to be dropped as the only > > > > use of these special packet is receive ack for an mgmt write request or > > > > receive data for an mgmt read request. > > > > A struct is used that emulates the Ethernet header but is used for a > > > > different purpose. > > > > > > > > Signed-off-by: Ansuel Smith > > > > --- > > > > > > [snip] > > > > > > > +/* Special struct emulating a Ethernet header */ > > > > +struct mgmt_ethhdr { > > > > + u32 command; /* command bit 31:0 */ > > > > + u32 seq; /* seq 63:32 */ > > > > + u32 mdio_data; /* first 4byte mdio */ > > > > + __be16 hdr; /* qca hdr */ > > > > +} __packed; > > > > > > Might be worth adding a BUILD_BUG_ON(sizeof(struct mgmt_ethhdr) != > > > QCA_HDR_MGMT_PKG_LEN) when you start making use of that structure? > > > > Where should I put this check? Right after the struct definition, > > correct? (I just checked definition of the macro) > > It would have to be in a call site where you use the structure, I have not > checked whether putting it in a static inline function in .h file actually > works if the inline function is not used at all. Think I can test that by just putting a wrong value in QCA_HDR_MGMT_PKG_LEN and check if the error is triggered. Will check if the macro will actually work. > -- > Florian -- Ansuel