[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231124170804.GU50352@kernel.org>
Date: Fri, 24 Nov 2023 17:08:04 +0000
From: Simon Horman <horms@...nel.org>
To: Shinas Rasheed <srasheed@...vell.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
hgani@...vell.com, vimleshk@...vell.com, egallen@...hat.com,
mschmidt@...hat.com, pabeni@...hat.com, kuba@...nel.org,
davem@...emloft.net, wizhao@...hat.com, konguyen@...hat.com,
jesse.brandeburg@...el.com, sumang@...vell.com,
Veerasenareddy Burru <vburru@...vell.com>,
Sathesh Edara <sedara@...vell.com>,
Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next v2 2/2] octeon_ep: get max rx packet length from
firmware
On Wed, Nov 22, 2023 at 10:34:35AM -0800, Shinas Rasheed wrote:
> Max receive packet length can vary across SoCs, so
> this needs to be queried from respective firmware and
> filled by driver. A control net get mtu api should be
> implemented to do the same.
>
> Signed-off-by: Shinas Rasheed <srasheed@...vell.com>
...
> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> index 2da00a701df2..423eec5ff3ad 100644
> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> @@ -1307,6 +1307,7 @@ static int octep_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> {
> struct octep_device *octep_dev = NULL;
> struct net_device *netdev;
> + int max_rx_pktlen;
> int err;
>
> err = pci_enable_device(pdev);
> @@ -1377,8 +1378,15 @@ static int octep_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>
> netdev->hw_features = NETIF_F_SG;
> netdev->features |= netdev->hw_features;
> +
> + max_rx_pktlen = octep_ctrl_net_get_mtu(octep_dev, OCTEP_CTRL_NET_INVALID_VFID);
> + if (max_rx_pktlen < 0) {
> + dev_err(&octep_dev->pdev->dev,
> + "Failed to get max receive packet size; err = %d\n", max_rx_pktlen);
> + goto register_dev_err;
Hi Shinas,
This jump will cause this function to return err. But err is 0 here.
Perhaps it should be set to a negative error value instead?
> + }
> netdev->min_mtu = OCTEP_MIN_MTU;
> - netdev->max_mtu = OCTEP_MAX_MTU;
> + netdev->max_mtu = max_rx_pktlen - (ETH_HLEN + ETH_FCS_LEN);
> netdev->mtu = OCTEP_DEFAULT_MTU;
>
> err = octep_ctrl_net_get_mac_addr(octep_dev, OCTEP_CTRL_NET_INVALID_VFID,
> --
> 2.25.1
>
Powered by blists - more mailing lists