ethtool: Add a common function for drivers with transmit time stamping.
[deliverable/linux.git] / include / linux / ethtool.h
index da5b2de99ae450a1239cfb3cf6f24d7e71fc9b4c..560a247bde2a219237c0076b8f6d33323de806a2 100644 (file)
@@ -30,10 +30,15 @@ struct ethtool_cmd {
                                 * access it */
        __u8    duplex;         /* Duplex, half or full */
        __u8    port;           /* Which connector port */
-       __u8    phy_address;
+       __u8    phy_address;    /* MDIO PHY address (PRTAD for clause 45).
+                                * May be read-only or read-write
+                                * depending on the driver.
+                                */
        __u8    transceiver;    /* Which transceiver to use */
        __u8    autoneg;        /* Enable or disable autonegotiation */
-       __u8    mdio_support;
+       __u8    mdio_support;   /* MDIO protocols supported.  Read-only.
+                                * Not set by all drivers.
+                                */
        __u32   maxtxpkt;       /* Tx pkts before generating tx int */
        __u32   maxrxpkt;       /* Rx pkts before generating rx int */
        __u16   speed_hi;       /* The forced speed (upper
@@ -59,6 +64,20 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
        return (ep->speed_hi << 16) | ep->speed;
 }
 
+/* Device supports clause 22 register access to PHY or peripherals
+ * using the interface defined in <linux/mii.h>.  This should not be
+ * set if there are known to be no such peripherals present or if
+ * the driver only emulates clause 22 registers for compatibility.
+ */
+#define ETH_MDIO_SUPPORTS_C22  1
+
+/* Device supports clause 45 register access to PHY or peripherals
+ * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
+ * This should not be set if there are known to be no such peripherals
+ * present.
+ */
+#define ETH_MDIO_SUPPORTS_C45  2
+
 #define ETHTOOL_FWVERS_LEN     32
 #define ETHTOOL_BUSINFO_LEN    32
 /* these strings are set to whatever the driver author decides... */
@@ -707,6 +726,29 @@ struct ethtool_sfeatures {
        struct ethtool_set_features_block features[0];
 };
 
+/**
+ * struct ethtool_ts_info - holds a device's timestamping and PHC association
+ * @cmd: command number = %ETHTOOL_GET_TS_INFO
+ * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
+ * @phc_index: device index of the associated PHC, or -1 if there is none
+ * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
+ * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
+ *
+ * The bits in the 'tx_types' and 'rx_filters' fields correspond to
+ * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
+ * respectively.  For example, if the device supports HWTSTAMP_TX_ON,
+ * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
+ */
+struct ethtool_ts_info {
+       __u32   cmd;
+       __u32   so_timestamping;
+       __s32   phc_index;
+       __u32   tx_types;
+       __u32   tx_reserved[3];
+       __u32   rx_filters;
+       __u32   rx_reserved[3];
+};
+
 /*
  * %ETHTOOL_SFEATURES changes features present in features[].valid to the
  * values of corresponding bits in features[].requested. Bits in .requested
@@ -769,6 +811,7 @@ struct net_device;
 
 /* Some generic methods drivers may use in their ethtool_ops */
 u32 ethtool_op_get_link(struct net_device *dev);
+int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti);
 
 /**
  * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
@@ -874,6 +917,9 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
  *                and flag of the device.
  * @get_dump_data: Get dump data.
  * @set_dump: Set dump specific flags to the device.
+ * @get_ts_info: Get the time stamping and PTP hardware clock capabilities.
+ *     Drivers supporting transmit time stamps in software should set this to
+ *     ethtool_op_get_ts_info().
  *
  * All operations are optional (i.e. the function pointer may be set
  * to %NULL) and callers must take this into account.  Callers must
@@ -936,6 +982,7 @@ struct ethtool_ops {
        int     (*get_dump_data)(struct net_device *,
                                 struct ethtool_dump *, void *);
        int     (*set_dump)(struct net_device *, struct ethtool_dump *);
+       int     (*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
 
 };
 #endif /* __KERNEL__ */
@@ -1010,6 +1057,7 @@ struct ethtool_ops {
 #define ETHTOOL_SET_DUMP       0x0000003e /* Set dump settings */
 #define ETHTOOL_GET_DUMP_FLAG  0x0000003f /* Get dump settings */
 #define ETHTOOL_GET_DUMP_DATA  0x00000040 /* Get dump data */
+#define ETHTOOL_GET_TS_INFO    0x00000041 /* Get time stamping and PHC info */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET         ETHTOOL_GSET
This page took 0.039559 seconds and 5 git commands to generate.