[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240515104916.GG154012@kernel.org>
Date: Wed, 15 May 2024 11:49:16 +0100
From: Simon Horman <horms@...nel.org>
To: Ronak Doshi <ronak.doshi@...adcom.com>
Cc: netdev@...r.kernel.org,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 4/4] vmxnet3: update to version 9
On Tue, May 14, 2024 at 11:20:49AM -0700, Ronak Doshi wrote:
> With all vmxnet3 version 9 changes incorporated in the vmxnet3 driver,
> the driver can configure emulation to run at vmxnet3 version 9, provided
> the emulation advertises support for version 9.
>
> Signed-off-by: Ronak Doshi <ronak.doshi@...adcom.com>
> Acked-by: Guolin Yang <guolin.yang@...adcom.com>
...
> @@ -4019,42 +4019,14 @@ vmxnet3_probe_device(struct pci_dev *pdev,
> goto err_alloc_pci;
>
> ver = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_VRRS);
> - if (ver & (1 << VMXNET3_REV_7)) {
> - VMXNET3_WRITE_BAR1_REG(adapter,
> - VMXNET3_REG_VRRS,
> - 1 << VMXNET3_REV_7);
> - adapter->version = VMXNET3_REV_7 + 1;
> - } else if (ver & (1 << VMXNET3_REV_6)) {
> - VMXNET3_WRITE_BAR1_REG(adapter,
> - VMXNET3_REG_VRRS,
> - 1 << VMXNET3_REV_6);
> - adapter->version = VMXNET3_REV_6 + 1;
> - } else if (ver & (1 << VMXNET3_REV_5)) {
> - VMXNET3_WRITE_BAR1_REG(adapter,
> - VMXNET3_REG_VRRS,
> - 1 << VMXNET3_REV_5);
> - adapter->version = VMXNET3_REV_5 + 1;
> - } else if (ver & (1 << VMXNET3_REV_4)) {
> - VMXNET3_WRITE_BAR1_REG(adapter,
> - VMXNET3_REG_VRRS,
> - 1 << VMXNET3_REV_4);
> - adapter->version = VMXNET3_REV_4 + 1;
> - } else if (ver & (1 << VMXNET3_REV_3)) {
> - VMXNET3_WRITE_BAR1_REG(adapter,
> - VMXNET3_REG_VRRS,
> - 1 << VMXNET3_REV_3);
> - adapter->version = VMXNET3_REV_3 + 1;
> - } else if (ver & (1 << VMXNET3_REV_2)) {
> - VMXNET3_WRITE_BAR1_REG(adapter,
> - VMXNET3_REG_VRRS,
> - 1 << VMXNET3_REV_2);
> - adapter->version = VMXNET3_REV_2 + 1;
> - } else if (ver & (1 << VMXNET3_REV_1)) {
> - VMXNET3_WRITE_BAR1_REG(adapter,
> - VMXNET3_REG_VRRS,
> - 1 << VMXNET3_REV_1);
> - adapter->version = VMXNET3_REV_1 + 1;
> - } else {
> + for (i = VMXNET3_REV_9; i >= VMXNET3_REV_1; i--) {
> + if (ver & (1 << i)) {
> + VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_VRRS, 1 << i);
nit: Please consider using the BIT() macro.
> + adapter->version = i + 1;
> + break;
> + }
> + }
> + if (i < VMXNET3_REV_1) {
> dev_err(&pdev->dev,
> "Incompatible h/w version (0x%x) for adapter\n", ver);
> err = -EBUSY;
Powered by blists - more mailing lists