From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795888193; b=uYRHTGYDFM0Ubqfq1ahv8IGTKFSfskOXGLsocXSa0nTXW1jqMMtPjdS3x6xd7dRqX1eV p7ALkiRdlWTnGa+W5CzRQN6k8FpsR2lfEag/OqU3wocOkkXj6wj52MKbP0OmgWKkCROEV JhoHJsROqg3GAx4l+CBQw2sCFJ4byzywZV54rVcBubIjYxRZfpm3BbnNyQLS6MYld2H2J 3yRhXr4kB4O646MO1BUOHCaUmEbq/Zns3ngDQsoGNdL+SZt57GZa1ucQNZK3ptE9yALp6 xjH/qW3LMLf+eGAMrEE0ZvCAN7DUVi25Z9ao1zOJDSc5O13j0TDotGG19HX2aBYCgAQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795888193; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=v0TZTafjXeE7cShJV5rlyuLnh47Gj42rqWddvHQLLEU=; b=l5TtmK7dE+BcpP+OK1rEoAnnuGkZQ2CKyIZUQAAhx69/Nn5vAHYZUAh6NP9G0EtU39dU YGrbWjJaHCBYcZyPT8J8xldyQUQgpiafYVicXtroXXpmRL8DAudEVtvOM3bz6mgpMv28i /D3+QD4cHWFbDiKXu4QPCcCah+Htu/g2DWDy57J6TYfR74sS9iuaA8u1XYYdPcwxjuSYb tahAFvcEt5ZPM5MyRZFUqZWJ3dg0M1BDJ3Yt+mt+yyimlBmXMQDibdZDvVFUx6fvlgoJm i/gwXd2+eNzQ5DVV+0Cs+er283mC0JxLkiUtPmU4lDGwOuwLehVWOU0NkUIrlS772gQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=A1ZkAwFe; arc=none smtp.remote-ip=156.67.10.101 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A92D5606A31C; Sat, 28 Nov 2026 17:49:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A92D5606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=A1ZkAwFe DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=v0TZTafjXeE7cShJV5rlyuLnh47Gj42rqWddvHQLLEU=; b=A1ZkAwFe8Ha4fHjv8xXokHQvYO b0hJKaf/zkcXjffniKF7+G5VEbLVxAsRwQ+fyFLSSBis869Pe937i7BZwNq3Bc/0nxUNeMCq9hv82 fHDPVYmH20dxN4ar5eh8hwGw0C+htBT5Vus+nqsV/1UeEH49c307LeVCETfscjshQMV0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1xXMYB-00213P-M3; Sat, 28 Nov 2026 18:49:27 +0100 Date: Sat, 28 Nov 2026 18:49:27 +0100 From: Andrew Lunn To: Xin Tian Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jason Gunthorpe , Leon Romanovsky , Junxian Huang , weihg@yunsilicon.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, kerneljasonxing@gmail.com Subject: Re: [PATCH v2 07/11] net/xsc: add the ethernet netdev Message-ID: <8615f31b-57d6-4db5-b4aa-c6a421414231@lunn.ch> References: <20261126145711.70868-1-tianx@yunsilicon.com> <20261126145730.70868-8-tianx@yunsilicon.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261126145730.70868-8-tianx@yunsilicon.com> > +static void xsc_eth_build_nic_params(struct xsc_adapter *adapter) > +{ > + struct xsc_eth_params *params = &adapter->nic_param; > + > + params->mtu = SW_DEFAULT_MTU; > +} > +static int xsc_eth_set_hw_mtu(struct xsc_core_device *xdev, > + u16 mtu, u16 rx_buf_sz) > +{ > + struct xsc_set_mtu_mbox_out out; > + struct xsc_set_mtu_mbox_in in; > + int err; > + > + memset(&in, 0, sizeof(struct xsc_set_mtu_mbox_in)); > + memset(&out, 0, sizeof(struct xsc_set_mtu_mbox_out)); > + > + in.hdr.opcode = cpu_to_be16(XSC_CMD_OP_SET_MTU); > + in.mtu = cpu_to_be16(mtu); > + in.rx_buf_sz_min = cpu_to_be16(rx_buf_sz); > + in.mac_port = xdev->mac_port; > + > + err = xsc_cmd_exec(xdev, &in, sizeof(struct xsc_set_mtu_mbox_in), &out, > + sizeof(struct xsc_set_mtu_mbox_out)); > + if (err) { > + netdev_err(xsc_dev_to_netdev(xdev), > + "failed to set hw_mtu=%u rx_buf_sz=%u, err=%d, status=%d\n", > + mtu, rx_buf_sz, err, out.hdr.status); > + return err; > + } > + > + return 0; > +} > +static void xsc_eth_build_nic_netdev(struct xsc_adapter *adapter) > +{ > + struct net_device *netdev = adapter->netdev; > + > + netdev->netdev_ops = &xsc_netdev_ops; > + > + netdev->min_mtu = SW_DEFAULT_MTU; > + netdev->max_mtu = SW_DEFAULT_MTU; > + netdev->mtu = SW_DEFAULT_MTU; If the MTU is fixed, it seems pointless having xsc_eth_set_hw_mtu(). > +++ b/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth.h > @@ -0,0 +1,33 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* Copyright (C) 2021-2026, Shanghai Yunsilicon Technology Co., Ltd. > + * All rights reserved. > + */ > + > +#ifndef __XSC_ETH_H > +#define __XSC_ETH_H > + > +#include Why this header? How is UDP special? > +#define SW_DEFAULT_MTU ETH_DATA_LEN Please don't alias well known #defines. I know what ETH_DATA_LEN is, fixing the MTU to that makes sense. But i had not idea what SW_DEFAULT_MTU was until i got here. So you are just obfuscating the code. > +#define XSC_ETH_HW_MTU_SEND 9800 > +#define XSC_ETH_HARD_MTU (ETH_HLEN + VLAN_HLEN * 2 + ETH_FCS_LEN) The code would be a lot more readable if you used these in the actual code, rather than hide them here. I can see this and see you need space for the ethernet header, up to two VLAN headers and the trailing CRC. XSC_ETH_HARD_MTU tells me nothing. Andrew