[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f5d2db9d-9992-4cb6-9ac2-456369df4366@nvidia.com>
Date: Thu, 18 Apr 2024 15:20:39 +0300
From: Shay Drori <shayd@...dia.com>
To: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
CC: <intel-wired-lan@...ts.osuosl.org>, <netdev@...r.kernel.org>,
<jacob.e.keller@...el.com>, <michal.kubiak@...el.com>,
<maciej.fijalkowski@...el.com>, <sridhar.samudrala@...el.com>,
<przemyslaw.kitszel@...el.com>, <wojciech.drewek@...el.com>,
<pio.raczynski@...il.com>, <jiri@...dia.com>, <mateusz.polchlopek@...el.com>
Subject: Re: [iwl-next v4 8/8] ice: allow to activate and deactivate
subfunction
On 18/04/2024 14:55, Michal Swiatkowski wrote:
> External email: Use caution opening links or attachments
>
>
> On Thu, Apr 18, 2024 at 11:12:47AM +0300, Shay Drori wrote:
>> resend as plain test
>>
>> On 18/04/2024 10:53, Shay Drori wrote:
>>> On 17/04/2024 17:20, Michal Swiatkowski wrote:
>>>> +/**
>>>> + * ice_devlink_port_fn_state_get - devlink handler for port state get
>>>> + * @port: pointer to devlink port
>>>> + * @state: admin configured state of the port
>>>> + * @opstate: current port operational state
>>>> + * @extack: extack for reporting error messages
>>>> + *
>>>> + * Gets port state.
>>>> + *
>>>> + * Return: zero on success or an error code on failure.
>>>> + */
>>>> +static int
>>>> +ice_devlink_port_fn_state_get(struct devlink_port *port,
>>>> + enum devlink_port_fn_state *state,
>>>> + enum devlink_port_fn_opstate *opstate,
>>>> + struct netlink_ext_ack *extack)
>>>> +{
>>>> + struct ice_dynamic_port *dyn_port;
>>>> +
>>>> + dyn_port = ice_devlink_port_to_dyn(port);
>>>> +
>>>> + if (dyn_port->active) {
>>>> + *state = DEVLINK_PORT_FN_STATE_ACTIVE;
>>>> + *opstate = DEVLINK_PORT_FN_OPSTATE_ATTACHED;
>>>
>>>
>>> DEVLINK_PORT_FN_OPSTATE_ATTACHED means the SF is up/bind[1].
>>> ice is using auxiliary bus for SFs, which means user can unbind it
>>> via the auxiliary sysfs (/sys/bus/auxiliary/drivers/ice_sf/unbind).
>>> In this case[2], you need to return:
>>> *state = DEVLINK_PORT_FN_STATE_ACTIVE;
>>> *opstate = DEVLINK_PORT_FN_OPSTATE_DETACHED;
>>>
>
> Thanks, I didn't think about unbinding/binding the aux driver via sysfs. >
> To be sure:
> - user create the subfunction:
> INACTIVE, DETACHED
> - user activate it:
> ACTIVE, ATTACHED
> - user unbind driver:
> ACTIVE, DETACHED
> - user can bind it again as long as subfunction port is ACTIVE
> is it right?
yes.
>
> I will fix the comment from previous patch and add state tracking for
> ATTACHED/DETACHED.
>
> Thanks,
> Michal
>
>>>
>>> [1]
>>> Documentation from include/uapi/linux/devlink.h:
>>>
>>> * @DEVLINK_PORT_FN_OPSTATE_ATTACHED: Driver is attached to the function.
>>> <...>
>>> * @DEVLINK_PORT_FN_OPSTATE_DETACHED: Driver is detached from the function.
>>>
>>>> + } else {
>>>> + *state = DEVLINK_PORT_FN_STATE_INACTIVE;
>>>> + *opstate = DEVLINK_PORT_FN_OPSTATE_DETACHED;
>>>> + }
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
Powered by blists - more mailing lists