From: Gal Pressman <gal@nvidia.com>
To: "Krzysztof Olędzki" <ole@ans.pl>,
"Ido Schimmel" <idosch@nvidia.com>,
"Tariq Toukan" <tariqt@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Saeed Mahameed" <saeedm@nvidia.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Yishai Hadas" <yishaih@nvidia.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next 1/4] mlx4/mlx5: {mlx4,mlx5e}_en_get_module_info cleanup
Date: Tue, 17 Sep 2024 10:04:37 +0300 [thread overview]
Message-ID: <33b89cd3-6e13-4ce9-9e80-60353980bc36@nvidia.com> (raw)
In-Reply-To: <1ad0402c-9c6a-44bc-9776-cb02c8e55a87@ans.pl>
On 17/09/2024 7:19, Krzysztof Olędzki wrote:
> On 16.09.2024 at 01:44, Gal Pressman wrote:
>> On 16/09/2024 10:30, Krzysztof Olędzki wrote:
>>> On 16.09.2024 at 00:16, Gal Pressman wrote:
>>>> Hi Krzysztof,
>>>
>>> Hi Gal,
>>>
>>> Thank you so much for your prompt review!
>>>
>>>> On 12/09/2024 9:38, Krzysztof Olędzki wrote:
>>>>> Use SFF8024 constants defined in linux/sfp.h instead of private ones.
>>>>>
>>>>> Make mlx4_en_get_module_info() and mlx5e_get_module_info() to look
>>>>> as close as possible to each other.
>>
>> mlx4 and mlx5 don't necessarily have to be similar to each other.
>
> Agreed, however it was not a random goal. My motivation was that since
> the functions are doing exactly the same thing, it would be beneficial
> for them to look the same, so if more changes are needed in the future,
> it should be easier to make them.
>
> Here is BTW the diff between them after all the changes:
>
> -static int mlx4_en_get_module_info(struct net_device *dev,
> - struct ethtool_modinfo *modinfo)
> +static int mlx5e_get_module_info(struct net_device *netdev,
> + struct ethtool_modinfo *modinfo)
> {
> - struct mlx4_en_priv *priv = netdev_priv(dev);
> - struct mlx4_en_dev *mdev = priv->mdev;
> + struct mlx5e_priv *priv = netdev_priv(netdev);
> + struct mlx5_core_dev *dev = priv->mdev;
> int ret;
> - u8 data[4];
> + u8 data[4] = {0};
>
> /* Read first 2 bytes to get Module & REV ID */
> - ret = mlx4_get_module_info(mdev->dev, priv->port,
> - 0 /*offset*/, 2 /*size*/, data);
> + ret = mlx5_query_module_eeprom(dev,
> + 0 /*offset*/, 2 /*size*/, data);
> if (ret < 2)
> return -EIO;
>
> @@ -2057,7 +1932,7 @@
> modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
> break;
> default:
> - netdev_err(dev, "%s: cable type not recognized: 0x%x\n",
> + netdev_err(priv->netdev, "%s: cable type not recognized: 0x%x\n",
> __func__, data[0]);
> return -EINVAL;
> }
> @@ -2065,113 +1940,715 @@
> return 0;
> }
>
>
The amount of diff lines is not a very interesting metric, I would drop
the changes that try to make both drivers look the same.
>>
>>>>> Simplify the logic for selecting SFF_8436 vs SFF_8636.
>>
>> This commit message reflects my main issue with this patch, patches
>> should be concise, this patch tries to achieve (at least) three
>> different things in one.
>
> Fair. So, what we really have here:
> 1. Use SFF8024 constants defined in linux/sfp.h instead of private ones.
> 2. Simplify the logic for selecting SFF_8436 vs SFF_8636
> 3. Improving coding style
> 4. Adding extra logging in mlx4_en_get_module_info(), which is also what mlx5e_get_module_info() does.
> 5. Make mlx4_en_get_module_info() and mlx5e_get_module_info() to look as close as possible to each other.
I would do 1+2 for both drivers, 3+4 for both drivers, and drop 5.
Thanks
prev parent reply other threads:[~2024-09-17 7:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 6:38 [PATCH net-next 1/4] mlx4/mlx5: {mlx4,mlx5e}_en_get_module_info cleanup Krzysztof Olędzki
2024-09-13 20:55 ` Jakub Kicinski
2024-09-14 2:12 ` Krzysztof Olędzki
2024-09-14 2:48 ` Jakub Kicinski
2024-09-14 8:21 ` Simon Horman
2024-09-15 2:21 ` Krzysztof Olędzki
2024-09-16 9:38 ` Przemek Kitszel
2024-09-16 7:16 ` Gal Pressman
2024-09-16 7:30 ` Krzysztof Olędzki
2024-09-16 8:44 ` Gal Pressman
2024-09-17 4:19 ` Krzysztof Olędzki
2024-09-17 7:04 ` Gal Pressman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=33b89cd3-6e13-4ce9-9e80-60353980bc36@nvidia.com \
--to=gal@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ole@ans.pl \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox