netdev-dpdk: vhost-user: Fix sending packets to queues not enabled by guest.
[cascardo/ovs.git] / rhel / etc_sysconfig_network-scripts_ifup-ovs
index 4e7d4d1..f3fc05e 100755 (executable)
@@ -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
@@ -117,7 +121,11 @@ case "$TYPE" in
        OVSPort)
                ifup_ovs_bridge
                ${OTHERSCRIPT} ${CONFIG} ${2}
-               ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
+               # The port might be already in the database but not yet
+               # in the datapath.  So, remove the stale interface first.
+               ovs-vsctl -t ${TIMEOUT} \
+                       -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE" \
+                       -- add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
                OVSINTF=${DEVICE} /sbin/ifup "$OVS_BRIDGE"
                ;;
        OVSIntPort)
@@ -141,12 +149,27 @@ case "$TYPE" in
        OVSTunnel)
                ifup_ovs_bridge
                ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=$OVS_TUNNEL_TYPE $OVS_TUNNEL_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
-               ${OTHERSCRIPT} ${CONFIG} ${2}
                ;;
        OVSPatchPort)
                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