Message ID | 1504876813-105276-1-git-send-email-michalx.weglicki@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev,v3,1/2] netdev-dpdk: extend netdev_dpdk_get_status to include if_type and if_descr | expand |
How about the following: @@ -36,6 +36,7 @@ #include <rte_meter.h> #include <rte_pci.h> #include <rte_vhost.h> +#include <rte_version.h> @@ -2446,6 +2452,11 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) dev_info.max_hash_mac_addrs); smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs); smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools); ======= /* Querying the DPDK library for iftype may be done in future, pending * support. */ /* Cf. RFC 3635 Section 3.2.4. */ enum { IF_TYPE_ETHERNETCSMACD = 6 }; ======= + smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD); + smap_add_format(args, "if_descr", "%s %s", rte_version(), + dev_info.driver_name); On 9/8/17, 6:34 AM, "ovs-dev-bounces@openvswitch.org on behalf of Michal Weglicki" <ovs-dev-bounces@openvswitch.org on behalf of michalx.weglicki@intel.com> wrote: This commit extends netdev_dpdk_get_status API to include additional driver-related information: if_type and if_descr. Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com> Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com> --- v2-v3: Code rebase. --- lib/netdev-dpdk.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index f58e9be..14301dc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -36,6 +36,7 @@ #include <rte_meter.h> #include <rte_pci.h> #include <rte_vhost.h> +#include <rte_version.h> #include "dirs.h" #include "dp-packet.h" @@ -156,6 +157,11 @@ typedef uint8_t dpdk_port_t; #define VHOST_ENQ_RETRY_NUM 8 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ) +/* ifType value '6' is used for all ethernet-like interfaces, regardless of +* speed or link-layer encapsulation in use. +* Cf. IETF RFC 3635 Section 3.2.4. */ +#define IF_TYPE_ETHERNETCSMACD 6 + static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, @@ -2446,6 +2452,11 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) dev_info.max_hash_mac_addrs); smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs); smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools); + /* Once DPDK library supports retrieving ifType we should get this value + * directly from DPDK rather than hardcoding it. */ + smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD); + smap_add_format(args, "if_descr", "%s %s", rte_version(), + dev_info.driver_name); if (dev_info.pci_dev) { smap_add_format(args, "pci-vendor_id", "0x%u", -- 1.8.3.1 _______________________________________________ dev mailing list dev@openvswitch.org https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=mzPk72XPh5DMQP718WGkfJyABk7v8l6-ICkSwJPMdXc&s=57vGNby8qkBTC1W9azcwz-V08AEBZ87wRopA7ukIMeA&e=
Further compressing the comment: On 9/15/17, 4:50 PM, "Darrell Ball" <dball@vmware.com> wrote: How about the following: @@ -36,6 +36,7 @@ #include <rte_meter.h> #include <rte_pci.h> #include <rte_vhost.h> +#include <rte_version.h> @@ -2446,6 +2452,11 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) dev_info.max_hash_mac_addrs); smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs); smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools); ======= /* Querying the DPDK library for iftype may be done in future, pending * support; cf. RFC 3635 Section 3.2.4. */ enum { IF_TYPE_ETHERNETCSMACD = 6 }; ======= + smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD); + smap_add_format(args, "if_descr", "%s %s", rte_version(), + dev_info.driver_name); On 9/8/17, 6:34 AM, "ovs-dev-bounces@openvswitch.org on behalf of Michal Weglicki" <ovs-dev-bounces@openvswitch.org on behalf of michalx.weglicki@intel.com> wrote: This commit extends netdev_dpdk_get_status API to include additional driver-related information: if_type and if_descr. Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com> Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com> --- v2-v3: Code rebase. --- lib/netdev-dpdk.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index f58e9be..14301dc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -36,6 +36,7 @@ #include <rte_meter.h> #include <rte_pci.h> #include <rte_vhost.h> +#include <rte_version.h> #include "dirs.h" #include "dp-packet.h" @@ -156,6 +157,11 @@ typedef uint8_t dpdk_port_t; #define VHOST_ENQ_RETRY_NUM 8 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ) +/* ifType value '6' is used for all ethernet-like interfaces, regardless of +* speed or link-layer encapsulation in use. +* Cf. IETF RFC 3635 Section 3.2.4. */ +#define IF_TYPE_ETHERNETCSMACD 6 + static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, @@ -2446,6 +2452,11 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) dev_info.max_hash_mac_addrs); smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs); smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools); + /* Once DPDK library supports retrieving ifType we should get this value + * directly from DPDK rather than hardcoding it. */ + smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD); + smap_add_format(args, "if_descr", "%s %s", rte_version(), + dev_info.driver_name); if (dev_info.pci_dev) { smap_add_format(args, "pci-vendor_id", "0x%u", -- 1.8.3.1 _______________________________________________ dev mailing list dev@openvswitch.org https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=mzPk72XPh5DMQP718WGkfJyABk7v8l6-ICkSwJPMdXc&s=57vGNby8qkBTC1W9azcwz-V08AEBZ87wRopA7ukIMeA&e=
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index f58e9be..14301dc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -36,6 +36,7 @@ #include <rte_meter.h> #include <rte_pci.h> #include <rte_vhost.h> +#include <rte_version.h> #include "dirs.h" #include "dp-packet.h" @@ -156,6 +157,11 @@ typedef uint8_t dpdk_port_t; #define VHOST_ENQ_RETRY_NUM 8 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ) +/* ifType value '6' is used for all ethernet-like interfaces, regardless of +* speed or link-layer encapsulation in use. +* Cf. IETF RFC 3635 Section 3.2.4. */ +#define IF_TYPE_ETHERNETCSMACD 6 + static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, @@ -2446,6 +2452,11 @@ netdev_dpdk_get_status(const struct netdev *netdev, struct smap *args) dev_info.max_hash_mac_addrs); smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs); smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools); + /* Once DPDK library supports retrieving ifType we should get this value + * directly from DPDK rather than hardcoding it. */ + smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD); + smap_add_format(args, "if_descr", "%s %s", rte_version(), + dev_info.driver_name); if (dev_info.pci_dev) { smap_add_format(args, "pci-vendor_id", "0x%u",