netmap: bridge: fix NS_MOREFRAG support
Support for NS_MOREFRAG is broken, as NS_MOREFRAG is copied from the TX slot to the RX slot rather than the other way around. Also, the NS_MOREFRAG must be copied also in case of packet copy (no zerocopy). Reported by: rajesh1.kumar_amd.com MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D27980
This commit is contained in:
parent
710dd05c0e
commit
163f4f1573
@ -86,13 +86,12 @@ rings_move(struct netmap_ring *rxring, struct netmap_ring *txring,
|
||||
struct netmap_slot *rs = &rxring->slot[j];
|
||||
struct netmap_slot *ts = &txring->slot[k];
|
||||
|
||||
/* swap packets */
|
||||
if (ts->buf_idx < 2 || rs->buf_idx < 2) {
|
||||
RD(2, "wrong index rxr[%d] = %d -> txr[%d] = %d",
|
||||
j, rs->buf_idx, k, ts->buf_idx);
|
||||
sleep(2);
|
||||
}
|
||||
/* copy the packet length. */
|
||||
/* Copy the packet length. */
|
||||
if (rs->len > rxring->nr_buf_size) {
|
||||
RD(2, "%s: invalid len %u, rxr[%d] -> txr[%d]",
|
||||
msg, rs->len, j, k);
|
||||
@ -109,13 +108,16 @@ rings_move(struct netmap_ring *rxring, struct netmap_ring *txring,
|
||||
/* report the buffer change. */
|
||||
ts->flags |= NS_BUF_CHANGED;
|
||||
rs->flags |= NS_BUF_CHANGED;
|
||||
/* copy the NS_MOREFRAG */
|
||||
rs->flags = (rs->flags & ~NS_MOREFRAG) | (ts->flags & NS_MOREFRAG);
|
||||
} else {
|
||||
char *rxbuf = NETMAP_BUF(rxring, rs->buf_idx);
|
||||
char *txbuf = NETMAP_BUF(txring, ts->buf_idx);
|
||||
nm_pkt_copy(rxbuf, txbuf, ts->len);
|
||||
}
|
||||
/*
|
||||
* Copy the NS_MOREFRAG from rs to ts, leaving any
|
||||
* other flags unchanged.
|
||||
*/
|
||||
ts->flags = (ts->flags & ~NS_MOREFRAG) | (rs->flags & NS_MOREFRAG);
|
||||
j = nm_ring_next(rxring, j);
|
||||
k = nm_ring_next(txring, k);
|
||||
}
|
||||
@ -190,7 +192,7 @@ usage(void)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char msg_a2b[128], msg_b2a[128];
|
||||
char msg_a2b[256], msg_b2a[256];
|
||||
struct pollfd pollfd[2];
|
||||
u_int burst = 1024, wait_link = 4;
|
||||
struct nmport_d *pa = NULL, *pb = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user