[Intel-wired-lan] [PATCH net-next 14/15] idpf: add ethtool callbacks

Linga, Pavan Kumar pavan.kumar.linga at intel.com
Thu Mar 30 22:05:36 UTC 2023



On 3/29/2023 9:03 PM, Andrew Lunn wrote:
>> +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?
> 

At present, the supported modes info is not provided by the device 
control plane but we do get the info on the 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

You are right. When the carrier is off, the link speed should be set to 
unknown. Will fix it.

Thanks,
Pavan


More information about the Intel-wired-lan mailing list