• Vladimir Oltean's avatar
    net: mscc: ocelot: register devlink ports · 6c30384e
    Vladimir Oltean authored
    Add devlink integration into the mscc_ocelot switchdev driver. All
    physical ports (i.e. the unused ones as well) except the CPU port module
    at ocelot->num_phys_ports are registered with devlink, and that requires
    keeping the devlink_port structure outside struct ocelot_port_private,
    since the latter has a 1:1 mapping with a struct net_device (which does
    not exist for unused ports).
    
    Since we use devlink_port_type_eth_set to link the devlink port to the
    net_device, we can as well remove the .ndo_get_phys_port_name and
    .ndo_get_port_parent_id implementations, since devlink takes care of
    retrieving the port name and number automatically, once
    .ndo_get_devlink_port is implemented.
    
    Note that the felix DSA driver is already integrated with devlink by
    default, since that is a thing that the DSA core takes care of. This is
    the reason why these devlink stubs were put in ocelot_net.c and not in
    the common library. It is also the reason why ocelot::devlink is a
    pointer and not a full structure embedded inside struct ocelot: because
    the mscc_ocelot driver allocates that by itself (as the container of
    struct ocelot, in fact), but in the case of felix, it is DSA who
    allocates the devlink, and felix just propagates the pointer towards
    struct ocelot.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    6c30384e
ocelot.h 3.65 KB