transport: Introduce transmit time stamp deferral.
Up until now, the code has always fetched the time stamp immediately after transmitting a message. However, a transparent clock will want to forward a given incoming message out all egress ports with as little delay as possible, in order to minimize the residence time of the message within the switch. This patch adds a new transmit mode for event messages that will be used to signal the new behavior. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
a1c5e3f2ed
commit
e160bad721
14
raw.c
14
raw.c
|
@ -296,9 +296,21 @@ static int raw_send(struct transport *t, struct fdarray *fda,
|
||||||
{
|
{
|
||||||
struct raw *raw = container_of(t, struct raw, t);
|
struct raw *raw = container_of(t, struct raw, t);
|
||||||
ssize_t cnt;
|
ssize_t cnt;
|
||||||
int fd = event ? fda->fd[FD_EVENT] : fda->fd[FD_GENERAL];
|
|
||||||
unsigned char pkt[1600], *ptr = buf;
|
unsigned char pkt[1600], *ptr = buf;
|
||||||
struct eth_hdr *hdr;
|
struct eth_hdr *hdr;
|
||||||
|
int fd = -1;
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case TRANS_GENERAL:
|
||||||
|
fd = fda->fd[FD_GENERAL];
|
||||||
|
break;
|
||||||
|
case TRANS_EVENT:
|
||||||
|
case TRANS_ONESTEP:
|
||||||
|
case TRANS_P2P1STEP:
|
||||||
|
case TRANS_DEFER_EVENT:
|
||||||
|
fd = fda->fd[FD_EVENT];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ptr -= sizeof(*hdr);
|
ptr -= sizeof(*hdr);
|
||||||
len += sizeof(*hdr);
|
len += sizeof(*hdr);
|
||||||
|
|
|
@ -50,6 +50,7 @@ enum transport_event {
|
||||||
TRANS_EVENT,
|
TRANS_EVENT,
|
||||||
TRANS_ONESTEP,
|
TRANS_ONESTEP,
|
||||||
TRANS_P2P1STEP,
|
TRANS_P2P1STEP,
|
||||||
|
TRANS_DEFER_EVENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct transport;
|
struct transport;
|
||||||
|
|
16
udp.c
16
udp.c
|
@ -219,10 +219,22 @@ static int udp_send(struct transport *t, struct fdarray *fda,
|
||||||
enum transport_event event, int peer, void *buf, int len,
|
enum transport_event event, int peer, void *buf, int len,
|
||||||
struct address *addr, struct hw_timestamp *hwts)
|
struct address *addr, struct hw_timestamp *hwts)
|
||||||
{
|
{
|
||||||
ssize_t cnt;
|
|
||||||
int fd = event ? fda->fd[FD_EVENT] : fda->fd[FD_GENERAL];
|
|
||||||
struct address addr_buf;
|
struct address addr_buf;
|
||||||
unsigned char junk[1600];
|
unsigned char junk[1600];
|
||||||
|
ssize_t cnt;
|
||||||
|
int fd = -1;
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case TRANS_GENERAL:
|
||||||
|
fd = fda->fd[FD_GENERAL];
|
||||||
|
break;
|
||||||
|
case TRANS_EVENT:
|
||||||
|
case TRANS_ONESTEP:
|
||||||
|
case TRANS_P2P1STEP:
|
||||||
|
case TRANS_DEFER_EVENT:
|
||||||
|
fd = fda->fd[FD_EVENT];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!addr) {
|
if (!addr) {
|
||||||
memset(&addr_buf, 0, sizeof(addr_buf));
|
memset(&addr_buf, 0, sizeof(addr_buf));
|
||||||
|
|
16
udp6.c
16
udp6.c
|
@ -230,10 +230,22 @@ static int udp6_send(struct transport *t, struct fdarray *fda,
|
||||||
struct address *addr, struct hw_timestamp *hwts)
|
struct address *addr, struct hw_timestamp *hwts)
|
||||||
{
|
{
|
||||||
struct udp6 *udp6 = container_of(t, struct udp6, t);
|
struct udp6 *udp6 = container_of(t, struct udp6, t);
|
||||||
ssize_t cnt;
|
|
||||||
int fd = event ? fda->fd[FD_EVENT] : fda->fd[FD_GENERAL];
|
|
||||||
struct address addr_buf;
|
struct address addr_buf;
|
||||||
unsigned char junk[1600];
|
unsigned char junk[1600];
|
||||||
|
ssize_t cnt;
|
||||||
|
int fd = -1;
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case TRANS_GENERAL:
|
||||||
|
fd = fda->fd[FD_GENERAL];
|
||||||
|
break;
|
||||||
|
case TRANS_EVENT:
|
||||||
|
case TRANS_ONESTEP:
|
||||||
|
case TRANS_P2P1STEP:
|
||||||
|
case TRANS_DEFER_EVENT:
|
||||||
|
fd = fda->fd[FD_EVENT];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!addr) {
|
if (!addr) {
|
||||||
memset(&addr_buf, 0, sizeof(addr_buf));
|
memset(&addr_buf, 0, sizeof(addr_buf));
|
||||||
|
|
Loading…
Reference in New Issue