[dpdk-dev] [PATCH v3] kni: Add link status update

Zhang, Helin helin.zhang at intel.com
Tue Jun 16 09:33:37 CEST 2015



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Vijayakumar Muthuvel
> Manickam
> Sent: Tuesday, June 16, 2015 2:40 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v3] kni: Add link status update
> 
> Implement .ndo_change_carrier to enable
> DPDK applications to propagate link state changes to kni virtual interfaces
> through sysfs
> 
> Signed-off-by: Vijayakumar Muthuvel Manickam <mmvijay at gmail.com>
Acked-by: Helin Zhang <helin.zhang at intel.com>

> ---
> Added kernel version check as .ndo_change_carrier is available only in kernel
> versions 3.9 and after
> 
>  lib/librte_eal/linuxapp/kni/kni_net.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c
> b/lib/librte_eal/linuxapp/kni/kni_net.c
> index dd95db5..9f9022b 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_net.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_net.c
> @@ -632,6 +632,17 @@ static int kni_net_set_mac(struct net_device *netdev,
> void *p)
>  	return 0;
>  }
> 
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) static int
> +kni_net_change_carrier(struct net_device *dev, bool new_carrier) {
> +	if (new_carrier)
> +		netif_carrier_on(dev);
> +	else
> +		netif_carrier_off(dev);
> +	return 0;
> +}
> +#endif
> +
>  static const struct header_ops kni_net_header_ops = {
>  	.create  = kni_net_header,
>  	.rebuild = kni_net_rebuild_header,
> @@ -648,6 +659,9 @@ static const struct net_device_ops kni_net_netdev_ops =
> {
>  	.ndo_get_stats = kni_net_stats,
>  	.ndo_tx_timeout = kni_net_tx_timeout,
>  	.ndo_set_mac_address = kni_net_set_mac,
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0))
> +	.ndo_change_carrier = kni_net_change_carrier, #endif
>  };
> 
>  void
> --
> 1.8.1.4



More information about the dev mailing list