All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Amos Kong <akong@redhat.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
	lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 2/2] net: introduce command to query rx-filter information
Date: Thu, 23 May 2013 06:14:19 -0600	[thread overview]
Message-ID: <519E081B.3090000@redhat.com> (raw)
In-Reply-To: <1369300080-31377-3-git-send-email-akong@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4673 bytes --]

On 05/23/2013 03:08 AM, Amos Kong wrote:
> We want to implement mac programming over macvtap through Libvirt,
> related rx-filter configuration contains main mac, some of rx-mode
> and mac-table.
> 
> The previous patch adds QMP event to notify management of rx-filter
> change. This patch adds a monitor command to query rx-filter
> information.
> 
> A flag is used to avoid events flooding, if user don't query

s/don't/doesn't/

> rx-filter after receives one event, new events won't be sent

s/after/after it/

> to qmp monitor.
> 
> +++ b/net/net.c
> @@ -961,6 +961,53 @@ void print_net_client(Monitor *mon, NetClientState *nc)
>                     nc->info_str);
>  }
>  
> +RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
> +                                      Error **errp)
> +{
> +    NetClientState *nc;
> +    RxFilterInfoList *filter_list = NULL, *last_entry = NULL;
> +
> +    QTAILQ_FOREACH(nc, &net_clients, next) {
> +        RxFilterInfoList *entry;
> +        RxFilterInfo *info;
> +
> +        if (nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC) {
> +            continue;
> +        }
> +        if (has_name && strcmp(nc->name, name) != 0) {

Do you need the has_name argument here, or can you ensure that the
caller passes NULL when the caller's has_name was false, for one less
parameter and the same amount of information?

> +++ b/qapi-schema.json
> @@ -3619,3 +3619,76 @@
>              '*cpuid-input-ecx': 'int',
>              'cpuid-register': 'X86CPURegister32',
>              'features': 'int' } }
> +
> +##
> +# @RxState:
> +#
> +# Packets receiving state
> +#
> +# @normal: filter assigned packets according to the mac-table
> +#
> +# @no: don't receive any assigned packet
> +#
> +# @all: receive all assigned packets
> +#
> +##
> +{ 'enum': 'RxState', 'data': [ 'normal', 'no', 'all' ] }

I think s/no/none/ would make slightly more sense (usually, you pair
no/yes and none/all, not no/all).

> +
> +##
> +# @RxFilterInfo:
> +#
> +# Rx-filter information for a net client, it contains main mac, some
> +# of rx-mode items and mac-table.
> +#
> +# @name: net client name
> +#
> +# @promiscuous: whether to ether promiscuous mode

s/to ether//; s/$/is enabled/

> +#
> +# @multicast: multicast receive state
> +#
> +# @unicast: unicast receive state
> +#
> +# @broadcast-allowed: whether to receive broadcast
> +#
> +# @multicast-overflow: multicast table is overflow or not
> +#
> +# @unicast-overflow: unicast table is overflow or not
> +#
> +# @main-mac: the main macaddr string
> +#
> +# @unicast-table: a list of unicast macaddr string
> +#
> +# @multicast-table: a list of multicast macaddr string

Naming is reasonable; thanks for improving things from v1.

> +#
> +# Since 1.6
> +##
> +
> +{ 'type': 'RxFilterInfo',
> +  'data': {
> +    'name':               'str',
> +    'promiscuous':        'bool',
> +    'multicast':          'RxState',
> +    'unicast':            'RxState',
> +    'broadcast-allowed':  'bool',
> +    'multicast-overflow': 'bool',
> +    'unicast-overflow':   'bool',
> +    'main-mac':           'str',
> +    'unicast-table':      ['str'],
> +    'multicast-table':    ['str'] }}
> +
> +##
> +# @query-rx-filter:
> +#
> +# Return rx-filter information for all nics (or for the given nic).
> +#
> +# @name: #optional net client name
> +#
> +# Returns: list of @RxFilterInfo for all nics (or for the given nic).
> +#          Returns an error if the given @name doesn't exist, or given
> +#          nic doesn't support rx-filter querying, or no net client
> +#          supports rx-filter querying
> +#
> +# Since: 1.6
> +##
> +{ 'command': 'query-rx-filter', 'data': { '*name': 'str' },
> +  'returns': ['RxFilterInfo'] }

Interface looks reasonable.  I didn't check the code closely, but agree
with Michael's assessment that the event-suppression flag has to be
per-device, not global.

> +
> +Each array entry contains the following:
> +
> +- "name": net client name (jaso-string)
> +- "promiscuous": enter promiscuous mode (json-bool)
> +- "multicast": multicast receive state (one of 'normal', 'no', 'all')
> +- "unicast": unicast receive state  (one of 'normal', 'no', 'all')
> +- "broadcast-allowed": allow to receive broadcast (json-bool)
> +- "multicast-overflow": multicast table is overflow (json-bool)

s/is overflow/overflowed/

> +- "unicast-overflow": unicast table is overflow (json-bool)

and again

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  parent reply	other threads:[~2013-05-23 12:14 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23  9:07 [Qemu-devel] [PATCH v3 0/2] mac programming over macvtap Amos Kong
2013-05-23  9:07 ` [Qemu-devel] [PATCH v3 1/2] net: introduce RX_FILTER_CHANGED event Amos Kong
2013-05-23 10:24   ` Michael S. Tsirkin
2013-05-23 14:28     ` Luiz Capitulino
2013-05-23 14:43       ` Michael S. Tsirkin
2013-05-23 14:52         ` Eric Blake
2013-05-23 14:57           ` Michael S. Tsirkin
2013-05-23 15:33             ` Luiz Capitulino
2013-05-24  3:20               ` Amos Kong
2013-05-23 12:01   ` Eric Blake
2013-06-26  6:54     ` Markus Armbruster
2013-06-26 13:53       ` Luiz Capitulino
2013-05-23  9:08 ` [Qemu-devel] [PATCH v3 2/2] net: introduce command to query rx-filter information Amos Kong
2013-05-23 10:23   ` Michael S. Tsirkin
2013-05-24  4:53     ` Amos Kong
2013-05-23 12:14   ` Eric Blake [this message]
2013-05-24  3:03     ` Amos Kong
2013-06-26  7:14     ` Markus Armbruster
2013-05-23 16:03   ` Luiz Capitulino
2013-05-24  3:08     ` Amos Kong
2013-05-24 12:23       ` Luiz Capitulino
2013-05-24 12:55         ` Eric Blake
2013-05-24 13:08           ` Luiz Capitulino
2013-05-24 13:23             ` Eric Blake
2013-06-26  9:35               ` Markus Armbruster
2013-05-24 15:20           ` Markus Armbruster
2013-05-24 16:12             ` Michael S. Tsirkin
2013-05-24 18:05               ` Eric Blake
2013-05-24 20:00                 ` Luiz Capitulino
2013-05-26  7:38                   ` Michael S. Tsirkin
2013-05-27  8:36                     ` Stefan Hajnoczi
2013-06-26  9:54   ` Markus Armbruster
2013-06-26 12:00     ` Markus Armbruster
2013-06-26 14:02       ` Luiz Capitulino
2013-06-26 14:15         ` Markus Armbruster
2013-06-28 14:04           ` Eric Blake
2013-06-28 17:27             ` Markus Armbruster
2013-07-01  3:24               ` Amos Kong
2013-07-02  6:33     ` Amos Kong
2013-07-02  9:05       ` Markus Armbruster
2013-07-02 10:40         ` Amos Kong
2013-07-02 13:27           ` Markus Armbruster
2013-07-04  3:31             ` Amos Kong
2013-07-04  6:28               ` Markus Armbruster
2013-07-11 14:05                 ` Amos Kong
2013-07-12  6:32                   ` Markus Armbruster
2013-07-12  7:07                     ` Amos Kong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=519E081B.3090000@redhat.com \
    --to=eblake@redhat.com \
    --cc=akong@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.