On 12/23/22 10:24, Eelco Chaudron wrote:
> 
> 
> On 22 Dec 2022, at 17:14, Adrian Moreno wrote:
> 
>> On 12/22/22 10:12, Eelco Chaudron wrote:
>>> This patch adds the dpif_nl_exec_monitor.py script that will used the
>>> existing dpif_netlink_operate__:op_flow_execute USDT probe to show
>>> all DPIF_OP_EXECUTE operations being queued for transmission over
>>> the netlink interface.
>>>
>>> Here is an example, truncated output:
>>>
>>> # ./dpif_nl_exec_monitor.py --packet-decode decode
>>> Display DPIF_OP_EXECUTE operations being queued for transmission...
>>> TIME               CPU  COMM             PID        NL_SIZE
>>> 3124.516679897     1    ovs-vswitchd     8219       180
>>>      nlmsghdr  : len = 0, type = 36, flags = 1, seq = 0, pid = 0
>>>      genlmsghdr: cmd = 3, version = 1, reserver = 0
>>>      ovs_header: dp_ifindex = 21
>>>        > Decode OVS_PACKET_ATTR_* TLVs:
>>>        nla_len 46, nla_type OVS_PACKET_ATTR_PACKET[1], data: 00 00 00...
>>>        nla_len 20, nla_type OVS_PACKET_ATTR_KEY[2], data: 08 00 02 00...
>>>            > Decode OVS_KEY_ATTR_* TLVs:
>>>            nla_len 8, nla_type OVS_KEY_ATTR_PRIORITY[2], data: 00 00...
>>>            nla_len 8, nla_type OVS_KEY_ATTR_SKB_MARK[15], data: 00 00...
>>>        nla_len 88, nla_type OVS_PACKET_ATTR_ACTIONS[3], data: 4c 00 03...
>>>            > Decode OVS_ACTION_ATTR_* TLVs:
>>>            nla_len 76, nla_type OVS_ACTION_ATTR_SET[3], data: 48 00...
>>>                    > Decode OVS_TUNNEL_KEY_ATTR_* TLVs:
>>>                    nla_len 12, nla_type OVS_TUNNEL_KEY_ATTR_ID[0], data:...
>>>                    nla_len 20, nla_type OVS_TUNNEL_KEY_ATTR_IPV6_DST[13], 
>>> ...
>>>                    nla_len 5, nla_type OVS_TUNNEL_KEY_ATTR_TTL[4], data: 40
>>>                    nla_len 4, nla_type 
>>> OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT[5]...
>>>                    nla_len 4, nla_type OVS_TUNNEL_KEY_ATTR_CSUM[6], data:
>>>                    nla_len 6, nla_type OVS_TUNNEL_KEY_ATTR_TP_DST[10],...
>>>                    nla_len 12, nla_type 
>>> OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS[8],...
>>>            nla_len 8, nla_type OVS_ACTION_ATTR_OUTPUT[1], data: 02 00 00 00
>>>        - Dumping OVS_PACKET_ATR_PACKET data:
>>>        ###[ Ethernet ]###
>>>          dst       = 00:00:00:00:ec:01
>>>          src       = 04:f4:bc:28:57:00
>>>          type      = IPv4
>>>        ###[ IP ]###
>>>             version   = 4
>>>             ihl       = 5
>>>             tos       = 0x0
>>>             len       = 50
>>>             id        = 0
>>>             flags     =
>>>             frag      = 0
>>>             ttl       = 127
>>>             proto     = icmp
>>>             chksum    = 0x2767
>>>             src       = 10.0.0.1
>>>             dst       = 10.0.0.100
>>>             \options   \
>>>        ###[ ICMP ]###
>>>                type      = echo-request
>>>                code      = 0
>>>                chksum    = 0xf7f3
>>>                id        = 0x0
>>>                seq       = 0xc
>>>
>>> Signed-off-by: Eelco Chaudron <echau...@redhat.com>
>>> ---
>>>   v2: Added script to usdt_SCRIPTS
>>>
>>>   Documentation/topics/usdt-probes.rst           |    1
>>>   utilities/automake.mk                          |    3
>>>   utilities/usdt-scripts/dpif_nl_exec_monitor.py |  662 
>>> ++++++++++++++++++++++++
>>>   3 files changed, 666 insertions(+)
>>>   create mode 100755 utilities/usdt-scripts/dpif_nl_exec_monitor.py
>>>
>>
>> Hi Eelco,
>>
>> My only comment is that it'd be nice to have that netlink decoding part in 
>> some common library that more usdt scripts or python programs could use. But 
>> I guess we can move it once ther's another user of it.
> 
> Thanks for the review Adrian! Yes, I think it would be good to extract this 
> functionality later when we need it again in one of those scripts. Probably 
> using a more pythonic way, i.e. creating some iterator object.
> 
> Cheers,
> 
> Eelco
> 
>> Otherwise, I've tested the script and works as expected. The code itself 
>> looks good to me.
>>
>> Acked-by: Adrian Moreno <amore...@redhat.com>

Thanks!  Applied.

Factoring out and autogenerating some of the parts in the future
would be nice indeed.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to