Commit a9373c90 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Adam Wujek

simplify __send_and_log

Some arguments are not needed any more. Removed.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent faa87f7a
...@@ -291,5 +291,5 @@ int msg_issue_wrsig(struct pp_instance *ppi, Enumeration16 wr_msg_id) ...@@ -291,5 +291,5 @@ int msg_issue_wrsig(struct pp_instance *ppi, Enumeration16 wr_msg_id)
{ {
int len = msg_pack_wrsig(ppi, wr_msg_id); int len = msg_pack_wrsig(ppi, wr_msg_id);
return __send_and_log(ppi, len, PPM_SIGNALING, PP_NP_GEN); return __send_and_log(ppi, len, PP_NP_GEN);
} }
...@@ -392,9 +392,10 @@ int st_com_master_handle_sync(struct pp_instance *ppi, unsigned char *buf, ...@@ -392,9 +392,10 @@ int st_com_master_handle_sync(struct pp_instance *ppi, unsigned char *buf,
return 0; return 0;
} }
int __send_and_log(struct pp_instance *ppi, int msglen, int __send_and_log(struct pp_instance *ppi, int msglen, int chtype)
int msgtype, int chtype)
{ {
int msgtype = ((char *)ppi->tx_ptp)[0] & 0xf;
if (ppi->n_ops->send(ppi, ppi->tx_frame, msglen + ppi->tx_offset, if (ppi->n_ops->send(ppi, ppi->tx_frame, msglen + ppi->tx_offset,
msgtype) < msglen) { msgtype) < msglen) {
pp_diag(ppi, frames, 1, "%s(%d) Message can't be sent\n", pp_diag(ppi, frames, 1, "%s(%d) Message can't be sent\n",
......
...@@ -44,8 +44,7 @@ int st_com_peer_handle_pres(struct pp_instance *ppi, unsigned char *buf, ...@@ -44,8 +44,7 @@ int st_com_peer_handle_pres(struct pp_instance *ppi, unsigned char *buf,
int st_com_peer_handle_pres_followup(struct pp_instance *ppi, int st_com_peer_handle_pres_followup(struct pp_instance *ppi,
unsigned char *buf, int len); unsigned char *buf, int len);
int __send_and_log(struct pp_instance *ppi, int msglen, int __send_and_log(struct pp_instance *ppi, int msglen, int chtype);
int msgtype, int chtype);
/* Count successfully received PTP packets */ /* Count successfully received PTP packets */
static inline int __recv_and_count(struct pp_instance *ppi, void *pkt, int len, static inline int __recv_and_count(struct pp_instance *ppi, void *pkt, int len,
......
...@@ -430,7 +430,7 @@ int msg_issue_announce(struct pp_instance *ppi) ...@@ -430,7 +430,7 @@ int msg_issue_announce(struct pp_instance *ppi)
{ {
int len = msg_pack_announce(ppi); int len = msg_pack_announce(ppi);
return __send_and_log(ppi, len, PPM_ANNOUNCE, PP_NP_GEN); return __send_and_log(ppi, len, PP_NP_GEN);
} }
/* Pack and send on event multicast ip adress a Sync message */ /* Pack and send on event multicast ip adress a Sync message */
...@@ -444,14 +444,14 @@ int msg_issue_sync_followup(struct pp_instance *ppi) ...@@ -444,14 +444,14 @@ int msg_issue_sync_followup(struct pp_instance *ppi)
ppi->t_ops->get(ppi, &now); ppi->t_ops->get(ppi, &now);
from_TimeInternal(&now, &tstamp); from_TimeInternal(&now, &tstamp);
len = msg_pack_sync(ppi, &tstamp); len = msg_pack_sync(ppi, &tstamp);
e = __send_and_log(ppi, len, PPM_SYNC, PP_NP_EVT); e = __send_and_log(ppi, len, PP_NP_EVT);
if (e) return e; if (e) return e;
/* Send followup on general channel with sent-stamp of sync */ /* Send followup on general channel with sent-stamp of sync */
time_snt = &ppi->last_snt_time; time_snt = &ppi->last_snt_time;
from_TimeInternal(time_snt, &tstamp); from_TimeInternal(time_snt, &tstamp);
len = msg_pack_follow_up(ppi, &tstamp); len = msg_pack_follow_up(ppi, &tstamp);
return __send_and_log(ppi, len, PPM_FOLLOW_UP, PP_NP_GEN); return __send_and_log(ppi, len, PP_NP_GEN);
} }
/* Pack and send on general multicast ip address a FollowUp message */ /* Pack and send on general multicast ip address a FollowUp message */
...@@ -465,7 +465,7 @@ int msg_issue_pdelay_resp_followup(struct pp_instance *ppi, TimeInternal * time) ...@@ -465,7 +465,7 @@ int msg_issue_pdelay_resp_followup(struct pp_instance *ppi, TimeInternal * time)
len = msg_pack_pdelay_resp_follow_up(ppi, &ppi->received_ptp_header, len = msg_pack_pdelay_resp_follow_up(ppi, &ppi->received_ptp_header,
&prec_orig_tstamp); &prec_orig_tstamp);
return __send_and_log(ppi, len, PPM_PDELAY_R_FUP, PP_NP_GEN); return __send_and_log(ppi, len, PP_NP_GEN);
} }
/* Pack and send on event multicast ip adress a DelayReq message */ /* Pack and send on event multicast ip adress a DelayReq message */
...@@ -480,7 +480,7 @@ static int msg_issue_delay_req(struct pp_instance *ppi) ...@@ -480,7 +480,7 @@ static int msg_issue_delay_req(struct pp_instance *ppi)
len = msg_pack_delay_req(ppi, &orig_tstamp); len = msg_pack_delay_req(ppi, &orig_tstamp);
return __send_and_log(ppi, len, PPM_DELAY_REQ, PP_NP_EVT); return __send_and_log(ppi, len, PP_NP_EVT);
} }
/* Pack and send on event multicast ip adress a PDelayReq message */ /* Pack and send on event multicast ip adress a PDelayReq message */
...@@ -495,7 +495,7 @@ static int msg_issue_pdelay_req(struct pp_instance *ppi) ...@@ -495,7 +495,7 @@ static int msg_issue_pdelay_req(struct pp_instance *ppi)
len = msg_pack_pdelay_req(ppi, &orig_tstamp); len = msg_pack_pdelay_req(ppi, &orig_tstamp);
return __send_and_log(ppi, len, PPM_PDELAY_REQ, PP_NP_EVT); return __send_and_log(ppi, len, PP_NP_EVT);
} }
int msg_issue_request(struct pp_instance *ppi) int msg_issue_request(struct pp_instance *ppi)
...@@ -515,7 +515,7 @@ int msg_issue_delay_resp(struct pp_instance *ppi, TimeInternal *time) ...@@ -515,7 +515,7 @@ int msg_issue_delay_resp(struct pp_instance *ppi, TimeInternal *time)
len = msg_pack_delay_resp(ppi, &ppi->received_ptp_header, &rcv_tstamp); len = msg_pack_delay_resp(ppi, &ppi->received_ptp_header, &rcv_tstamp);
return __send_and_log(ppi, len, PPM_DELAY_RESP, PP_NP_GEN); return __send_and_log(ppi, len, PP_NP_GEN);
} }
/* Pack and send on event multicast ip adress a DelayResp message */ /* Pack and send on event multicast ip adress a DelayResp message */
...@@ -528,5 +528,5 @@ int msg_issue_pdelay_resp(struct pp_instance *ppi, TimeInternal * time) ...@@ -528,5 +528,5 @@ int msg_issue_pdelay_resp(struct pp_instance *ppi, TimeInternal * time)
len = msg_pack_pdelay_resp(ppi, &ppi->received_ptp_header, &rcv_tstamp); len = msg_pack_pdelay_resp(ppi, &ppi->received_ptp_header, &rcv_tstamp);
return __send_and_log(ppi, len, PPM_PDELAY_RESP, PP_NP_EVT); return __send_and_log(ppi, len, PP_NP_EVT);
} }
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