On Mon, Apr 15, 2024 at 11:10:50AM +0200, Jiri Pirko wrote: > Mon, Apr 15, 2024 at 10:39:39AM CEST, michal.swiatkow...@linux.intel.com > wrote: > >On Fri, Apr 12, 2024 at 09:12:18AM +0200, Jiri Pirko wrote: > >> Fri, Apr 12, 2024 at 08:30:49AM CEST, michal.swiatkow...@linux.intel.com > >> wrote: > >> >From: Piotr Raczynski <piotr.raczyn...@intel.com> > > [...] > > >> >+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; > >> > >> Interesting. This means that you don't distinguish between admin state > >> and operational state. Meaning, when user does activate, you atomically > >> achive the hw attachment and it is ready to go before activation cmd > >> returns, correct? I'm just making sure I understand the code. > >> > > > >I am setting the dyn_port->active after the activation heppens, so it is > >true, when active is set it is ready to go. > > > >Do you mean that dyn_port->active should be set even before the activation is > >finished? I mean when user only call devlink to active the port? > > The devlink instance lock is taken the whole time, isn't it? >
I don't take PF devlink lock here. Only subfunction devlink lock is taken during the initialization of subfunction. > > > >> > >> >+ } else { > >> >+ *state = DEVLINK_PORT_FN_STATE_INACTIVE; > >> >+ *opstate = DEVLINK_PORT_FN_OPSTATE_DETACHED; > >> >+ } > >> >+ > >> >+ return 0; > >> >+} > >> >+ > > [...]