/* * 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/vmalloc.h>#include <linux/slab.h>#include <linux/rtnetlink.h>#include <linux/sched.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);/* Handlers for each ethtool command */#define ETHTOOL_DEV_FEATURE_WORDS ((NETDEV_FEATURE_COUNT + 31) / 32)static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = {[NETIF_F_SG_BIT] ="tx-scatter-gather",[NETIF_F_IP_CSUM_BIT] ="tx-checksum-ipv4",[NETIF_F_HW_CSUM_BIT] =