"Jun Wang" <[email protected]> writes:
>>Mike Pattrick <[email protected]> writes:
>>
>>> On Tue, Mar 4, 2025 at 10:51 AM Aaron Conole <[email protected]> wrote:
>>>>
>>>> Jun Wang via discuss <[email protected]> writes:
>>>>
>>>> >> Hello,
>>>> >
>>>> >> Yes, this will result in better ovs-tcpdump performance. The reason
>>>> >> why it hasn't been added so far is because we can't guarantee or even
>>>> >> check for the existence of any given DPDK driver at runtime in a
>>>> >> generic fashion.
>>>> >>
>>>> >> One option would be to select this type of interface with a
>>>> >> non-default command line flag.
>>>> >
>>>> > Hi, I also believe that choosing a non-default command line flag
>>>> > to support this is a good option, allowing customers to decide
>>>> > whether or not
>>>> > to use this flag.
>>>> > However, there are still some details to consider, such as whether to
>>>> > allow users to configure the virtio-user port queue,
>>>> > and whether virtio-user usage requires affinity configuration, etc.
>>>>
>>>> ovs-tcpdump will already support using `--mirror-to` as a destination.
>>>> Wouldn't that be an appropriate flag? There's a lot involved with setup
>>>> for a successful DPDK environment, and as you note lots of user required
>>>> input.
>>>
>>> Unfortunately, mirror-to only lets you set the interface name. It will
>>> still try to create a tap device and add it to OVS. If the interface
>>> already exists, ovs-tcpdump will quit with an error.
>>
>>Hrrm... I thought it shouldn't:
>>
>> if sys.platform in _make_taps and \
>> mirror_interface not in interfaces():
>> _make_taps[sys.platform](mirror_interface,
>> ovsdb.interface_mtu(interface))
>> tap_created = True
>> else:
>> tap_created = False
>>
>>But I guess interfaces() might not match because the DPDK devices won't
>>appear in /dev/net (or likely be dumped from netifaces function).
>>
>>Maybe the fix there could be to make mirror-to aware of these other
>>devices (for instance, maybe searching the interfaces in OVSDB).
>
> Yes, I have actually tried using mirror-to, and it does result in an error.
>
> The error message and the corresponding code are as follows:
>
> [root@compute0-dpdk /]# ovs-tcpdump -i vh-userclient-e5281ddf-c8 --mirror-to
> veth1
>
> ERROR: Mirror port (veth1) exists for port vh-userclient-e5281ddf-c8.
>
> if ovsdb.port_exists(mirror_interface):
>
> print("ERROR: Mirror port (%s) exists for port %s." %
>
> (mirror_interface, interface))
>
> sys.exit(1)
Probably need a bit of rework around the use case - can you try the
following (I didn't really test it well, just trying to see if the idea
is good)
---
diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 187eafdf25..2070678b3a 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -421,13 +421,16 @@ def py_which(executable):
for path in os.environ["PATH"].split(os.pathsep))
-def teardown(db_sock, interface, mirror_interface, tap_created):
+def teardown(db_sock, interface, mirror_interface, tap_created,
+ created_mirror):
def cleanup_mirror():
try:
ovsdb = OVSDB(db_sock)
ovsdb.destroy_mirror(interface, ovsdb.port_bridge(interface))
- ovsdb.destroy_port(mirror_interface, ovsdb.port_bridge(interface))
- if tap_created is True:
+ if created_mirror:
+ ovsdb.destroy_port(mirror_interface,
+ ovsdb.port_bridge(interface))
+ if tap_created:
_del_taps[sys.platform](mirror_interface)
except Exception:
print("Unable to tear down the ports and mirrors.")
@@ -505,15 +508,21 @@ def main():
if sys.platform in _make_mirror_name:
mirror_interface = _make_mirror_name[sys.platform](interface)
+ created_mirror = True
if sys.platform in _make_taps and \
- mirror_interface not in interfaces():
+ mirror_interface not in interfaces() and \
+ not ovsdb.port_exists(mirror_interface):
_make_taps[sys.platform](mirror_interface,
ovsdb.interface_mtu(interface))
tap_created = True
else:
+ if mirror_interface in interfaces() or \
+ ovsdb.port_exists(mirror_interface):
+ created_mirror = False
tap_created = False
- if mirror_interface not in interfaces():
+ if mirror_interface not in interfaces() and \
+ not ovsdb.port_exists(mirror_interface):
print("ERROR: Please create an interface called `%s`" %
mirror_interface)
print("See your OS guide for how to do this.")
@@ -524,15 +533,12 @@ def main():
if not ovsdb.port_exists(interface):
print("ERROR: Port %s does not exist." % interface)
sys.exit(1)
- if ovsdb.port_exists(mirror_interface):
- print("ERROR: Mirror port (%s) exists for port %s." %
- (mirror_interface, interface))
- sys.exit(1)
- teardown(db_sock, interface, mirror_interface, tap_created)
+ teardown(db_sock, interface, mirror_interface, tap_created, created_mirror)
try:
- ovsdb.make_port(mirror_interface, ovsdb.port_bridge(interface))
+ if created_mirror:
+ ovsdb.make_port(mirror_interface, ovsdb.port_bridge(interface))
ovsdb.bridge_mirror(interface, mirror_interface,
ovsdb.port_bridge(interface),
mirror_select_all, mirror_filter=mirror_filter)
---
2.47.1
_______________________________________________
discuss mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss