Page MenuHomeFreeBSD

D60217.diff
No OneTemporary

D60217.diff

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -1205,6 +1205,34 @@
uint64_t paddr;
void *addr = PNMB(na, slot, &paddr);
+ /*
+ * An empty packet still takes its descriptor, as netmap
+ * slots and NIC descriptors go in step. A VALE switch
+ * fills the slots it has leased in a destination ring
+ * and then not used with empty packets. Passing them
+ * on with no segment makes the drivers' txd_encap write
+ * through a NULL descriptor pointer, and not every NIC
+ * accepts a descriptor of length 0. Send a minimum size
+ * frame from the interface's address to itself instead:
+ * a switch that has learned the address on this port
+ * filters it, and no other host takes it for its own.
+ */
+ if (__predict_false(len == 0 && seg_idx == 0 &&
+ !(slot->flags & NS_MOREFRAG) &&
+ offset + ETHER_MIN_LEN - ETHER_CRC_LEN <=
+ NETMAP_BUF_SIZE(na))) {
+ uint8_t *f = (uint8_t *)addr + offset;
+
+ len = ETHER_MIN_LEN - ETHER_CRC_LEN;
+ memset(f, 0, len);
+ memcpy(f, if_getlladdr(ifp), ETHER_ADDR_LEN);
+ memcpy(f + ETHER_ADDR_LEN, if_getlladdr(ifp),
+ ETHER_ADDR_LEN);
+ /* IEEE Std 802 Local Experimental Ethertype 1 */
+ f[2 * ETHER_ADDR_LEN] = 0x88;
+ f[2 * ETHER_ADDR_LEN + 1] = 0xb5;
+ }
+
flags |= (slot->flags & NS_REPORT ||
nic_i == 0 || nic_i == report_frequency) ?
IPI_TX_INTR : 0;

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 3, 6:27 AM (6 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40113576
Default Alt Text
D60217.diff (1 KB)

Event Timeline