Commit 86635435 authored by Jeff Garzik's avatar Jeff Garzik

Merge redhat.com:/garz/repo/linus-2.6

into redhat.com:/garz/repo/ethtool-2.6
parents 03e4e085 5db6f5c4
This diff is collapsed.
...@@ -97,7 +97,7 @@ struct ethtool_coalesce { ...@@ -97,7 +97,7 @@ struct ethtool_coalesce {
u32 rx_max_coalesced_frames; u32 rx_max_coalesced_frames;
/* Same as above two parameters, except that these values /* Same as above two parameters, except that these values
* apply while an IRQ is being services by the host. Not * apply while an IRQ is being serviced by the host. Not
* all cards support this feature and the values are ignored * all cards support this feature and the values are ignored
* in that case. * in that case.
*/ */
...@@ -119,7 +119,7 @@ struct ethtool_coalesce { ...@@ -119,7 +119,7 @@ struct ethtool_coalesce {
u32 tx_max_coalesced_frames; u32 tx_max_coalesced_frames;
/* Same as above two parameters, except that these values /* Same as above two parameters, except that these values
* apply while an IRQ is being services by the host. Not * apply while an IRQ is being serviced by the host. Not
* all cards support this feature and the values are ignored * all cards support this feature and the values are ignored
* in that case. * in that case.
*/ */
...@@ -250,6 +250,101 @@ struct ethtool_stats { ...@@ -250,6 +250,101 @@ struct ethtool_stats {
u64 data[0]; u64 data[0];
}; };
struct net_device;
/* Some generic methods drivers may use in their ethtool_ops */
u32 ethtool_op_get_link(struct net_device *dev);
u32 ethtool_op_get_tx_csum(struct net_device *dev);
u32 ethtool_op_get_sg(struct net_device *dev);
int ethtool_op_set_sg(struct net_device *dev, u32 data);
/**
* &ethtool_ops - Alter and report network device settings
* get_settings: Get device-specific settings
* set_settings: Set device-specific settings
* get_drvinfo: Report driver information
* get_regs: Get device registers
* get_wol: Report whether Wake-on-Lan is enabled
* set_wol: Turn Wake-on-Lan on or off
* get_msglevel: Report driver message level
* set_msglevel: Set driver message level
* nway_reset: Restart autonegotiation
* get_link: Get link status
* get_eeprom: Read data from the device EEPROM
* set_eeprom: Write data to the device EEPROM
* get_coalesce: Get interrupt coalescing parameters
* set_coalesce: Set interrupt coalescing parameters
* get_ringparam: Report ring sizes
* set_ringparam: Set ring sizes
* get_pauseparam: Report pause parameters
* set_pauseparam: Set pause paramters
* get_rx_csum: Report whether receive checksums are turned on or off
* set_rx_csum: Turn receive checksum on or off
* get_tx_csum: Report whether transmit checksums are turned on or off
* set_tx_csum: Turn transmit checksums on or off
* get_sg: Report whether scatter-gather is enabled
* set_sg: Turn scatter-gather on or off
* self_test: Run specified self-tests
* get_strings: Return a set of strings that describe the requested objects
* phys_id: Identify the device
* get_stats: Return statistics about the device
*
* Description:
*
* get_settings:
* @get_settings is passed an &ethtool_cmd to fill in. It returns
* an negative errno or zero.
*
* set_settings:
* @set_settings is passed an &ethtool_cmd and should attempt to set
* all the settings this device supports. It may return an error value
* if something goes wrong (otherwise 0).
*
* get_eeprom:
* Should fill in the magic field. Don't need to check len for zero
* or wraparound but must check offset + len < size. Fill in the data
* argument with the eeprom values from offset to offset + len. Update
* len to the amount read. Returns an error or zero.
*
* set_eeprom:
* Should validate the magic field. Don't need to check len for zero
* or wraparound but must check offset + len < size. Update len to
* the amount written. Returns an error or zero.
*/
struct ethtool_ops {
int (*get_settings)(struct net_device *, struct ethtool_cmd *);
int (*set_settings)(struct net_device *, struct ethtool_cmd *);
void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
int (*get_regs_len)(struct net_device *);
void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
u32 (*get_msglevel)(struct net_device *);
void (*set_msglevel)(struct net_device *, u32);
int (*nway_reset)(struct net_device *);
u32 (*get_link)(struct net_device *);
int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
u32 (*get_rx_csum)(struct net_device *);
int (*set_rx_csum)(struct net_device *, u32);
u32 (*get_tx_csum)(struct net_device *);
int (*set_tx_csum)(struct net_device *, u32);
u32 (*get_sg)(struct net_device *);
int (*set_sg)(struct net_device *, u32);
int (*self_test_count)(struct net_device *);
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
void (*get_strings)(struct net_device *, u32 stringset, u8 *);
int (*phys_id)(struct net_device *, u32);
int (*get_stats_count)(struct net_device *);
void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
};
/* CMDs currently supported */ /* CMDs currently supported */
#define ETHTOOL_GSET 0x00000001 /* Get settings. */ #define ETHTOOL_GSET 0x00000001 /* Get settings. */
#define ETHTOOL_SSET 0x00000002 /* Set settings. */ #define ETHTOOL_SSET 0x00000002 /* Set settings. */
......
...@@ -43,6 +43,11 @@ ...@@ -43,6 +43,11 @@
struct divert_blk; struct divert_blk;
struct vlan_group; struct vlan_group;
struct ethtool_ops;
/* source back-compat hook */
#define SET_ETHTOOL_OPS(netdev,ops) \
( (netdev)->ethtool_ops = (ops) )
#define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev #define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev
functions are available. */ functions are available. */
...@@ -300,6 +305,8 @@ struct net_device ...@@ -300,6 +305,8 @@ struct net_device
* See <net/iw_handler.h> for details. Jean II */ * See <net/iw_handler.h> for details. Jean II */
struct iw_handler_def * wireless_handlers; struct iw_handler_def * wireless_handlers;
struct ethtool_ops *ethtool_ops;
/* /*
* This marks the end of the "visible" part of the structure. All * This marks the end of the "visible" part of the structure. All
* fields hereafter are internal to the system, and may change at * fields hereafter are internal to the system, and may change at
...@@ -482,7 +489,6 @@ struct packet_type ...@@ -482,7 +489,6 @@ struct packet_type
struct list_head list; struct list_head list;
}; };
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/notifier.h> #include <linux/notifier.h>
...@@ -630,6 +636,7 @@ extern int netif_rx(struct sk_buff *skb); ...@@ -630,6 +636,7 @@ extern int netif_rx(struct sk_buff *skb);
#define HAVE_NETIF_RECEIVE_SKB 1 #define HAVE_NETIF_RECEIVE_SKB 1
extern int netif_receive_skb(struct sk_buff *skb); extern int netif_receive_skb(struct sk_buff *skb);
extern int dev_ioctl(unsigned int cmd, void *); extern int dev_ioctl(unsigned int cmd, void *);
extern int dev_ethtool(struct ifreq *);
extern unsigned dev_get_flags(const struct net_device *); extern unsigned dev_get_flags(const struct net_device *);
extern int dev_change_flags(struct net_device *, unsigned); extern int dev_change_flags(struct net_device *, unsigned);
extern int dev_set_mtu(struct net_device *, int); extern int dev_set_mtu(struct net_device *, int);
......
...@@ -6,8 +6,8 @@ obj-y := sock.o skbuff.o iovec.o datagram.o scm.o ...@@ -6,8 +6,8 @@ obj-y := sock.o skbuff.o iovec.o datagram.o scm.o
obj-$(CONFIG_SYSCTL) += sysctl_net_core.o obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
obj-y += flow.o dev.o net-sysfs.o dev_mcast.o dst.o neighbour.o \ obj-y += flow.o dev.o ethtool.o net-sysfs.o dev_mcast.o dst.o \
rtnetlink.o utils.o link_watch.o filter.o neighbour.o rtnetlink.o utils.o link_watch.o filter.o
obj-$(CONFIG_NETFILTER) += netfilter.o obj-$(CONFIG_NETFILTER) += netfilter.o
obj-$(CONFIG_NET_DIVERT) += dv.o obj-$(CONFIG_NET_DIVERT) += dv.o
......
...@@ -2368,7 +2368,6 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd) ...@@ -2368,7 +2368,6 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
cmd == SIOCBONDSLAVEINFOQUERY || cmd == SIOCBONDSLAVEINFOQUERY ||
cmd == SIOCBONDINFOQUERY || cmd == SIOCBONDINFOQUERY ||
cmd == SIOCBONDCHANGEACTIVE || cmd == SIOCBONDCHANGEACTIVE ||
cmd == SIOCETHTOOL ||
cmd == SIOCGMIIPHY || cmd == SIOCGMIIPHY ||
cmd == SIOCGMIIREG || cmd == SIOCGMIIREG ||
cmd == SIOCSMIIREG || cmd == SIOCSMIIREG ||
...@@ -2465,13 +2464,26 @@ int dev_ioctl(unsigned int cmd, void *arg) ...@@ -2465,13 +2464,26 @@ int dev_ioctl(unsigned int cmd, void *arg)
} }
return ret; return ret;
case SIOCETHTOOL:
dev_load(ifr.ifr_name);
rtnl_lock();
ret = dev_ethtool(&ifr);
rtnl_unlock();
if (!ret) {
if (colon)
*colon = ':';
if (copy_to_user(arg, &ifr,
sizeof(struct ifreq)))
ret = -EFAULT;
}
return ret;
/* /*
* These ioctl calls: * These ioctl calls:
* - require superuser power. * - require superuser power.
* - require strict serialization. * - require strict serialization.
* - return a value * - return a value
*/ */
case SIOCETHTOOL:
case SIOCGMIIPHY: case SIOCGMIIPHY:
case SIOCGMIIREG: case SIOCGMIIREG:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment