Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5220176pxb; Wed, 26 Jan 2022 07:19:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAF44i8/Do2+b0+nt0hKzoKlwKcdCBuaA+5H/ONBIhwP/0c6fpyzurvOUHJkuMQO+SuCSM X-Received: by 2002:a05:6402:5178:: with SMTP id d24mr20504641ede.272.1643210373474; Wed, 26 Jan 2022 07:19:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643210373; cv=none; d=google.com; s=arc-20160816; b=R8koD5xOwO4/2rQx91yp8+6e8EaU7ZLozLnIi/tesZQFkhOOXBchzj3lubeAvROgPf /WEmN9iP06yxul3IhIPASU3TrsY2S3WbDxsgSETUs3ebTp5UBeeys9wLqI0AgJ20P+oO wDCeSleSl82lkWyZOI/XRumrgk3k+0EqbqUF+xSN2l5Pkk9Gyygb7gM1qHTaLOAuOMWj KxLKfo5XQ/D6mg9xMJEej8epdt9rWtCwThh64qkb6biTykWRQm6QoPZAlJgq+ylKZD0z O2zPD/SalDg1zluFmILY9bOtveTJ2SVLmcZycuOsPIDy7Cp1oCrORjKPM+Myp4KD7iw3 YtDA== 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=dPBEV0U/t+nROk+shzA6Wefz8zNhH3ImNVNgEo2wSCc=; b=tq3uLRjF8dPGqIPrlcx0hZSEzFLYZwxQmSVRdkGDHjrYHvP1T8/J8yyq8v4655rrRS AVGJcTml4sJEZsPrc7VfAxks5aupuggNAnPCPWe9Kf5CFlz52un/RX67S6Oi3w76RfBW wvhaRRyyUQjq8RAroQV8PJ8qdjcCeyXNZfH4kpr/zHEcwmxtBfBHSARK31JpBNBfYjvj vCjAwPnAb6J5kKNzwTwDtQ2ljsRhocUIzg0IEU/2e56NJJcX0uVYPQzYnLaOMbgUMRwV efxuJpLOoU6eQGsehQlRp6nEvLUEN6JfvD8XxYIHcy5uS3Bo+8GxVb+3u4REEjX8YiEW WAhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O6leYA64; 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 e18si7818140edz.40.2022.01.26.07.19.07; Wed, 26 Jan 2022 07:19:33 -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=O6leYA64; 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 S236003AbiAZBtJ (ORCPT + 99 others); Tue, 25 Jan 2022 20:49:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236005AbiAZBtD (ORCPT ); Tue, 25 Jan 2022 20:49:03 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D96C06174E; Tue, 25 Jan 2022 17:48:58 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id d10so35051753eje.10; Tue, 25 Jan 2022 17:48:58 -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=dPBEV0U/t+nROk+shzA6Wefz8zNhH3ImNVNgEo2wSCc=; b=O6leYA64jUSyOyMmEaK9Zv2Tz3/keIgW4/6KDhXXjrETQwiC4+C63ZL4PvQ7URNskc Q9BF3Se1fGd2MsjRIcKJOOd5Xg+LuDfbIPtyn9A4W7oHNB/7sCEMz7PkV5t2cJXINkA0 a80TGsk8euoyW0a36A3zWOOeUJcU83175xI9JthEXF/vNECV/GNSt2M7C495h16OUz3o XlJ6Os16ojwM+uNPCV8gCjKZxU1uCcJBGvHqQY1a2QOmtf9+a9+R29TgpM7YWkGxzO9V OEwU0ViknxxcxJQ/910Uxura7Fxl3SOOD7PG0vIXKD6IGSJ6eQ/nuy8zun4ljlkx1MqF cz9Q== 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=dPBEV0U/t+nROk+shzA6Wefz8zNhH3ImNVNgEo2wSCc=; b=ZcjnPjFL6nGyyKNUZIqILoVIHwvDEYRebkRR0PnqroACeqjm0rIc6pE0B+2n4baEnF uxNkA7h4KsB/zXCHfBoaizMrw+Rkx62EjCYYAcKT/t0LaaL9mpXgTTqiR6pJd9fdmxS3 aw4FAKN48QlaQZleNaFgfTcsLrnYUS/BycwKSN/c7qbeW0hFAzlb2UmKBl9Fak8uqk+b RbAsU5hvEG7C+jHwkpLQZtGm8i0C4KSVxN7pvF93jLQRCrPuuKxXKCOrYq+3GBMf1ukw WbDUyUgANlAcviHWdOO+voEv0Fm6/Sem+bJCgwDsr/1bVvNz7irCYULkyNoXL/6VdkU5 P0Lw== X-Gm-Message-State: AOAM532ESNvNG2llqyAzdLxCT02BOhstMdDeT92OO4rggMKoqIz8aijg NG6RxDhA/yUuYph5s+LpBGw= X-Received: by 2002:a17:907:e8b:: with SMTP id ho11mr10218258ejc.686.1643161736831; Tue, 25 Jan 2022 17:48:56 -0800 (PST) Received: from skbuf ([188.27.184.105]) by smtp.gmail.com with ESMTPSA id g27sm9056918edj.79.2022.01.25.17.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jan 2022 17:48:56 -0800 (PST) Date: Wed, 26 Jan 2022 03:48:54 +0200 From: Vladimir Oltean To: Ansuel Smith Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [RFC PATCH v7 12/16] net: dsa: qca8k: add support for phy read/write with mgmt Ethernet Message-ID: <20220126014854.opnyrd56nsrk7udp@skbuf> References: <20220123013337.20945-1-ansuelsmth@gmail.com> <20220123013337.20945-13-ansuelsmth@gmail.com> <20220125150355.5ywi4fe3puxaphq3@skbuf> <61f08471.1c69fb81.a3d6.4d94@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <61f08471.1c69fb81.a3d6.4d94@mx.google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 26, 2022 at 12:14:55AM +0100, Ansuel Smith wrote: > > At some point, you'll have to do something about those sequence numbers. > > Hardcoding 200 and 400 isn't going to get you very far, it's prone to > > errors. How about dealing with it now? If treating them as actual > > sequence numbers isn't useful because you can't have multiple packets in > > flight due to reordering concerns, at least create a macro for each > > sequence number used by the driver for packet identification. > > Is documenting define and adding some inline function acceptable? That > should make the separation more clear and also prepare for a future > implementation. The way I see an use for the seq number is something > like a global workqueue that would handle all this stuff and be the one > that handle the seq number. > I mean another way would be just use a counter that will overflow and > remove all this garbage with hardcoded seq number. > (think will follow this path and just implement a correct seq number...) Cleanest would be, I think, to just treat the sequence number as a rolling counter and use it to match the request to the response. But I didn't object to your use of fixed numbers per packet type, just to the lack of a #define behind those numbers. > > > + mutex_lock(&phy_hdr_data->mutex); > > > > Shouldn't qca8k_master_change() also take phy_hdr_data->mutex? > > > > Is actually the normal mgmg_hdr_data. > > phy_hdr_data = &priv->mgmt_hdr_data; > > Should I remove this and use mgmt_hdr_data directly to remove any > confusion? I am not thrilled by the naming of this data structure anyway (why "hdr"?), but yes, I also got tricked by inconsistent naming. Please choose a consistent name and stick with it.