diff mbox

[ovs-dev] rhel: Add support DPDK port creation via network scripts

Message ID 619ba4004a3c0380f54dc434ca7a1b9f895fd857.1448981284.git.pmatilai@redhat.com
State Accepted
Headers show

Commit Message

Panu Matilainen Dec. 1, 2015, 2:48 p.m. UTC
Add support for creating a userspace bridge and the four DPDK port
types via network scripts + basic documentation.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
 rhel/README.RHEL                              | 43 +++++++++++++++++++++++++++
 rhel/etc_sysconfig_network-scripts_ifdown-ovs |  5 +++-
 rhel/etc_sysconfig_network-scripts_ifup-ovs   | 24 +++++++++++++--
 3 files changed, 69 insertions(+), 3 deletions(-)

Comments

Aaron Conole Dec. 1, 2015, 4:33 p.m. UTC | #1
Panu Matilainen <pmatilai@redhat.com> writes:
> Add support for creating a userspace bridge and the four DPDK port
> types via network scripts + basic documentation.
>
> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>
Flavio Leitner Dec. 22, 2015, 3:28 p.m. UTC | #2
On Tue, Dec 01, 2015 at 04:48:04PM +0200, Panu Matilainen wrote:
> Add support for creating a userspace bridge and the four DPDK port
> types via network scripts + basic documentation.
> 
> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
> ---

Please apply this one branch-2.5 too.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Ben Pfaff Dec. 22, 2015, 9:47 p.m. UTC | #3
On Tue, Dec 01, 2015 at 04:48:04PM +0200, Panu Matilainen wrote:
> Add support for creating a userspace bridge and the four DPDK port
> types via network scripts + basic documentation.
> 
> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>

Thanks!  Applied to master and branch-2.5.  (Sorry about the delay in
applying.)
diff mbox

Patch

diff --git a/rhel/README.RHEL b/rhel/README.RHEL
index 2620674..54c1b44 100644
--- a/rhel/README.RHEL
+++ b/rhel/README.RHEL
@@ -27,6 +27,19 @@  assignments.  The following OVS-specific variable names are supported:
 
         * "OVSPatchPort", if <name> is a patch port
 
+      Additionally the following DPDK port types may be available,
+      depends on OVS build- and runtime configuration:
+
+        * "OVSDPDKPort", if <name> is a physical DPDK NIC port (name
+          must start with "dpdk" and end with portid, eg "dpdk0")
+
+	* "OVSDPDKRPort", if <name> is a DPDK ring port (name must
+          start with dpdkr and end with portid, eg "dpdkr0")
+
+        * "OVSDPDKVhostPort" if <name> is a DPDK vhost-cuse port
+
+        * "OVSDPDKVhostUserPort" if <name> is a DPDK vhost-user port
+
     - OVS_BRIDGE: If TYPE is anything other than "OVSBridge", set to
       the name of the OVS bridge to which the port should be attached.
 
@@ -206,6 +219,36 @@  TYPE=OVSPatchPort
 OVS_BRIDGE=ovsbridge1
 OVS_PATCH_PEER=patch-ovs-0
 
+User bridge:
+
+==> ifcfg-obr0 <==
+
+DEVICE=obr0
+ONBOOT=yes
+DEVICETYPE=ovs
+TYPE=OVSUserBridge
+BOOTPROTO=static
+IPADDR=A.B.C.D
+NETMASK=X.Y.Z.0
+HOTPLUG=no
+
+DPDK NIC port:
+
+==> ifcfg-dpdk0 <==
+
+DPDK vhost-user port:
+DEVICE=dpdk0
+ONBOOT=yes
+DEVICETYPE=ovs
+TYPE=OVSDPDKPort
+OVS_BRIDGE=obr0
+
+==> ifcfg-vhu0 <==
+DEVICE=vhu0
+ONBOOT=yes
+DEVICETYPE=ovs
+TYPE=OVSDPDKVhostUserPort
+OVS_BRIDGE=obr0
 
 Reporting Bugs
 --------------
diff --git a/rhel/etc_sysconfig_network-scripts_ifdown-ovs b/rhel/etc_sysconfig_network-scripts_ifdown-ovs
index 5f78f9c..46b6ca5 100755
--- a/rhel/etc_sysconfig_network-scripts_ifdown-ovs
+++ b/rhel/etc_sysconfig_network-scripts_ifdown-ovs
@@ -46,7 +46,7 @@  else
 fi
 
 case "$TYPE" in
-	OVSBridge)
+	OVSBridge|OVSUserBridge)
 		${OTHERSCRIPT} ${CONFIG} $2
 		retval=$?
 		ovs-vsctl -t ${TIMEOUT} -- --if-exists del-br "$DEVICE"
@@ -59,6 +59,9 @@  case "$TYPE" in
 	OVSPatchPort|OVSTunnel)
 		ovs-vsctl -t ${TIMEOUT} -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE"
 		;;
+	OVSDPDKPort|OVSDPDKRPort|OVSDPDKVhostPort|OVSDPDKVhostUserPort)
+		ovs-vsctl -t ${TIMEOUT} -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE"
+		;;
 	*)
 		echo $"Invalid OVS interface type $TYPE"
 		exit 1
diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs b/rhel/etc_sysconfig_network-scripts_ifup-ovs
index 478c5c3..f3fc05e 100755
--- a/rhel/etc_sysconfig_network-scripts_ifup-ovs
+++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs
@@ -72,15 +72,19 @@  else
 fi
 
 case "$TYPE" in
-	OVSBridge)
+	OVSBridge|OVSUserBridge)
 		# If bridge already exists and is up, it has been configured through
 		# other cases like OVSPort, OVSIntPort and OVSBond. If it is down or
 		# it does not exist, create it. It is possible for a bridge to exist
 		# because it remained in the OVSDB for some reason, but it won't be up.
+		if [ "${TYPE}" = "OVSUserBridge" ]; then
+			DATAPATH="netdev"
+		fi
 		if check_device_down "${DEVICE}"; then
 			ovs-vsctl -t ${TIMEOUT} -- --may-exist add-br "$DEVICE" $OVS_OPTIONS \
 			${OVS_EXTRA+-- $OVS_EXTRA} \
-			${STP+-- set bridge "$DEVICE" stp_enable="${STP}"}
+			${STP+-- set bridge "$DEVICE" stp_enable="${STP}"} \
+			${DATAPATH+-- set bridge "$DEVICE" datapath_type="$DATAPATH"}
 		else
 			OVSBRIDGECONFIGURED="yes"
 		fi
@@ -150,6 +154,22 @@  case "$TYPE" in
 		ifup_ovs_bridge
 		ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=patch options:peer="${OVS_PATCH_PEER}" ${OVS_EXTRA+-- $OVS_EXTRA}
 		;;
+	OVSDPDKPort)
+		ifup_ovs_bridge
+		ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=dpdk ${OVS_EXTRA+-- $OVS_EXTRA}
+		;;
+	OVSDPDKRPort)
+		ifup_ovs_bridge
+		ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=dpdkr ${OVS_EXTRA+-- $OVS_EXTRA}
+		;;
+	OVSDPDVhostPort)
+		ifup_ovs_bridge
+		ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=dpdkvhost ${OVS_EXTRA+-- $OVS_EXTRA}
+		;;
+	OVSDPDKVhostUserPort)
+		ifup_ovs_bridge
+		ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=dpdkvhostuser ${OVS_EXTRA+-- $OVS_EXTRA}
+		;;
 	*)
 		echo $"Invalid OVS interface type $TYPE"
 		exit 1