summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-06-11 16:45:47 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-06-11 17:43:03 +0200
commit076ed09e9eaeeb751ce87bac67ae0becc7b2417b (patch)
treea78613196db4710cf4b26a6149e9bba781f62f8d /v3po/v3po2vpp/src/main/java/io/fd
parent887fb8a181146390bccb6eaf5caeb0a84659c750 (diff)
HC2VPP-354: use hw_interface_set_mtu for Ethernet interfaces
The API was renamed by https://gerrit.fd.io/r/#/c/12930/ The VPP change spearates setting of hardware interface and software interface MTU. More details: https://git.fd.io/vpp/tree/src/vnet/MTU.md HC supports only hardware interface MTU configuration for Ethernet interfaces. MTU for software interfaces (per protocol MTU) is not supported (HC2VPP-355). Change-Id: I7eb1cb035a7b0f428a7bc7a9bb1c73819b52f0fa Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/EthernetCustomizer.java12
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/EthernetCustomizer.java5
2 files changed, 14 insertions, 3 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/EthernetCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/EthernetCustomizer.java
index 6945f45e7..dfac5b99d 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/EthernetCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/EthernetCustomizer.java
@@ -21,7 +21,7 @@ import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetMtu;
+import io.fd.vpp.jvpp.core.dto.HwInterfaceSetMtu;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.EthernetCsmacd;
@@ -75,10 +75,16 @@ public class EthernetCustomizer extends AbstractInterfaceTypeCustomizer<Ethernet
final String name = id.firstKeyOf(Interface.class).getName();
final int index = interfaceContext.getIndex(name, writeContext.getMappingContext());
LOG.debug("Setting Ethernet attributes for interface: {}, {}. Ethernet: {}", name, index, dataAfter);
- final SwInterfaceSetMtu request = new SwInterfaceSetMtu();
+
+ // Set the physical payload MTU. I.e. not including L2 overhead.
+ // Setting the hardware MTU will program the NIC.
+ // Setting MTU for software interfaces is currently not supported (TODO: HC2VPP-355).
+ // More details:
+ // https://git.fd.io/vpp/tree/src/vnet/MTU.md
+ final HwInterfaceSetMtu request = new HwInterfaceSetMtu();
request.swIfIndex = index;
request.mtu = dataAfter.getMtu().shortValue();
- getReplyForWrite(getFutureJVpp().swInterfaceSetMtu(request).toCompletableFuture(), id);
+ getReplyForWrite(getFutureJVpp().hwInterfaceSetMtu(request).toCompletableFuture(), id);
LOG.debug("Ethernet attributes set successfully for: {}, {}. Ethernet: {}", name, index, dataAfter);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/EthernetCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/EthernetCustomizer.java
index 8bb01a98b..de329da85 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/EthernetCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/EthernetCustomizer.java
@@ -65,6 +65,11 @@ public class EthernetCustomizer
final SwInterfaceDetails iface = dumpManager.getInterfaceDetail(id, ctx, key.getName());
if (iface.linkMtu != 0) {
+ // Read physical payload MTU (link_mtu) if given.
+ // VPP since 18.07 supports also setting MTUs for software interfaces,
+ // but these are not supported by HC (TODO: HC2VPP-355).
+ // More details:
+ // https://git.fd.io/vpp/tree/src/vnet/MTU.md
builder.setMtu((int) iface.linkMtu);
}