2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-24 10:58:04 +00:00

16 Commits

Author SHA1 Message Date
Mike Pattrick
b3bbfc1729 utilities: Handle dumping packets in GDB TUI.
Currently, ovs_dump_packets will break the formatting of the GDB
terminal UI, resulting in artifacts displayed on the screen that
may make packets difficult to read. This patch suppresses stderr
output from tcpdump and feeds tcpdumps stdout into the paginated
output stream.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-05-04 21:44:59 +02:00
Mike Pattrick
428b11caa7 utilities: Add another GDB macro for ovs-vswitchd.
This commit adds a basic packet metadata macro to the already existing
macros in ovs_gdb.py, ovs_dump_packets will print out information about
one or more packets. It feeds packets into tcpdump, and the user can
pass in tcpdump options to modify how packets are parsed or even write
out packets to a pcap file.

Example usage:
(gdb) break fast_path_processing
(gdb) commands
 ovs_dump_packets packets_
 continue
 end
(gdb) continue

Thread 1 "ovs-vswitchd" hit Breakpoint 2, fast_path_processing ...
12:01:05.962485 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has
    10.1.1.1 tell 10.1.1.2, length 28

Thread 1 "ovs-vswitchd" hit Breakpoint 1, fast_path_processing ...
12:01:05.981214 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.1.1.1
    is-at a6:0f:c3:f0:5f:bd (oui Unknown), length 28

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-04 19:14:11 +01:00
Rosemarie O'Riorden
bd90524550 Remove Python 2 leftovers.
Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.")
Reported at: https://bugzilla.redhat.com/show_bug.cgi?id=1949875
Signed-off-by: Rosemarie O'Riorden <roriorde@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-06-22 21:29:57 +02:00
Eelco Chaudron
eb8fd61d91 Utilities: Add the ovs_dump_ofpacts command to gdb
This adds the ovs_dump_ifpacts command:

(gdb) help ovs_dump_ofpacts
Dump all actions in an ofpacts set
    Usage: ovs_dump_ofpacts <struct ofpact *> <ofpacts_len>

       <struct ofpact *> : Pointer to set of ofpact structures.
       <ofpacts_len>     : Total length of the set.

    Example dumping all actions when in the clone_xlate_actions() function:

    (gdb) ovs_dump_ofpacts actions actions_len
    (struct ofpact *) 0x561c7be487c8: {type = OFPACT_SET_FIELD, raw = 255 '', len = 24}
    (struct ofpact *) 0x561c7be487e0: {type = OFPACT_SET_FIELD, raw = 255 '', len = 24}
    (struct ofpact *) 0x561c7be487f8: {type = OFPACT_SET_FIELD, raw = 255 '', len = 24}
    (struct ofpact *) 0x561c7be48810: {type = OFPACT_SET_FIELD, raw = 255 '', len = 32}
    (struct ofpact *) 0x561c7be48830: {type = OFPACT_SET_FIELD, raw = 255 '', len = 24}
    (struct ofpact *) 0x561c7be48848: {type = OFPACT_RESUBMIT, raw = 38 '&', len = 16}

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: William Tu <u9012063@gmail.com>
2020-04-25 08:09:52 -07:00
Eelco Chaudron
cda22c659e Utilities: make print() in gdb script work on all version of Python
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: William Tu <u9012063@gmail.com>
2020-04-21 08:50:27 -07:00
Timothy Redaelli
0c4d144a98 Remove dependency on python3-six
Since Python 2 support was removed in 1ca0323e7c29 ("Require Python 3 and
remove support for Python 2."), python3-six is not needed anymore.

Moreover python3-six is not available on RHEL/CentOS7 without using EPEL
and so this patch is needed in order to release OVS 2.13 on RHEL7.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-12-20 12:23:06 -08:00
Andreas Karis
ed47794ca3 utilities: gdb debug commands fix typos
Fix minor typos in ovs_gdb debug script.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Andreas Karis <akaris@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 11:00:48 -08:00
Eelco Chaudron
e33b3fec1c utilities: Update gdb script so it works with all python versions
Newer versions of Python require a different iterator function. This
change will make the iterator classes work with all Python versions.

Adds a fix for python3 as it does not support the long() type.
The fix guaranties the script still works on Python 2.7.

The uKey walker is rather slow on python3, so added a spinner to
indicate we are still busy processing entries.

Fix functions using the iterkeys() function on dictionaries.

Tested-by: solomon <liwei.solomon@gmail.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 10:59:33 -08:00
Eelco Chaudron
cd5b89a5a9 utilities: Add smap related command and iterator to the GDB script
Adds "ovs_dump_smap <struct smap *>" command

Example output:

Breakpoint 1, trtcm_policer_qos_construct (details=0x135bad0, conf=0x7ffd31f5da28) at lib/netdev-dpdk.c:4154
(gdb) ovs_dump_smap 0x135bad0
cbs: 2048
cir: 151800
eir: 151800
pbs: 2048

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-12 08:40:55 -08:00
Eelco Chaudron
4ef1edf085 utilities: Update gdb script to include mac_learning counters
This patch updates the GDB script "ovs_show_fdb" command to include
the new per mac_learning instance counters.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-07-06 14:26:20 -07:00
Eelco Chaudron
b23d42a68d utilities: Add upcall related commands to the GDB script
This commit adds ovs_dump_udpif_keys and ovs_show_upcall commands to the GDB script.
Here are some examples of the output:

(gdb) ovs_show_upcall
netdev@ovs-netdev:
  flows         : (current 0) (avg 0) (max 0) (limit 10000)
  dump duration : 1ms
  ufid enabled  : true

  39: (keys 0)
  42: (keys 0)
  41: (keys 0)
  43: (keys 0)
  44: (keys 0)
  45: (keys 0)

system@ovs-system:
  flows         : (current 4000) (avg 4031) (max 4064) (limit 139000)
  dump duration : 4ms
  ufid enabled  : true

  99: (keys 676)
  102: (keys 665)
  101: (keys 656)
  103: (keys 648)
  104: (keys 642)
  105: (keys 713)

(gdb) ovs_dump_udpif_keys
(struct udpif *) 0x1ebb830: name = netdev@ovs-netdev, total keys = 2
(struct udpif *) 0x20c6f00: name = system@ovs-system, total keys = 0

(gdb) ovs_dump_udpif_keys 0x1ebb830
(struct umap *) 0x1ef9328:
  (struct udpif_key *) 0x7f36e0004e40: key_len = 132, mask_len = 144
                                       ufid = 3e529416-83bf-bab4-5c6e-421127a9143a
                                       hash = 0x3d96b11d, pmd_id = 1
                                       state = UKEY_OPERATIONAL
                                       n_packets = 2, n_bytes = 68
                                       used = 1397047436, tcp_flags = 0x0000
(struct umap *) 0x1efb740:
  (struct udpif_key *) 0x7f36dc004c20: key_len = 132, mask_len = 144
                                       ufid = ee98d69f-8298-04dd-844a-4d2abee9f773
                                       hash = 0x2e8077c2, pmd_id = 15
                                       state = UKEY_OPERATIONAL
                                       n_packets = 0, n_bytes = 0
                                       used = 0, tcp_flags = 0x0000

(gdb) ovs_dump_udpif_keys 0x1ebb830 short
(struct umap *) 0x1ef9328:
  (struct udpif_key *) 0x7f36e0004e40:
(struct umap *) 0x1efb740:
  (struct udpif_key *) 0x7f36dc004c20:

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-07-06 14:18:21 -07:00
Eelco Chaudron
ef557e2c55 utilities: Add the ovs_show_fdb command to gdb
This adds the ovs_show_fdb command:

  Usage: ovs_show_fdb {<bridge_name> {dbg} {hash}}

  <bridge_name> : Optional bridge name, if not supplied FDB summary
                  information is displayed for all bridges.
  dbg           : Will show structure address information
  hash          : Will display the forwarding table using the hash
                  table, rather than the rlu list.

Some examples:

  (gdb) ovs_show_fdb
  br0        : (struct mac_learning *) 0x139c160
      table.n         : 0
      secret          : 0x6c42c707
      idle_time       : 300
      max_entries     : 2048
      ref_count       : 2
      need_revalidate : false
      ports_by_ptr.n  : 0
      ports_by_usage.n: 0
  br1        : (struct mac_learning *) 0x139b0b0
      table.n         : 0
      secret          : 0xcf8efaf8
      idle_time       : 300
      max_entries     : 2048
      ref_count       : 2
      need_revalidate : false
      ports_by_ptr.n  : 0
      ports_by_usage.n: 0
  ovs_pvp_br0: (struct mac_learning *) 0x137b470
      table.n         : 4
      secret          : 0x623e75ad
      idle_time       : 300
      max_entries     : 2048
      ref_count       : 2
      need_revalidate : false
      ports_by_ptr.n  : 4
      ports_by_usage.n: 4

  (gdb) ovs_show_fdb  ovs_pvp_br0
  table.n         : 4
  secret          : 0x623e75ad
  idle_time       : 300
  max_entries     : 2048
  ref_count       : 2
  need_revalidate : false
  ports_by_ptr.n  : 4
  ports_by_usage.n: 4

  FDB "lrus" table:
  port               VLAN  MAC                Age out @
  -----------------  ----  -----------------  ---------
  02[vnet2]             0  52:54:00:b6:de:1e      81501
  01[vnet0]             0  52:54:00:0b:60:6e      81501
  03[vnet4]             0  52:54:00:89:32:4c      81501
  0LOCAL[ovs_pvp_br     0  5e:26:7b:41:28:46      81501

  Total MAC entries: 4

  Current time is between 81198 and 81203 seconds.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-06-20 10:20:06 -07:00
Eelco Chaudron
425620614f Utilities: Add the simap and netdev_provider dump commands to gdb
This changes add two additional gdb commands:

- ovs_dump_netdev_provider
- ovs_dump_ovs_list <struct simap *>

Here are some examples of their output:

ovs_dump_netdev_provider:
=========================

  (gdb) ovs_dump_netdev_provider
  (struct netdev_registered_class *) 0x2b2c540: refcnt = {count = 3},
      (struct netdev_class *) 0x9555c0 = {type = tap, is_pmd = false, ...},
  (struct netdev_registered_class *) 0x2b2c5a0: refcnt = {count = 2},
      (struct netdev_class *) 0xc439d8 = {type = vxlan, is_pmd = false, ...},
      (struct vport_class *) 0xc439d0 = { dpif_port = vxlan_sys, ... }
  (struct netdev_registered_class *) 0x2b2c960: refcnt = {count = 1},
      (struct netdev_class *) 0xc442f8 = {type = ip6erspan, is_pmd = false, ...},
      (struct vport_class *) 0xc442f0 = { dpif_port = ip6erspan_sys, ... }
  (struct netdev_registered_class *) 0x2b2c980: refcnt = {count = 1},
      (struct netdev_class *) 0xc44540 = {type = ip6gre, is_pmd = false, ...},
      (struct vport_class *) 0xc44538 = { dpif_port = ip6gre_sys, ... }
  (struct netdev_registered_class *) 0x2b2ebe0: refcnt = {count = 3},
      (struct netdev_class *) 0x95b8c0 = {type = dpdk, is_pmd = true, ...},

ovs_dump_ovs_list:
==================

  (gdb) b memory_report
  Breakpoint 1 at 0x753190: file lib/memory.c, line 136.
  (gdb) set want_report=1
  (gdb) c
  Continuing.

  Breakpoint 1, memory_report (usage=usage@entry=0x7fff0683d920) at lib/memory.c:136
  136	{
  (gdb) p usage
  $20 = (const struct simap *) 0x7fff0683d920
  (gdb) p* usage
  $21 = {map = {buckets = 0x2b64df0, one = 0x0, mask = 3, n = 4}}
  (gdb) p *usage
  (gdb) ovs_dump_simap usage
  handlers    : 40 / 0x28
  ports       : 6 / 0x6
  revalidators: 16 / 0x10
  rules       : 10 / 0xa

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-06-15 11:47:24 -07:00
Eelco Chaudron
b9683ff014 Utilities: Add the ovs_dump_dp_provider command to the gdb script
This change adds the ovs_dump_dp_provider command, which allows
dumping of all the registered registered_dpif_class structures.

In addition it has some small internal cleanups.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-06-15 11:46:41 -07:00
Eelco Chaudron
5d0a62672d utilities: Add gdb debug commands to dump lists and pmd info
Adds back-end support for walking ovs cmaps, and the following
commands to the gdb script:

- Dump all poll_thread info added to a specific struct dp_netdev*.
  Usage: ovs_dump_dp_netdev_poll_threads <struct dp_netdev *>

- Dump all nodes of an ovs_list:
    Usage: ovs_dump_ovs_list <struct ovs_list *> {[<structure>] [<member>] {dump}]}

    For example dump all the none quiescent OvS RCU threads:

      (gdb) ovs_dump_ovs_list &ovsrcu_threads
      (struct ovs_list *) 0x7f2a14000900
      (struct ovs_list *) 0x7f2acc000900
      (struct ovs_list *) 0x7f2a680668d0

    This is not very useful, so please use this with the container_of mode:

      (gdb) ovs_dump_ovs_list &ovsrcu_threads 'struct ovsrcu_perthread' list_node
      (struct ovsrcu_perthread *) 0x7f2a14000900
      (struct ovsrcu_perthread *) 0x7f2acc000900
      (struct ovsrcu_perthread *) 0x7f2a680668d0

    Now you can manually use the print command to show the content, or use the
    dump option to dump the structure for all nodes:

      (gdb) ovs_dump_ovs_list &ovsrcu_threads 'struct ovsrcu_perthread' list_node dump
      (struct ovsrcu_perthread *) 0x7f2a14000900 =
        {list_node = {prev = 0xf48e80 <ovsrcu_threads>, next = 0x7f2acc000900}, mutex...

      (struct ovsrcu_perthread *) 0x7f2acc000900 =
        {list_node = {prev = 0x7f2a14000900, next = 0x7f2a680668d0}, mutex ...

      (struct ovsrcu_perthread *) 0x7f2a680668d0 =
        {list_node = {prev = 0x7f2acc000900, next = 0xf48e80 <ovsrcu_threads>}, ...

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-05-16 15:42:51 -07:00
Eelco Chaudron
0a3348d1a9 utilities: Add some GDB macros for ovs-vswitchd
This commit adds basic GDB macro's for ovs-vswitchd:
  - ovs_dump_bridge [ports|wanted]
  - ovs_dump_bridge_ports <struct bridge *>
  - ovs_dump_dp_netdev [ports]
  - ovs_dump_dp_netdev_ports <struct dp_netdev *>
  - ovs_dump_netdev

These dump functions show limited info, but you can simply cut/paste
the address and get the full structure info. For example:

(gdb) ovs_dump_netdev
(struct netdev *) 0x555771ed89e0: name = ovs-netdev     , auto_classified = false, netdev_class = 0x5557714413c0 <netdev_tap_class>
(struct netdev *) 0x555771fc62a0: name = ovs_pvp_br0    , auto_classified = false, netdev_class = 0x5557714413c0 <netdev_tap_class>
(struct netdev *) 0x555771fc9660: name = vnet0          , auto_classified = true , netdev_class = 0x555771445e00 <netdev_linux_class>
(struct netdev *) 0x555771fc78d0: name = virbr0         , auto_classified = true , netdev_class = 0x555771445e00 <netdev_linux_class>
(struct netdev *) 0x7fbefffb5540: name = dpdk0          , auto_classified = false, netdev_class = 0x5557714419e0 <dpdk_class>
(struct netdev *) 0x555771fc98b0: name = em3            , auto_classified = true , netdev_class = 0x555771445e00 <netdev_linux_class>
(struct netdev *) 0x7fbea0a31c40: name = vhost0         , auto_classified = false, netdev_class = 0x555771442040 <dpdk_vhost_client_class>

(gdb) p *((struct netdev *) 0x7fbefffb5540)
$1 = {name = 0x555771ecef70 "dpdk0", netdev_class = 0x5557714419e0 <dpdk_class>, auto_classified = false, mtu_user_config = true, ref_cnt = 2, change_seq = 12,
  reconfigure_seq = 0x555771ecf2e0, last_reconfigure_seq = 110, n_txq = 2, n_rxq = 1, node = 0x555771efafe0, saved_flags_list = {prev = 0x7fbefffb5580, next = 0x7fbefffb5580}}

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-05-09 13:14:34 -07:00