Commit 16d07c38 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'net-ptp-use-common-defines-for-ptp-message-types-in-further-drivers'

Christian Eggers says:

====================
net: ptp: use common defines for PTP message types in further drivers

This series replaces further driver internal enumeration / uses of magic
numbers with the newly introduced PTP_MSGTYPE_* defines.
====================

Link: https://lore.kernel.org/r/20201124074418.2609-1-ceggers@arri.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 06254738 29872216
...@@ -828,10 +828,10 @@ struct mlxsw_sp_ptp_state *mlxsw_sp1_ptp_init(struct mlxsw_sp *mlxsw_sp) ...@@ -828,10 +828,10 @@ struct mlxsw_sp_ptp_state *mlxsw_sp1_ptp_init(struct mlxsw_sp *mlxsw_sp)
goto err_hashtable_init; goto err_hashtable_init;
/* Delive these message types as PTP0. */ /* Delive these message types as PTP0. */
message_type = BIT(MLXSW_SP_PTP_MESSAGE_TYPE_SYNC) | message_type = BIT(PTP_MSGTYPE_SYNC) |
BIT(MLXSW_SP_PTP_MESSAGE_TYPE_DELAY_REQ) | BIT(PTP_MSGTYPE_DELAY_REQ) |
BIT(MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_REQ) | BIT(PTP_MSGTYPE_PDELAY_REQ) |
BIT(MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_RESP); BIT(PTP_MSGTYPE_PDELAY_RESP);
err = mlxsw_sp_ptp_mtptpt_set(mlxsw_sp, MLXSW_REG_MTPTPT_TRAP_ID_PTP0, err = mlxsw_sp_ptp_mtptpt_set(mlxsw_sp, MLXSW_REG_MTPTPT_TRAP_ID_PTP0,
message_type); message_type);
if (err) if (err)
......
...@@ -11,13 +11,6 @@ struct mlxsw_sp; ...@@ -11,13 +11,6 @@ struct mlxsw_sp;
struct mlxsw_sp_port; struct mlxsw_sp_port;
struct mlxsw_sp_ptp_clock; struct mlxsw_sp_ptp_clock;
enum {
MLXSW_SP_PTP_MESSAGE_TYPE_SYNC,
MLXSW_SP_PTP_MESSAGE_TYPE_DELAY_REQ,
MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_REQ,
MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_RESP,
};
static inline int mlxsw_sp_ptp_get_ts_info_noptp(struct ethtool_ts_info *info) static inline int mlxsw_sp_ptp_get_ts_info_noptp(struct ethtool_ts_info *info)
{ {
info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE | info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
......
...@@ -972,15 +972,12 @@ static void decode_status_frame(struct dp83640_private *dp83640, ...@@ -972,15 +972,12 @@ static void decode_status_frame(struct dp83640_private *dp83640,
static int is_sync(struct sk_buff *skb, int type) static int is_sync(struct sk_buff *skb, int type)
{ {
struct ptp_header *hdr; struct ptp_header *hdr;
u8 msgtype;
hdr = ptp_parse_header(skb, type); hdr = ptp_parse_header(skb, type);
if (!hdr) if (!hdr)
return 0; return 0;
msgtype = ptp_get_msgtype(hdr, type); return ptp_get_msgtype(hdr, type) == PTP_MSGTYPE_SYNC;
return (msgtype & 0xf) == 0;
} }
static void dp83640_free_clocks(void) static void dp83640_free_clocks(void)
......
...@@ -506,9 +506,9 @@ static int vsc85xx_ptp_cmp_init(struct phy_device *phydev, enum ts_blk blk) ...@@ -506,9 +506,9 @@ static int vsc85xx_ptp_cmp_init(struct phy_device *phydev, enum ts_blk blk)
{ {
struct vsc8531_private *vsc8531 = phydev->priv; struct vsc8531_private *vsc8531 = phydev->priv;
bool base = phydev->mdio.addr == vsc8531->ts_base_addr; bool base = phydev->mdio.addr == vsc8531->ts_base_addr;
enum vsc85xx_ptp_msg_type msgs[] = { u8 msgs[] = {
PTP_MSG_TYPE_SYNC, PTP_MSGTYPE_SYNC,
PTP_MSG_TYPE_DELAY_REQ PTP_MSGTYPE_DELAY_REQ
}; };
u32 val; u32 val;
u8 i; u8 i;
...@@ -847,9 +847,9 @@ static int vsc85xx_ts_ptp_action_flow(struct phy_device *phydev, enum ts_blk blk ...@@ -847,9 +847,9 @@ static int vsc85xx_ts_ptp_action_flow(struct phy_device *phydev, enum ts_blk blk
static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk, static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
bool one_step, bool enable) bool one_step, bool enable)
{ {
enum vsc85xx_ptp_msg_type msgs[] = { u8 msgs[] = {
PTP_MSG_TYPE_SYNC, PTP_MSGTYPE_SYNC,
PTP_MSG_TYPE_DELAY_REQ PTP_MSGTYPE_DELAY_REQ
}; };
u32 val; u32 val;
u8 i; u8 i;
...@@ -858,7 +858,7 @@ static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk, ...@@ -858,7 +858,7 @@ static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
if (blk == INGRESS) if (blk == INGRESS)
vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i], vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
PTP_WRITE_NS); PTP_WRITE_NS);
else if (msgs[i] == PTP_MSG_TYPE_SYNC && one_step) else if (msgs[i] == PTP_MSGTYPE_SYNC && one_step)
/* no need to know Sync t when sending in one_step */ /* no need to know Sync t when sending in one_step */
vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i], vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
PTP_WRITE_1588); PTP_WRITE_1588);
......
...@@ -436,11 +436,6 @@ enum ptp_cmd { ...@@ -436,11 +436,6 @@ enum ptp_cmd {
PTP_SAVE_IN_TS_FIFO = 11, /* invalid when writing in reg */ PTP_SAVE_IN_TS_FIFO = 11, /* invalid when writing in reg */
}; };
enum vsc85xx_ptp_msg_type {
PTP_MSG_TYPE_SYNC,
PTP_MSG_TYPE_DELAY_REQ,
};
struct vsc85xx_ptphdr { struct vsc85xx_ptphdr {
u8 tsmt; /* transportSpecific | messageType */ u8 tsmt; /* transportSpecific | messageType */
u8 ver; /* reserved0 | versionPTP */ u8 ver; /* reserved0 | versionPTP */
......
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