net: ethtool: Add a command to expose current time stamping layer

Time stamping on network packets may happen either in the MAC or in
the PHY, but not both.  In preparation for making the choice
selectable, expose both the current layers via ethtool.

In accordance with the kernel implementation as it stands, the current
layer will always read as "phy" when a PHY time stamping device is
present. Future patches will allow changing the current layer
administratively.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Kory Maincent
2023-11-14 12:28:36 +01:00
committed by David S. Miller
parent acec05fb78
commit 11d55be06d
8 changed files with 149 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ enum {
ETHTOOL_MSG_PLCA_GET_STATUS,
ETHTOOL_MSG_MM_GET,
ETHTOOL_MSG_MM_SET,
ETHTOOL_MSG_TS_GET,
/* add new constants above here */
__ETHTOOL_MSG_USER_CNT,
@@ -109,6 +110,7 @@ enum {
ETHTOOL_MSG_PLCA_NTF,
ETHTOOL_MSG_MM_GET_REPLY,
ETHTOOL_MSG_MM_NTF,
ETHTOOL_MSG_TS_GET_REPLY,
/* add new constants above here */
__ETHTOOL_MSG_KERNEL_CNT,
@@ -975,6 +977,18 @@ enum {
ETHTOOL_A_MM_MAX = (__ETHTOOL_A_MM_CNT - 1)
};
/* TS LAYER */
enum {
ETHTOOL_A_TS_UNSPEC,
ETHTOOL_A_TS_HEADER, /* nest - _A_HEADER_* */
ETHTOOL_A_TS_LAYER, /* u32 */
/* add new constants above here */
__ETHTOOL_A_TS_CNT,
ETHTOOL_A_TS_MAX = (__ETHTOOL_A_TS_CNT - 1)
};
/* generic netlink info */
#define ETHTOOL_GENL_NAME "ethtool"
#define ETHTOOL_GENL_VERSION 1

View File

@@ -13,6 +13,16 @@
#include <linux/types.h>
#include <linux/socket.h> /* for SO_TIMESTAMPING */
/* Layer of the TIMESTAMPING provider */
enum timestamping_layer {
NO_TIMESTAMPING,
SOFTWARE_TIMESTAMPING,
MAC_TIMESTAMPING,
PHY_TIMESTAMPING,
__TIMESTAMPING_COUNT,
};
/* SO_TIMESTAMPING flags */
enum {
SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),