Commit 42b1fafe authored by Cesar Prados's avatar Cesar Prados Committed by Alessandro Rubini

pdelay/socket: add network support for pdelay in wrpc arch

Add the pdelay mac address to the same socket,
it means that one socket has two multicast addr,
E2E and P2P. During recv the wrpc function check
both mac addresses. Send function uses the E2E or
P2P mac addr depending on the msg to be sent.

[changed by Alessandro: create one socket only,
according to Kconfig settings]
Signed-off-by: Cesar Prados's avatarC.Prados <c.prados@gsi.de>
parent 547136f0
......@@ -38,8 +38,14 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
static inline int __send_and_log(struct pp_instance *ppi, int msglen,
int msgtype, int chtype)
{
int pdelay_addr = 0;
if (msgtype == PPM_PDELAY_REQ || msgtype == PPM_PDELAY_RESP)
pdelay_addr = 1;
if (ppi->n_ops->send(ppi, ppi->tx_frame, msglen + ppi->tx_offset,
&ppi->last_snt_time, chtype, 0) < msglen) {
&ppi->last_snt_time, chtype,
pdelay_addr) < msglen) {
pp_diag(ppi, frames, 1, "%s(%d) Message can't be sent\n",
pp_msg_names[msgtype], msgtype);
return PP_SEND_ERROR;
......
......@@ -29,8 +29,11 @@ static int wrpc_open_ch(struct pp_instance *ppi)
struct wr_sockaddr addr;
addr.ethertype = ETH_P_1588;
#ifdef CONFIG_E2E
memcpy(addr.mac, PP_MCAST_MACADDRESS, sizeof(mac_addr_t));
#else
memcpy(addr.mac, PP_PDELAY_MACADDRESS, sizeof(mac_addr_t));
#endif
sock = ptpd_netif_create_socket(&__static_ptp_socket, &addr,
PTPD_SOCK_RAW_ETHERNET, 0);
if (!sock)
......
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