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.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
16d07c38c4
@ -828,10 +828,10 @@ struct mlxsw_sp_ptp_state *mlxsw_sp1_ptp_init(struct mlxsw_sp *mlxsw_sp)
|
||||
goto err_hashtable_init;
|
||||
|
||||
/* Delive these message types as PTP0. */
|
||||
message_type = BIT(MLXSW_SP_PTP_MESSAGE_TYPE_SYNC) |
|
||||
BIT(MLXSW_SP_PTP_MESSAGE_TYPE_DELAY_REQ) |
|
||||
BIT(MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_REQ) |
|
||||
BIT(MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_RESP);
|
||||
message_type = BIT(PTP_MSGTYPE_SYNC) |
|
||||
BIT(PTP_MSGTYPE_DELAY_REQ) |
|
||||
BIT(PTP_MSGTYPE_PDELAY_REQ) |
|
||||
BIT(PTP_MSGTYPE_PDELAY_RESP);
|
||||
err = mlxsw_sp_ptp_mtptpt_set(mlxsw_sp, MLXSW_REG_MTPTPT_TRAP_ID_PTP0,
|
||||
message_type);
|
||||
if (err)
|
||||
|
@ -11,13 +11,6 @@ struct mlxsw_sp;
|
||||
struct mlxsw_sp_port;
|
||||
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)
|
||||
{
|
||||
info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
|
||||
|
@ -972,15 +972,12 @@ static void decode_status_frame(struct dp83640_private *dp83640,
|
||||
static int is_sync(struct sk_buff *skb, int type)
|
||||
{
|
||||
struct ptp_header *hdr;
|
||||
u8 msgtype;
|
||||
|
||||
hdr = ptp_parse_header(skb, type);
|
||||
if (!hdr)
|
||||
return 0;
|
||||
|
||||
msgtype = ptp_get_msgtype(hdr, type);
|
||||
|
||||
return (msgtype & 0xf) == 0;
|
||||
return ptp_get_msgtype(hdr, type) == PTP_MSGTYPE_SYNC;
|
||||
}
|
||||
|
||||
static void dp83640_free_clocks(void)
|
||||
|
@ -506,9 +506,9 @@ static int vsc85xx_ptp_cmp_init(struct phy_device *phydev, enum ts_blk blk)
|
||||
{
|
||||
struct vsc8531_private *vsc8531 = phydev->priv;
|
||||
bool base = phydev->mdio.addr == vsc8531->ts_base_addr;
|
||||
enum vsc85xx_ptp_msg_type msgs[] = {
|
||||
PTP_MSG_TYPE_SYNC,
|
||||
PTP_MSG_TYPE_DELAY_REQ
|
||||
u8 msgs[] = {
|
||||
PTP_MSGTYPE_SYNC,
|
||||
PTP_MSGTYPE_DELAY_REQ
|
||||
};
|
||||
u32 val;
|
||||
u8 i;
|
||||
@ -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,
|
||||
bool one_step, bool enable)
|
||||
{
|
||||
enum vsc85xx_ptp_msg_type msgs[] = {
|
||||
PTP_MSG_TYPE_SYNC,
|
||||
PTP_MSG_TYPE_DELAY_REQ
|
||||
u8 msgs[] = {
|
||||
PTP_MSGTYPE_SYNC,
|
||||
PTP_MSGTYPE_DELAY_REQ
|
||||
};
|
||||
u32 val;
|
||||
u8 i;
|
||||
@ -858,7 +858,7 @@ static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
|
||||
if (blk == INGRESS)
|
||||
vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
|
||||
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 */
|
||||
vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
|
||||
PTP_WRITE_1588);
|
||||
|
@ -436,11 +436,6 @@ enum ptp_cmd {
|
||||
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 {
|
||||
u8 tsmt; /* transportSpecific | messageType */
|
||||
u8 ver; /* reserved0 | versionPTP */
|
||||
|
Loading…
x
Reference in New Issue
Block a user