/* * net/core/ethtool.c - Ethtool ioctl handler * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx> * * This file is where we call all the ethtool_ops commands to get * the information ethtool needs. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */#include <linux/module.h>#include <linux/types.h>#include <linux/capability.h>#include <linux/errno.h>#include <linux/ethtool.h>#include <linux/netdevice.h>#include <linux/bitops.h>#include <linux/uaccess.h>#include <linux/slab.h>/* * Some useful ethtool_ops methods that're device independent. * If we find that all drivers want to do the same thing here, * we can turn these into dev_() function calls. */
u32 ethtool_op_get_link(struct net_device *dev){returnnetif_carrier_ok(dev) ?1:0;}EXPORT_SYMBOL(ethtool_op_get_link);
u32 ethtool_op_get_rx_csum(struct net_device *dev){return(dev->features & NETIF_F_ALL_CSUM) !=0;}EXPORT_SYMBOL(ethtool_op_get_rx_csum);
u32 ethtool_op_get_tx_csum(struct net_device *dev){return(dev->features & NETIF_F_ALL_CSUM) !=0;}EXPORT_SYMBOL(ethtool_op_get_tx_csum);intethtool_op_set_tx_csum(struct net_device *dev, u32 data){if(data)
dev