Skip to content

Commit 999b71e

Browse files
committed
CA-119831 Apply GRO settings to bond and vlan interfaces
Ethtool settings (Generic Receive Offload etc.) need to be set on the bond and VLAN devices where applicable. Signed-off-by: Thomas Sanders <[email protected]>
1 parent 33b26a7 commit 999b71e

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

ocaml/xapi/nm.ml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,19 @@ let get_pif_type pif_rc =
236236
| Some tunnel -> `tunnel_pif tunnel
237237
| None -> `phy_pif
238238

239+
let linux_pif_config pif_type pif_rc mtu persistent =
240+
(* If we are using linux bridge rather than OVS, then we need to
241+
* configure the "pif" that represents the vlan or bond.
242+
* In OVS there is no such device, so the config entry will be ignored
243+
* by Interface.make_config in xcp-networkd/networkd/network_server.ml *)
244+
let (ethtool_settings, ethtool_offload) =
245+
determine_ethtool_settings pif_rc.API.pIF_other_config in
246+
pif_rc.API.pIF_device ^ (match pif_type with
247+
| `bond_pif -> ""
248+
| `vlan_pif -> ("." ^ Int64.to_string pif_rc.API.pIF_VLAN)
249+
),
250+
{default_interface with mtu; ethtool_settings; ethtool_offload; persistent_i=persistent;}
251+
239252
let rec create_bridges ~__context pif_rc net_rc =
240253
let mtu = determine_mtu pif_rc net_rc in
241254
let other_config = determine_other_config ~__context pif_rc net_rc in
@@ -247,17 +260,24 @@ let rec create_bridges ~__context pif_rc net_rc =
247260
other_config; persistent_b=persistent}],
248261
[]
249262
| `vlan_pif vlan ->
263+
let original_pif_rc = pif_rc in
250264
let slave = Db.VLAN.get_tagged_PIF ~__context ~self:vlan in
251265
let pif_rc = Db.PIF.get_record ~__context ~self:slave in
252266
let net_rc = Db.Network.get_record ~__context ~self:pif_rc.API.pIF_network in
253267
let cleanup, bridge_config, interface_config = create_bridges ~__context pif_rc net_rc in
268+
let interface_config = (* Add configuration for the vlan device itself *)
269+
linux_pif_config `vlan_pif original_pif_rc mtu persistent
270+
:: interface_config
271+
in
254272
cleanup,
255273
create_vlan ~__context vlan persistent @ bridge_config,
256274
interface_config
257275
| `bond_pif bond ->
258276
let cleanup, bridge_config, interface_config = create_bond ~__context bond mtu persistent in
259-
let interface_config = (pif_rc.API.pIF_device, {default_interface with mtu; persistent_i=persistent})
260-
:: interface_config in
277+
let interface_config = (* Add configuration for the bond pif itself *)
278+
linux_pif_config `bond_pif pif_rc mtu persistent
279+
:: interface_config
280+
in
261281
cleanup, bridge_config, interface_config
262282
| `phy_pif ->
263283
let cleanup =

0 commit comments

Comments
 (0)