On Wed, Jan 17, 2018 at 11:44:08AM +0000, Stokes, Ian wrote:
> > -----Original Message-----
> > From: [email protected] [mailto:ovs-dev-
> > [email protected]] On Behalf Of Flavio Leitner
> > Sent: Tuesday, January 16, 2018 4:22 AM
> > To: [email protected]
> > Subject: [ovs-dev] [PATCH v2] netdev-dpdk: add vhost-user get_status.
> >
> > Expose relevant vhost-user information in status.
> >
>
> Thanks for this Flavio, very useful feature.
:-)
> Just a query, when status update is called, I assume it updates the OVSDB?
It's the bridge that fetches the device's status and push to ovsdb.
bridge_run()
+- run_status_update()
+- iface_refresh_netdev_status()
[...]
if (!netdev_get_status(iface->netdev, &smap)) {
ovsrec_interface_set_status(iface->cfg, &smap);
> Is there any command a user can use to get this info in one query?
ovs-vsctl get Interface <iface> status
Is that what you are looking for?
fbl
>
> For example some of this info is contained when a user calls ovs-ctl list
> interface 'vhostuser-interface'.
>
> I looked at the docs but I didn't see any ovs-ctl or ovs-appctl command that
> returned all the info gathered here in one place?
>
> Ian
> > Signed-off-by: Flavio Leitner <[email protected]>
> > ---
> > NEWS | 1 +
> > lib/netdev-dpdk.c | 62
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++--
> > 2 files changed, 61 insertions(+), 2 deletions(-)
> >
> > Changelog:
> > V2 - Dropped the custom appctl command in favor of get_status.
> >
> > diff --git a/NEWS b/NEWS
> > index cb020d00d..2bf0bde82 100644
> > --- a/NEWS
> > +++ b/NEWS
> > @@ -47,6 +47,7 @@ Post-v2.8.0
> > * Configuring a controller, or unconfiguring all controllers, now
> > deletes
> > all groups and meters (as well as all flows).
> > - New --enable-sparse configure option enables "sparse" checking by
> > default.
> > + - Added additional information to vhost-user status.
> >
> > v2.8.0 - 31 Aug 2017
> > --------------------
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index
> > e32c7f678..cbf4a9c0a 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -2614,6 +2614,64 @@ netdev_dpdk_update_flags(struct netdev *netdev,
> > return error;
> > }
> >
> > +static int
> > +netdev_dpdk_vhost_user_get_status(const struct netdev *netdev,
> > + struct smap *args) {
> > + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
> > +
> > + ovs_mutex_lock(&dev->mutex);
> > +
> > + bool client_mode = dev->vhost_driver_flags & RTE_VHOST_USER_CLIENT;
> > + smap_add_format(args, "mode", "%s", client_mode ? "client" :
> > + "server");
> > +
> > + int vid = netdev_dpdk_get_vid(dev);
> > + if (vid < 0) {
> > + smap_add_format(args, "status", "disconnected");
> > + ovs_mutex_unlock(&dev->mutex);
> > + return 0;
> > + } else {
> > + smap_add_format(args, "status", "connected");
> > + }
> > +
> > + char socket_name[PATH_MAX];
> > + if (!rte_vhost_get_ifname(vid, socket_name, PATH_MAX)) {
> > + smap_add_format(args, "socket", "%s", socket_name);
> > + }
> > +
> > + uint64_t features;
> > + if (!rte_vhost_get_negotiated_features(vid, &features)) {
> > + smap_add_format(args, "features", "0x%016"PRIx64, features);
> > + }
> > +
> > + uint16_t mtu;
> > + if (!rte_vhost_get_mtu(vid, &mtu)) {
> > + smap_add_format(args, "mtu", "%d", mtu);
> > + }
> > +
> > + int numa = rte_vhost_get_numa_node(vid);
> > + if (numa >= 0) {
> > + smap_add_format(args, "numa", "%d", numa);
> > + }
> > +
> > + uint16_t vring_num = rte_vhost_get_vring_num(vid);
> > + if (vring_num) {
> > + smap_add_format(args, "num_of_vrings", "%d", vring_num);
> > + }
> > +
> > + for (int i = 0; i < vring_num; i++) {
> > + struct rte_vhost_vring vring;
> > + char vhost_vring[16];
> > +
> > + rte_vhost_get_vhost_vring(vid, i, &vring);
> > + snprintf(vhost_vring, 16, "vring_%d_size", i);
> > + smap_add_format(args, vhost_vring, "%d", vring.size);
> > + }
> > +
> > + ovs_mutex_unlock(&dev->mutex);
> > + return 0;
> > +}
> > +
> > static int
> > netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) {
> > @@ -3698,7 +3756,7 @@ static const struct netdev_class dpdk_vhost_class =
> > netdev_dpdk_vhost_get_stats,
> > NULL,
> > NULL,
> > - NULL,
> > + netdev_dpdk_vhost_user_get_status,
> > netdev_dpdk_vhost_reconfigure,
> > netdev_dpdk_vhost_rxq_recv);
> > static const struct netdev_class dpdk_vhost_client_class = @@ -3714,7
> > +3772,7 @@ static const struct netdev_class dpdk_vhost_client_class =
> > netdev_dpdk_vhost_get_stats,
> > NULL,
> > NULL,
> > - NULL,
> > + netdev_dpdk_vhost_user_get_status,
> > netdev_dpdk_vhost_client_reconfigure,
> > netdev_dpdk_vhost_rxq_recv);
> >
> > --
> > 2.14.3
> >
> >
> > _______________________________________________
> > dev mailing list
> > [email protected]
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
--
Flavio
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev