[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 3 Mar 2020 09:53:16 -0800
From: Jacob Keller <jacob.e.keller@...el.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, valex@...lanox.com, linyunsheng@...wei.com,
lihong.yang@...el.com, kuba@...nel.org
Subject: Re: [RFC PATCH v2 04/22] ice: enable initial devlink support
On 3/3/2020 5:47 AM, Jiri Pirko wrote:
> Mon, Mar 02, 2020 at 08:29:44PM CET, jacob.e.keller@...el.com wrote:
>>
>>
>> On 3/2/2020 8:30 AM, Jiri Pirko wrote:
>>> Sat, Feb 15, 2020 at 12:22:03AM CET, jacob.e.keller@...el.com wrote:
>>>
>>> [...]
>>>
>>>> +int ice_devlink_create_port(struct ice_pf *pf)
>>>> +{
>>>> + struct devlink *devlink = priv_to_devlink(pf);
>>>> + struct ice_vsi *vsi = ice_get_main_vsi(pf);
>>>> + struct device *dev = ice_pf_to_dev(pf);
>>>> + int err;
>>>> +
>>>> + if (!vsi) {
>>>> + dev_err(dev, "%s: unable to find main VSI\n", __func__);
>>>> + return -EIO;
>>>> + }
>>>> +
>>>> + devlink_port_attrs_set(&pf->devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
>>>> + pf->hw.pf_id, false, 0, NULL, 0);
>>>> + err = devlink_port_register(devlink, &pf->devlink_port, pf->hw.pf_id);
>>>> + if (err) {
>>>> + dev_err(dev, "devlink_port_register failed: %d\n", err);
>>>> + return err;
>>>> + }
>>>
>>> You need to register_netdev here. Otherwise you'll get inconsistent udev
>>> naming.
>>>
>>
>> The netdev is registered in other portion of the code, and should
>> already be registered by the time we call ice_devlink_create_port. This
>> check is mostly here to prevent a NULL pointer if the VSI somehow
>> doesn't have a netdev associated with it.
>
> My point is, the correct order is:
> devlink_register()
> devlink_port_attrs_set()
> devlink_port_register()
> register_netdev()
> devlink_port_type_eth_set()
>
Oh. Hmm. Ok, I'll need to move this around. Will fix.
Thanks,
Jake
Powered by blists - more mailing lists