[Intel-wired-lan] [PATCH net-next 14/15] idpf: add ethtool callbacks
Andrew Lunn
andrew at lunn.ch
Wed Mar 29 15:33:09 UTC 2023
> +static int idpf_get_link_ksettings(struct net_device *netdev,
> + struct ethtool_link_ksettings *cmd)
> +{
> + struct idpf_vport *vport = idpf_netdev_to_vport(netdev);
> +
> + if (!vport)
> + return -EINVAL;
> +
> + ethtool_link_ksettings_zero_link_mode(cmd, supported);
> + cmd->base.autoneg = AUTONEG_DISABLE;
> + cmd->base.port = PORT_NONE;
> + cmd->base.duplex = DUPLEX_FULL;
> + cmd->base.speed = vport->link_speed_mbps;
No supported modes, yet it has a duplex and a link speed?
> +static void idpf_recv_event_msg(struct idpf_vport *vport)
> +{
> + struct virtchnl2_event *v2e = NULL;
> + bool link_status;
> + u32 event;
> +
> + v2e = (struct virtchnl2_event *)vport->vc_msg;
> + event = le32_to_cpu(v2e->event);
> +
> + switch (event) {
> + case VIRTCHNL2_EVENT_LINK_CHANGE:
> + vport->link_speed_mbps = le32_to_cpu(v2e->link_speed);
> + link_status = v2e->link_status;
> +
> + if (vport->link_up == link_status)
> + break;
> +
> + vport->link_up = link_status;
> + if (vport->state == __IDPF_VPORT_UP) {
> + if (vport->link_up) {
> + netif_carrier_on(vport->netdev);
> + netif_tx_start_all_queues(vport->netdev);
> + } else {
> + netif_tx_stop_all_queues(vport->netdev);
> + netif_carrier_off(vport->netdev);
> + }
> + }
It has a link speed even when the carrier is off? This just makes me
think the link speed is bogus, and you would be better reporting
DUPLEX_UNKNOWN, SPEED_UNKNOWN. Or not even implementing ksettings,
since you don't have anything meaningful to report.
Andrew
More information about the Intel-wired-lan
mailing list