On Mon, 18 Jan 2021 12:12:20 -0800 Saeed Mahameed wrote:
> From: Parav Pandit <[email protected]>
Saeed, this is closed to being merged - when you post the next version
please make sure to CC appropriate folks, in particular anyone who ever
commented on previous versions. Alex, DSA, Edwin, at a quick look but
maybe more.
> @@ -1362,6 +1373,33 @@ struct devlink_ops {
> int (*port_function_hw_addr_set)(struct devlink *devlink, struct
> devlink_port *port,
> const u8 *hw_addr, int hw_addr_len,
> struct netlink_ext_ack *extack);
> + /**
> + * @port_new: Port add function.
> + *
> + * Should be used by device driver to let caller add new port of a
> + * specified flavour with optional attributes.
I think you missed my suggestion from v5, please replace this sentence
with:
Add a new port of a specified flavor with optional attributes.
Saying that the callback is used by the callee doesn't sound right.
Same below, and also in patch 4.
> + * Driver must return -EOPNOTSUPP if it doesn't support port addition
> + * of a specified flavour or specified attributes. Driver should set
> + * extack error message in case of failure. Driver callback is called
> + * without holding the devlink instance lock. Driver must ensure
> + * synchronization when adding or deleting a port. Driver must register
> + * a port with devlink core.
> + */
> + int (*port_new)(struct devlink *devlink,
> + const struct devlink_port_new_attrs *attrs,
> + struct netlink_ext_ack *extack,
> + unsigned int *new_port_index);
> + /**
> + * @port_del: Port delete function.
> + *
> + * Should be used by device driver to let caller delete port which was
> + * previously created using port_new() callback.
ditto
> + * Driver must return -EOPNOTSUPP if it doesn't support port deletion.
> + * Driver should set extack error message in case of failure. Driver
> + * callback is called without holding the devlink instance lock.
> + */
> + int (*port_del)(struct devlink *devlink, unsigned int port_index,
> + struct netlink_ext_ack *extack);
> };