qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 08/10] qmp: add rocker device support


From: Scott Feldman
Subject: Re: [Qemu-devel] [PATCH 08/10] qmp: add rocker device support
Date: Sun, 4 Jan 2015 13:16:13 -0800

On Fri, Jan 2, 2015 at 3:56 PM, Eric Blake <address@hidden> wrote:
> On 12/29/2014 10:14 PM, address@hidden wrote:
>> From: Scott Feldman <address@hidden>
>
> [your message came through as a top-level thread instead of in-reply-to
> the 0/10 cover letter; please see if you can fix that before the next
> submission]

Looks like I want git send-email options --no-chain-reply-to and
--thread, correct?

>>
>> Add QMP/HMP support for rocker devices.  This is mostly for debugging 
>> purposes
>> to see inside the device's tables and port configurations.  Some examples:
>>
>
> In this mail, I'll review just the QMP interface portion:
>
>> +++ b/qapi-schema.json
>> @@ -3515,3 +3515,54 @@
>>  # Since: 2.1
>>  ##
>>  { 'command': 'rtc-reset-reinjection' }
>> +
>> +{ 'type': 'Rocker',
>> +  'data': { 'name': 'str', 'id': 'uint64', 'ports': 'uint32' } }
>
> Please add documentation for each new type and each member of that type,
> including mention of which qemu release will first contain it.

Ok, v2.

>> +
>> +{ 'command': 'rocker',
>> +  'data': { 'name': 'str' },
>> +  'returns': 'Rocker' }
>> +
>> +{ 'type': 'RockerPort',
>> +  'data': { 'name': 'str', 'enabled': 'bool', 'link_up': 'bool',
>> +            'speed': 'uint32', 'duplex': 'uint8', 'autoneg': 'uint8' } }
>
> Why is 'duplex' a 'uint8'?  Shouldn't it instead be an enum type?
> Similar for 'autoneg'.

Ok, v2.

>
>> +
>> +{ 'command': 'rocker-ports',
>> +  'data': { 'name': 'str' },
>> +  'returns': ['RockerPort'] }
>> +
>> +{ 'type': 'RockerOfDpaFlowKey',
>> +  'data' : { 'priority': 'uint32', 'tbl_id': 'uint32', '*in_pport': 
>> 'uint32',
>
> Please use '-' rather than '_' in the spelling of new commands.

Ok, v2.

>> +             '*tunnel_id': 'uint32', '*vlan_id': 'uint16',
>> +             '*eth_type': 'uint16', '*eth_src': 'str', '*eth_dst': 'str',
>> +             '*ip_proto': 'uint8', '*ip_tos': 'uint8', '*ip_dst': 'str' } }
>
> Is 'str' the right type for IP addresses, or should it be a more
> specific type?

String, using dotted-decimal notation seems best for user and script
parsing.  If it's encoded as native u32 then we need to say if it's
host-byte-order or network-byte-order.

>
>> +
>> +{ 'type': 'RockerOfDpaFlowMask',
>> +  'data' : { '*in_pport': 'uint32', '*tunnel_id': 'uint32',
>> +             '*vlan_id': 'uint16', '*eth_src': 'str', '*eth_dst': 'str',
>> +             '*ip_proto': 'uint8', '*ip_tos': 'uint8' } }
>> +
>> +{ 'type': 'RockerOfDpaFlowAction',
>> +  'data' : { '*goto_tbl': 'uint32', '*group_id': 'uint32',
>> +             '*tun_log_pport': 'uint32', '*vlan_id': 'uint16',
>> +             '*new_vlan_id': 'uint16', '*out_pport': 'uint32' } }
>> +
>> +{ 'type': 'RockerOfDpaFlow',
>> +  'data': { 'cookie': 'uint64', 'hits': 'uint64', 'key': 
>> 'RockerOfDpaFlowKey',
>> +            'mask': 'RockerOfDpaFlowMask', 'action': 
>> 'RockerOfDpaFlowAction' } }
>> +
>> +{ 'command': 'rocker-of-dpa-flows',
>> +  'data': { 'name': 'str', '*tbl_id': 'uint32' },
>> +  'returns': ['RockerOfDpaFlow'] }
>
> Is the idea here that omitting 'tbl_id' (should be spelled 'tbl-id')
> will give you an array of all table entries, while specifying an id will
> give you an array of just the one requested entry?

Correct

>
>> +
>> +{ 'type': 'RockerOfDpaGroup',
>> +  'data': { 'id': 'uint32',  'type': 'uint8', '*vlan_id': 'uint16',
>> +            '*pport': 'uint32', '*index': 'uint32', '*out_pport': 'uint32',
>> +            '*group_id': 'uint32', '*set_vlan_id': 'uint16',
>> +            '*pop_vlan': 'uint8', '*group_ids': ['uint32'],
>> +            '*set_eth_src': 'str', '*set_eth_dst': 'str',
>> +            '*ttl_check': 'uint8' } }
>> +
>> +{ 'command': 'rocker-of-dpa-groups',
>> +  'data': { 'name': 'str', '*type': 'uint8' },
>> +  'returns': ['RockerOfDpaGroup'] }
>
> Needs documentation before I can tell for sure, but based on just the
> qapi specification, I think it will be reasonable once you fix naming
> conventions.

Ok.

>
>> +++ b/qmp-commands.hx
>> @@ -3860,3 +3860,27 @@ Move mouse pointer to absolute coordinates (20000, 
>> 400).
>>  <- { "return": {} }
>>
>>  EQMP
>> +
>> +    {
>> +        .name       = "rocker",
>> +        .args_type  = "name:s",
>> +        .mhandler.cmd_new = qmp_marshal_input_rocker,
>> +    },
>> +
>
> Could you also provide example exchanges for each command added (what
> the user passes in, and what qemu responds)?

Provide here or in the commit msg?  Or in the code?  Here's an example session:

(qemu) rocker sw1
name: sw1
id: 0x0000013512005452
ports: 4

(qemu) rocker-ports sw1
            ena/    speed/ auto
      port  link    duplex neg?
     sw1.1  up     10G  FD  No
     sw1.2  up     10G  FD  No
     sw1.3  !ena   10G  FD  No
     sw1.4  !ena   10G  FD  No

(qemu) rocker-of-dpa-flows sw1
prio tbl hits key(mask) --> actions
3    50  11   vlan 3840 dst 00:02:00:00:03:00 --> write group
0x0f000002 goto tbl 60
3    50  13   vlan 3840 dst 00:02:00:00:02:00 --> write group
0x0f000001 goto tbl 60
1    30       IP dst 11.0.0.0/32 --> write group 0x0f000000 goto tbl 60
1    30       IP dst 11.0.0.0/24 --> write group 0x0f000000 goto tbl 60
1    30       IP dst 11.0.0.255/32 --> write group 0x0f000000 goto tbl 60
1    30  10   IP dst 11.0.0.3/32 --> write group 0x0f000000 goto tbl 60
0    20       pport 2 vlan 3840 IPv6 dst 52:54:00:12:35:02 --> goto tbl 30
0    20       pport 2 vlan 3840 IP dst 52:54:00:12:35:02 --> goto tbl 30
1    20  8    pport 2 vlan 3840 IPv6 dst
33:33:00:00:00:00(ff:ff:00:00:00:00) --> goto tbl 40
1    20       pport 2 vlan 3840 IP dst
01:00:5e:00:00:00(ff:ff:ff:80:00:00) --> goto tbl 40
3    60  7366 pport 2 vlan 3840 dst
01:80:c2:00:00:00(ff:ff:ff:ff:ff:f0) --> write group 0x0f000000
0    20       pport 1 vlan 3840 IPv6 dst 52:54:00:12:35:01 --> goto tbl 30
0    20  10   pport 1 vlan 3840 IP dst 52:54:00:12:35:01 --> goto tbl 30
1    50  14735 vlan 3840 --> write group 0x4f000000 goto tbl 60
1    20  8    pport 1 vlan 3840 IPv6 dst
33:33:00:00:00:00(ff:ff:00:00:00:00) --> goto tbl 40
1    20       pport 1 vlan 3840 IP dst
01:00:5e:00:00:00(ff:ff:ff:80:00:00) --> goto tbl 40
3    60  7366 pport 1 vlan 3840 dst
01:80:c2:00:00:00(ff:ff:ff:ff:ff:f0) --> write group 0x0f000000
1    10  7387 pport 2 vlan 0 --> apply new vlan 3840 goto tbl 20
1    10  7398 pport 1 vlan 0 --> apply new vlan 3840 goto tbl 20
1    0   14785 pport 0(0xffff0000) --> goto tbl 10

(qemu) rocker-of-dpa-flows sw1 10
prio tbl hits key(mask) --> actions
1    10  7387 pport 2 vlan 0 --> apply new vlan 3840 goto tbl 20
1    10  7398 pport 1 vlan 0 --> apply new vlan 3840 goto tbl 20

(qemu) rocker-of-dpa-flows sw1 20
prio tbl hits key(mask) --> actions
0    20       pport 2 vlan 3840 IPv6 dst 52:54:00:12:35:02 --> goto tbl 30
0    20       pport 2 vlan 3840 IP dst 52:54:00:12:35:02 --> goto tbl 30
1    20  8    pport 2 vlan 3840 IPv6 dst
33:33:00:00:00:00(ff:ff:00:00:00:00) --> goto tbl 40
1    20       pport 2 vlan 3840 IP dst
01:00:5e:00:00:00(ff:ff:ff:80:00:00) --> goto tbl 40
0    20       pport 1 vlan 3840 IPv6 dst 52:54:00:12:35:01 --> goto tbl 30
0    20  10   pport 1 vlan 3840 IP dst 52:54:00:12:35:01 --> goto tbl 30
1    20  8    pport 1 vlan 3840 IPv6 dst
33:33:00:00:00:00(ff:ff:00:00:00:00) --> goto tbl 40
1    20       pport 1 vlan 3840 IP dst
01:00:5e:00:00:00(ff:ff:ff:80:00:00) --> goto tbl 40

(qemu) rocker-of-dpa-groups sw1
id (decode) --> buckets
0x0f000002 (type L2 interface vlan 3840 pport 2) --> pop vlan out pport 2
0x0f000001 (type L2 interface vlan 3840 pport 1) --> pop vlan out pport 1
0x4f000000 (type L2 flood vlan 3840 index 0) --> groups [0x0f000002,0x0f000001]
0x0f000000 (type L2 interface vlan 3840 pport 0) --> pop vlan out pport 0

(qemu) rocker-of-dpa-groups sw1 0
id (decode) --> buckets
0x0f000002 (type L2 interface vlan 3840 pport 2) --> pop vlan out pport 2
0x0f000001 (type L2 interface vlan 3840 pport 1) --> pop vlan out pport 1
0x0f000000 (type L2 interface vlan 3840 pport 0) --> pop vlan out pport 0

(qemu) rocker-of-dpa-groups sw1 4
id (decode) --> buckets
0x4f000000 (type L2 flood vlan 3840 index 0) --> groups [0x0f000002,0x0f000001]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]