From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08F241442FB for ; Mon, 29 Jul 2024 10:29:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722248967; cv=none; b=PxkGTZH7mtD+ldPSfV/JsaA2i6PoPy3kDRnqRoifnunkuzuoSH6LwAIrSzjLWd9LguJoyEE8IcNNGzM2MijwtGvUwo3zTpd+ulZ9ii/34EX4Uf4O51ky6dfy7KEnTYG/t+z9HKiijB1v3Spw5qbidGUcWxhV6CB6EI34g3rUw2g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722248967; c=relaxed/simple; bh=O6otxQZDC1k5aNFt0JF4c6gkWn1tE2tulJLiFxwOJd4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fj1Z5Qo+YvkPyKvyx7nOisuIr6gsRUOh4uPvEEejeqad3NGyfFaLbcp9x/8u5UVvQ+1U/5ZAuD2y4obH+EBk/OPy8Oe5rcvRxKnTRJtUJYCjxFwVCyaUeljPlGYQid1lSDTr0TbE0SnqpuEgdSct86ptVXl+gqLI96XAxFVnkKw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=XwFVssKS; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="XwFVssKS" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3685a5e7d3cso1448697f8f.1 for ; Mon, 29 Jul 2024 03:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1722248964; x=1722853764; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=XZGIHdfwruuw8a2HZZzQzYeFhndOAkcBR+nn4eBl6c8=; b=XwFVssKSxMP1PSKFzmTFjgxO6XuLuccRGlkVZbvlID/I90CDNYEWNr7RoQ5/1eGIb6 vFKYVpoiJEB6Jem/DU7aojuci31aYIfvm5aPrNe3FPOrj9bU1G1CevgoQ5kMPkEilmMx MwsO9CYqOixd9IXFJkw/yxtO8gH7WPeR9Fu7w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722248964; x=1722853764; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XZGIHdfwruuw8a2HZZzQzYeFhndOAkcBR+nn4eBl6c8=; b=nKiNKdf/1lIuW8ST5qEJhHVkcO/cVjMbY8wtFAqDL8IiAi3pt7Nwj+iRfB/JmNj1lF 4uhfEV2nX1tFPRMRtrK49NgMROFmudyenSWvetzXTcdDODdAkHmZvoHIWEGzT9a3t+wM u8zo9EcoQZ9p+H5Nkkb5DXLuYAI6Tey7DVq7oRzZ8d+mmUB7TSrjm6c9nIO0ykYjp1fC eIhPFAcvnL4TBFzKu+LHRdroc02pYVU2t9Y5vn5iV3oq/dK2Gg0WGn2xkSwZt6NezMDj aUVy/A5IYIs4Ocqe1vwl5i0b/MMe/2WLagzpL1cHaQ0hgDT5jpt8zWndZXyV+BOsafWZ JifQ== X-Forwarded-Encrypted: i=1; AJvYcCXMpzb4jgpEQyV5j+tde1q6FjnPqKVhl9SJkFmKkADTHbRbhYrTY+HYPViYYr9tD5efDk+eu23Bqv+Oh+2VzTrzpkDaQ9IeqXPTsQjH X-Gm-Message-State: AOJu0Yz6fBkbxoOCDavJuX+gHicdLEfPcVohyVUUdzMTxLULWg1Pc7q7 X732+MQMaWrGmXS1IuhCWmF3gyGHfcNpIiU8U/lnt2N8VQ2N9WLF/Tse7HSbqYo= X-Google-Smtp-Source: AGHT+IH4R5QJ6J278MwWKDODDM8daysZcJnYsL7HDJR6U6jL6gBsYBeGTAAWFt/xysy8mm7bLkFzwQ== X-Received: by 2002:a05:6000:2c4:b0:367:9522:5e6d with SMTP id ffacd0b85a97d-36b5d3694e1mr5786168f8f.52.1722248964322; Mon, 29 Jul 2024 03:29:24 -0700 (PDT) Received: from LQ3V64L9R2 ([80.208.222.2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4281fb6369esm12873365e9.48.2024.07.29.03.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jul 2024 03:29:24 -0700 (PDT) Date: Mon, 29 Jul 2024 11:29:22 +0100 From: Joe Damato To: Justin Lai Cc: kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, andrew@lunn.ch, jiri@resnulli.us, horms@kernel.org, rkannoth@marvell.com, pkshih@realtek.com, larry.chiu@realtek.com Subject: Re: [PATCH net-next v25 08/13] rtase: Implement net_device_ops Message-ID: Mail-Followup-To: Joe Damato , Justin Lai , kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, andrew@lunn.ch, jiri@resnulli.us, horms@kernel.org, rkannoth@marvell.com, pkshih@realtek.com, larry.chiu@realtek.com References: <20240729062121.335080-1-justinlai0215@realtek.com> <20240729062121.335080-9-justinlai0215@realtek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240729062121.335080-9-justinlai0215@realtek.com> On Mon, Jul 29, 2024 at 02:21:16PM +0800, Justin Lai wrote: > 1. Implement .ndo_set_rx_mode so that the device can change address > list filtering. > 2. Implement .ndo_set_mac_address so that mac address can be changed. > 3. Implement .ndo_change_mtu so that mtu can be changed. > 4. Implement .ndo_tx_timeout to perform related processing when the > transmitter does not make any progress. > 5. Implement .ndo_get_stats64 to provide statistics that are called > when the user wants to get network device usage. > 6. Implement .ndo_vlan_rx_add_vid to register VLAN ID when the device > supports VLAN filtering. > 7. Implement .ndo_vlan_rx_kill_vid to unregister VLAN ID when the device > supports VLAN filtering. > 8. Implement the .ndo_setup_tc to enable setting any "tc" scheduler, > classifier or action on dev. > 9. Implement .ndo_fix_features enables adjusting requested feature flags > based on device-specific constraints. > 10. Implement .ndo_set_features enables updating device configuration to > new features. > > Signed-off-by: Justin Lai > --- > .../net/ethernet/realtek/rtase/rtase_main.c | 235 ++++++++++++++++++ > 1 file changed, 235 insertions(+) > > diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c > index 8fd69d96219f..80673fa1e9a3 100644 [...] > +static void rtase_dump_state(const struct net_device *dev) > +{ [...] > + > + netdev_err(dev, "tx_packets %lld\n", > + le64_to_cpu(counters->tx_packets)); > + netdev_err(dev, "rx_packets %lld\n", > + le64_to_cpu(counters->rx_packets)); > + netdev_err(dev, "tx_errors %lld\n", > + le64_to_cpu(counters->tx_errors)); > + netdev_err(dev, "rx_errors %d\n", > + le32_to_cpu(counters->rx_errors)); > + netdev_err(dev, "rx_missed %d\n", > + le16_to_cpu(counters->rx_missed)); > + netdev_err(dev, "align_errors %d\n", > + le16_to_cpu(counters->align_errors)); > + netdev_err(dev, "tx_one_collision %d\n", > + le32_to_cpu(counters->tx_one_collision)); > + netdev_err(dev, "tx_multi_collision %d\n", > + le32_to_cpu(counters->tx_multi_collision)); > + netdev_err(dev, "rx_unicast %lld\n", > + le64_to_cpu(counters->rx_unicast)); > + netdev_err(dev, "rx_broadcast %lld\n", > + le64_to_cpu(counters->rx_broadcast)); > + netdev_err(dev, "rx_multicast %d\n", > + le32_to_cpu(counters->rx_multicast)); > + netdev_err(dev, "tx_aborted %d\n", > + le16_to_cpu(counters->tx_aborted)); > + netdev_err(dev, "tx_underun %d\n", > + le16_to_cpu(counters->tx_underun)); You use le64/32/16_to_cpu here for all stats, but below in rtase_get_stats64, it is only used for tx_errors. The code should probably be consistent? Either you do or don't need to use them? > +} > + [...] > + > +static void rtase_get_stats64(struct net_device *dev, > + struct rtnl_link_stats64 *stats) > +{ > + const struct rtase_private *tp = netdev_priv(dev); > + const struct rtase_counters *counters; > + > + counters = tp->tally_vaddr; > + > + dev_fetch_sw_netstats(stats, dev->tstats); > + > + /* fetch additional counter values missing in stats collected by driver > + * from tally counter > + */ > + rtase_dump_tally_counter(tp); > + stats->rx_errors = tp->stats.rx_errors; > + stats->tx_errors = le64_to_cpu(counters->tx_errors); > + stats->rx_dropped = tp->stats.rx_dropped; > + stats->tx_dropped = tp->stats.tx_dropped; > + stats->multicast = tp->stats.multicast; > + stats->rx_length_errors = tp->stats.rx_length_errors; See above; le64_to_cpu for tx_errors, but not the rest of the stats. Why?