blob: c7e92523c7ff196ee2b9e726e7230912c56918f5 [file] [log] [blame]
Nathan Skrzypczakd4a70642021-10-08 14:01:27 +02001.. _mtu_doc:
2
3MTU in VPP
4==========
5
6Maximum Transmission Unit is a term used to describe the maximum sized
7thingy that can be sent out an interface. It can refer to the maximum
8frame size that a NIC can send. On Ethernet that would include the
9Ethernet header but typically not the IGF. It can refer to the maximum
10packet size, that is, on Ethernet an MTU of 1500, would allow an IPv4
11packet of 1500 bytes, that would result in an Ethernet frame of 1518
12bytes.
13
14
15VPP allows setting of the physical payload MTU. I.e. not including L2
16overhead. Setting the hardware MTU will program the NIC. This MTU will
17be inherited by all software interfaces.
18
19VPP also allows setting of the payload MTU for software interfaces.
20Independently of the MTU set on the hardware. If the software payload
21MTU is set higher than the capability of the NIC, the packet will be
22dropped.
23
24In addition VPP supports setting the MTU of individual network layer
25protocols. IPv4, IPv6 or MPLS. For example an IPv4 MTU of 1500 (includes
26the IPv4 header) will fit in a hardware payload MTU of 1500.
27
28*Note we might consider changing the hardware payload MTU to hardware
29MTU*. That is, the MTU includes all L2 framing. Then the payload MTU can
30be calculated based on the interfaces configuration. E.g. 802.1q tags
31etc.
32
33There are currently no checks or warnings if e.gthe user configures a
34per-protocol MTU larger than the underlying payload MTU. If that happens
35packets will be fragmented or dropped.
36
37Data structures
38^^^^^^^^^^^^^^^
39
40The hardware payload MTU is stored in the max_packet_bytes variable in
41the vnet_hw_interface_t structure.
42
43The software MTU (previously max_l3_packet_bytes) is in
44vnet_sw_interface_t->in mtu[VNET_N_MTU].
45
46MTU API
47-------
48
49Set physical MTU
50^^^^^^^^^^^^^^^^
51
52This API message is used to set the physical MTU. It is currently
53limited to Ethernet interfaces. Note, this programs the NIC.
54
55::
56
57 autoreply define hw_interface_set_mtu
58 {
59 u32 client_index;
60 u32 context;
61 u32 sw_if_index;
62 u16 mtu;
63 };
64
65Set the L2 payload MTU
66^^^^^^^^^^^^^^^^^^^^^^
67
68:: note
69 (not including the L2 header) and per-protocol MTUs
70
71This API message sets the L3 payload MTU. E.g. on Ethernet it is the
72maximum size of the Ethernet payload. If a value is left as 0, then the
73default is picked from VNET_MTU_L3.
74
75::
76
77 autoreply define sw_interface_set_mtu
78 {
79 u32 client_index;
80 u32 context;
81 u32 sw_if_index;
82 /* $$$$ Replace with enum */
83 u32 mtu[4]; /* 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
84 };
85
86Get interface MTU
87^^^^^^^^^^^^^^^^^
88
89The various MTUs on an interface can be queried with the
90sw_interface_dump/sw_interface_details calls.
91
92::
93
94 define sw_interface_details
95 {
96 /* MTU */
97 u16 link_mtu;
98
99 /* Per protocol MTUs */
100 u32 mtu[4]; /* 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
101 };
102
103MTU CLI
104-------
105
106::
107
108 set interface mtu [packet|ip4|ip6|mpls] <value> <interface>