Skip to content

Commit 3906fdb

Browse files
committed
rx,tx: enable multi segment to support higher mtu
In order to support receiving packets larger than 2048 bytes, we need to enable multi-segment rx and tx offload in the drivers. Enable RTE_ETH_RX_OFFLOAD_SCATTER and RTE_ETH_TX_OFFLOAD_MULTI_SEGS in the requested offload flags when configuring DPDK ports. Update the basic IP forward test to check we are indeed receiving 5000 bytes packets with a configured MTU of 9000 bytes. Suggested-by: David Marchand <[email protected]> Signed-off-by: Robin Jarry <[email protected]>
1 parent 30e882e commit 3906fdb

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

modules/infra/control/port.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ static struct rte_eth_conf default_port_config = {
7272
},
7373
},
7474
.rxmode = {
75-
.offloads = RTE_ETH_RX_OFFLOAD_CHECKSUM | RTE_ETH_RX_OFFLOAD_VLAN,
75+
.offloads = RTE_ETH_RX_OFFLOAD_CHECKSUM
76+
| RTE_ETH_RX_OFFLOAD_VLAN
77+
| RTE_ETH_RX_OFFLOAD_SCATTER,
78+
},
79+
.txmode = {
80+
.offloads = RTE_ETH_TX_OFFLOAD_MULTI_SEGS,
7681
},
7782
};
7883

@@ -123,6 +128,7 @@ int port_configure(struct iface_info_port *p, uint16_t n_txq_min) {
123128
else
124129
conf.rxmode.mq_mode = RTE_ETH_MQ_RX_RSS;
125130
conf.rxmode.offloads &= info.rx_offload_capa;
131+
conf.txmode.offloads &= info.tx_offload_capa;
126132
if (info.dev_flags != NULL && *info.dev_flags & RTE_ETH_DEV_INTR_LSC) {
127133
conf.intr_conf.lsc = 1;
128134
}

smoke/ip_forward_test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
p0=${run_id}0
88
p1=${run_id}1
99

10-
grcli add interface port $p0 devargs net_tap0,iface=$p0 mac f0:0d:ac:dc:00:00
11-
grcli add interface port $p1 devargs net_tap1,iface=$p1 mac f0:0d:ac:dc:00:01
10+
grcli add interface port $p0 devargs net_tap0,iface=$p0 mac f0:0d:ac:dc:00:00 mtu 9000
11+
grcli add interface port $p1 devargs net_tap1,iface=$p1 mac f0:0d:ac:dc:00:01 mtu 9000
1212
grcli add ip address 172.16.0.1/24 iface $p0
1313
grcli add ip address 172.16.1.1/24 iface $p1
1414
grcli add ip route 16.0.0.0/16 via 172.16.0.2
@@ -19,7 +19,7 @@ for n in 0 1; do
1919
p=$run_id$n
2020
netns_add $p
2121
ip link set $p netns $p
22-
ip -n $p link set $p address ba:d0:ca:ca:00:0$n
22+
ip -n $p link set $p address ba:d0:ca:ca:00:0$n mtu 9000
2323
ip -n $p link set $p up
2424
ip -n $p link set lo up
2525
ip -n $p addr add 172.16.$n.2/24 dev $p
@@ -28,8 +28,8 @@ for n in 0 1; do
2828
ip -n $p addr show
2929
done
3030

31-
ip netns exec $p0 ping -i0.01 -c3 -n 16.1.0.1
32-
ip netns exec $p1 ping -i0.01 -c3 -n 16.0.0.1
31+
ip netns exec $p0 ping -i0.01 -c3 -n 16.1.0.1 -s 5000
32+
ip netns exec $p1 ping -i0.01 -c3 -n 16.0.0.1 -s 5000
3333
ip netns exec $p0 ping -i0.01 -c3 -n 172.16.1.2
3434
ip netns exec $p1 ping -i0.01 -c3 -n 172.16.0.2
3535
ip netns exec $p0 ping -i0.01 -c3 -n 172.16.0.1

0 commit comments

Comments
 (0)