netvsc changes for 18.11
Subsystems (2)
cover netvsc changes for 18.11
These patches are against dpdk-net-next/master because that is where previous patches have already been merged.
Stephen Hemminger (5):
bus/vmbus: add devargs support
net/netvsc: allow tuning latency with devargs net/netvsc: exhausting transmit descriptors is not an error net/netvsc: implement link state change callback net/netvsc: integrated VF support
devtools/checkpatches.sh | 2 +- doc/guides/nics/netvsc.rst | 31 +- doc/guides/rel_notes/release_18_11.rst | 14 +- drivers/bus/vmbus/linux/vmbus_bus.c | 2 + drivers/bus/vmbus/private.h | 3 + drivers/bus/vmbus/vmbus_common.c | 22 +- drivers/net/netvsc/Makefile | 1 + drivers/net/netvsc/hn_ethdev.c | 188 +++++++-- drivers/net/netvsc/hn_nvs.c | 11 +- drivers/net/netvsc/hn_nvs.h | 9 + drivers/net/netvsc/hn_rndis.c | 42 +- drivers/net/netvsc/hn_rndis.h | 3 +- drivers/net/netvsc/hn_rxtx.c | 144 ++++--- drivers/net/netvsc/hn_var.h | 48 ++- drivers/net/netvsc/hn_vf.c | 512 +++++++++++++++++++++++++ drivers/net/netvsc/meson.build | 2 +- 16 files changed, 924 insertions(+), 110 deletions(-) create mode 100644 drivers/net/netvsc/hn_vf.c
Signature · 1 line
2.18.0
PATCH 1/5 bus/vmbus: add devargs support
From: Stephen Hemminger <[email protected]>
Take device arguments from command line and put
them in the device devargs.
--- drivers/bus/vmbus/linux/vmbus_bus.c | 2 ++ drivers/bus/vmbus/private.h | 3 +++ drivers/bus/vmbus/vmbus_common.c | 22 +++++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-)
drivers/bus/vmbus/linux/vmbus_bus.c +2 -0
@@ -276,6 +276,8 @@ vmbus_scan_one(const char *name) dev->device.numa_node =SOCKET_ID_ANY ; } + dev->device.devargs =vmbus_devargs_lookup (dev); +/* device is valid, add in list (sorted) */ VMBUS_LOG (DEBUG ,"Adding vmbus device %s" , name);
drivers/bus/vmbus/private.h +3 -0
@@ -66,6 +66,9 @@ struct vmbus_channel {#define VMBUS_MAX_CHANNELS 64 +struct rte_devargs * +vmbus_devargs_lookup (struct rte_vmbus_device *dev); +int vmbus_chan_create (const struct rte_vmbus_device *device,uint16_t relid,uint16_t subid,uint8_t monitor_id,struct vmbus_channel **new_chan);
drivers/bus/vmbus/vmbus_common.c +21 -1
@@ -85,7 +85,6 @@ vmbus_match(const struct rte_vmbus_driver *dr,return false; } -/* * If device ID match, call the devinit() function of the driver. */
@@ -204,6 +203,27 @@ vmbus_parse(const char *name, void *addr)return ret; } +/* +* scan for matching device args on command line +* example: +* -w 'vmbus(635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20)' +*/ +struct rte_devargs * +vmbus_devargs_lookup (struct rte_vmbus_device *dev) +{ +struct rte_devargs *devargs; +rte_uuid_t addr; + + RTE_EAL_DEVARGS_FOREACH("vmbus", devargs) { +vmbus_parse (devargs->name, &addr); + +if (rte_uuid_compare (dev->device_id, addr) ==0 ) +return devargs; + } +return NULL ; + +} +/* register vmbus driver */ void rte_vmbus_register (struct rte_vmbus_driver *driver)
Signature · 1 line
2.18.0
Re: [PATCH 1/5] bus/vmbus: add devargs support
Quoted 6 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Take device arguments from command line and put
them in the device devargs.Signed-off-by Stephen Hemminger <[email protected]>
<...>
drivers/bus/vmbus/vmbus_common.c vmbus_parse(const char *name, void *addr) · line 209
Quoted 8 lines
drivers/bus/vmbus/vmbus_common.c +4
-0@@ -204,6 +203,27 @@ vmbus_parse(const char *name, void *addr)return ret; } +/* +* scan for matching device args on command line +* example: +* -w 'vmbus(635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20)'
This is just in comment but,
I guess latest syntax is:
-w "vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20"
@Gaetan, is latest devarg syntax documented somewhere?
Re: [PATCH 1/5] bus/vmbus: add devargs support
Hi,
Quoted 21 lines · Ferruh Yigit
Quoted 6 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Take device arguments from command line and put
them in the device devargs.Signed-off-by Stephen Hemminger <[email protected]><...>
drivers/bus/vmbus/vmbus_common.c vmbus_parse(const char *name, void *addr) · line 209
Quoted 8 lines
drivers/bus/vmbus/vmbus_common.c +4
-0@@ -204,6 +203,27 @@ vmbus_parse(const char *name, void *addr)return ret; } +/* +* scan for matching device args on command line +* example: +* -w 'vmbus(635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20)' This is just in comment but,
Quoted 4 lines
I guess latest syntax is:
-w "vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20"@Gaetan, is latest devarg syntax documented somewhere?
That's the current syntax indeed. Some documentation is found at
lib/librte_eal/common/include/rte_devargs.h:100
Where it is specified that the bus name can be either omitted or followed by any character, to separate it from the device identifier.
This means that using ':' is fine, as well as '('. As long as the device PMD afterward ignore the dangling ')' during devargs parsing, this should be fine.
I don't think this is very clean, but it works.
Signature · 2 lines
Gaëtan Rivet 6WIND
Re: [PATCH 1/5] bus/vmbus: add devargs support
Quoted 33 lines · Gaëtan Rivet
Hi,
Quoted 21 lines · Ferruh Yigit
Quoted 6 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Take device arguments from command line and put
them in the device devargs.Signed-off-by Stephen Hemminger <[email protected]><...>
drivers/bus/vmbus/vmbus_common.c vmbus_parse(const char *name, void *addr) · line 209
Quoted 8 lines
drivers/bus/vmbus/vmbus_common.c +4
-0@@ -204,6 +203,27 @@ vmbus_parse(const char *name, void *addr)return ret; } +/* +* scan for matching device args on command line +* example: +* -w 'vmbus(635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20)' This is just in comment but,
Quoted 4 lines
I guess latest syntax is:
-w "vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20"@Gaetan, is latest devarg syntax documented somewhere?
That's the current syntax indeed. Some documentation is found at
lib/librte_eal/common/include/rte_devargs.h:100
Quoted 8 lines
Where it is specified that the bus name can be either omitted or followed by any character, to separate it from the device identifier.
This means that using ':' is fine, as well as '('. As long as the device PMD afterward ignore the dangling ')' during devargs parsing, this should be fine.
I don't think this is very clean, but it works.
Thanks for the info, I see how "(" works, but ")" is takes as part of argument and causing problem, I think better to not give "()" as supported syntax at all.
btw, now both -w and --vdev are valid and can be used interchangeably, right? I mean all following are valid?
-w pci:0000:86:06.0,enable_floating_veb=1
-w vdev:net_pcap,iface=lo
--vdev pci:0000:86:06.0,enable_floating_veb=1
--vdev vdev:net_pcap,iface=lo
Re: [PATCH 1/5] bus/vmbus: add devargs support
Quoted 50 lines · Ferruh Yigit
Quoted 33 lines · Gaëtan Rivet
Hi,
Quoted 21 lines · Ferruh Yigit
Quoted 6 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Take device arguments from command line and put
them in the device devargs.Signed-off-by Stephen Hemminger <[email protected]><...>
drivers/bus/vmbus/vmbus_common.c vmbus_parse(const char *name, void *addr) · line 209
Quoted 8 lines
drivers/bus/vmbus/vmbus_common.c +4
-0@@ -204,6 +203,27 @@ vmbus_parse(const char *name, void *addr)return ret; } +/* +* scan for matching device args on command line +* example: +* -w 'vmbus(635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20)' This is just in comment but,
Quoted 4 lines
I guess latest syntax is:
-w "vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20"@Gaetan, is latest devarg syntax documented somewhere?
That's the current syntax indeed. Some documentation is found at
lib/librte_eal/common/include/rte_devargs.h:100Quoted 8 lines
Where it is specified that the bus name can be either omitted or followed by any character, to separate it from the device identifier.
This means that using ':' is fine, as well as '('. As long as the device PMD afterward ignore the dangling ')' during devargs parsing, this should be fine.
I don't think this is very clean, but it works.
Thanks for the info, I see how "(" works, but ")" is takes as part of argument and causing problem, I think better to not give "()" as supported syntax at all.
btw, now both -w and --vdev are valid and can be used interchangeably, right? I mean all following are valid?
Review
Quoted 4 lines
(quoted diff) +0
-4-w pci:0000:86:06.0,enable_floating_veb=1 -w vdev:net_pcap,iface=lo --vdev pci:0000:86:06.0,enable_floating_veb=1 --vdev vdev:net_pcap,iface=lo
They are both valid but cannot be used interchangeably.
This was the case at one point, between two rcs, because I had removed the devtype and the bus black/white-listing was configured another way.
A user complained about the API change because it was not announced in time IIRC, and this was scrapped. Since then, the effort has been to on the new syntax instead of cleaning the old system.
They cannot be used interchangeably because an rte_devtype is defined by the parameter choosen. BLACKLISTED_PCI for -b, WHITELISTED_PCI for -w, and VIRTUAL for --vdev.
-b will actually change the bus configuration to "blacklist mode", -w to "whitelist mode", and --vdev will do nothing.
So a PCI device declared using --vdev, will actually be skipped during PCI probe because by default it operates in blacklist mode, and the device policy is not WHITELISTED. This could surprise the one attempting this trick.
This semantic is subtle and bug-prone. I'm adding it to the pile of reasons I'd like to remove the blacklist mode altogether.
Signature · 2 lines
Gaëtan Rivet 6WIND
Re: [PATCH 1/5] bus/vmbus: add devargs support
Quoted 72 lines · On Fri, 14 Sep 2018 15:58:04 +0200 Gaëtan Rivet <[email protected]> wrote:
Quoted 50 lines · Ferruh Yigit
Quoted 33 lines · Gaëtan Rivet
Hi,
Quoted 21 lines · Ferruh Yigit
Quoted 6 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Take device arguments from command line and put
them in the device devargs.Signed-off-by Stephen Hemminger <[email protected]><...>
drivers/bus/vmbus/vmbus_common.c vmbus_parse(const char *name, void *addr) · line 209
Quoted 8 lines
drivers/bus/vmbus/vmbus_common.c +4
-0@@ -204,6 +203,27 @@ vmbus_parse(const char *name, void *addr)return ret; } +/* +* scan for matching device args on command line +* example: +* -w 'vmbus(635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20)' This is just in comment but,
Quoted 4 lines
I guess latest syntax is:
-w "vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20"@Gaetan, is latest devarg syntax documented somewhere?
That's the current syntax indeed. Some documentation is found at
lib/librte_eal/common/include/rte_devargs.h:100Quoted 8 lines
Where it is specified that the bus name can be either omitted or followed by any character, to separate it from the device identifier.
This means that using ':' is fine, as well as '('. As long as the device PMD afterward ignore the dangling ')' during devargs parsing, this should be fine.
I don't think this is very clean, but it works.
Thanks for the info, I see how "(" works, but ")" is takes as part of argument and causing problem, I think better to not give "()" as supported syntax at all.
btw, now both -w and --vdev are valid and can be used interchangeably, right? I mean all following are valid?
Review
Quoted 4 lines
(quoted diff) +0
-4-w pci:0000:86:06.0,enable_floating_veb=1 -w vdev:net_pcap,iface=lo --vdev pci:0000:86:06.0,enable_floating_veb=1 --vdev vdev:net_pcap,iface=loThey are both valid but cannot be used interchangeably.
This was the case at one point, between two rcs, because I had removed the devtype and the bus black/white-listing was configured another way.
A user complained about the API change because it was not announced in time IIRC, and this was scrapped. Since then, the effort has been to on the new syntax instead of cleaning the old system.
They cannot be used interchangeably because an
rte_devtypeis defined by the parameter choosen.BLACKLISTED_PCIfor -b,WHITELISTED_PCIfor -w, and VIRTUAL for --vdev.-b will actually change the bus configuration to "blacklist mode", -w to "whitelist mode", and --vdev will do nothing.
Quoted 8 lines
So a PCI device declared using --vdev, will actually be skipped during PCI probe because by default it operates in blacklist mode, and the device policy is not WHITELISTED. This could surprise the one attempting this trick.
This semantic is subtle and bug-prone. I'm adding it to the pile of reasons I'd like to remove the blacklist mode altogether.
It would have been nice if there was a --devargs instead of overloading -w and -b. Especially when just changing parameter on a device.
PATCH 2/5 net/netvsc: allow tuning latency with devargs
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Allow overriding default guest to host latency on per device basis with devargs.
--- doc/guides/nics/netvsc.rst | 16 +++++++++ drivers/net/netvsc/hn_ethdev.c | 62 +++++++++++++++++++++++++++++++--- drivers/net/netvsc/hn_var.h | 1 + 3 files changed, 75 insertions(+), 4 deletions(-)
doc/guides/nics/netvsc.rst +16 -0
@@ -103,3 +103,19 @@ The following prerequisites apply: * Linux kernel support for UIO on vmbus is done with the uio_hv_generic driver. Full support of multiple queues requires the 4.17 kernel. It is possible to use the netvsc PMD with 4.16 kernel but it is limited to a single queue. + + +Netvsc PMD arguments +-------------------- + +The user can specify below argument in devargs. + +#. ``latency``: + + A netvsc device uses a mailbox page to indicate to the host that there + is something in the transmit queue. The host scans this page at a + periodic interval. This parameter allows adjusting the value that + is used by the host. Smaller values improve transmit latency, and larger + values save CPU cycles. This parameter is in microseconds. + If the value is too large or too small it will be + ignored by the host. (Default: 50)
drivers/net/netvsc/hn_ethdev.c +58 -4
93 lines not on this page · raw message
drivers/net/netvsc/hn_var.h +1 -0
@@ -113,6 +113,7 @@ struct hn_data {uint32_t chim_szmax;/* Max size per buffer */ uint32_t chim_cnt;/* Max packets per buffer */ +uint32_t latency;uint32_t nvs_ver;uint32_t ndis_ver;uint32_t rndis_agg_size;
Signature · 1 line
2.18.0
Re: [PATCH 2/5] net/netvsc: allow tuning latency with devargs
Quoted 6 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Allow overriding default guest to host latency on per device basis with devargs.
Signed-off-by Stephen Hemminger <[email protected]>
PATCH 3/5 net/netvsc: exhausting transmit descriptors is not an error
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
If application sends faster than vswitch can keep up, then the transmit descriptor pool will be exhausted. This is not a failure so change the name statistic and don't include it in oerrors.
--- drivers/net/netvsc/hn_ethdev.c | 7 +++---- drivers/net/netvsc/hn_rxtx.c | 4 ++-- drivers/net/netvsc/hn_var.h | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-)
drivers/net/netvsc/hn_ethdev.c +3 -4
@@ -57,7 +57,7 @@ static const struct hn_xstats_name_off hn_stat_strings[] = { { "good_packets", offsetof(struct hn_stats, packets) }, { "good_bytes", offsetof(struct hn_stats, bytes) }, { "errors", offsetof(struct hn_stats, errors) }, - { "allocation_failed", offsetof(struct hn_stats, nomemory) }, + { "ring full", offsetof(struct hn_stats, ring_full) }, { "multicast_packets", offsetof(struct hn_stats, multicast) }, { "broadcast_packets", offsetof(struct hn_stats, broadcast) }, { "undersize_packets", offsetof(struct hn_stats, size_bins[0]) },
@@ -407,7 +407,7 @@ static int hn_dev_stats_get(struct rte_eth_dev *dev, stats->opackets += txq->stats.packets; stats->obytes += txq->stats.bytes; - stats->oerrors += txq->stats.errors + txq->stats.nomemory; + stats->oerrors += txq->stats.errors;if (i <RTE_ETHDEV_QUEUE_STAT_CNTRS ) { stats->q_opackets[i] = txq->stats.packets;
@@ -424,7 +424,7 @@ static int hn_dev_stats_get(struct rte_eth_dev *dev, stats->ipackets += rxq->stats.packets; stats->ibytes += rxq->stats.bytes; stats->ierrors += rxq->stats.errors; - stats->imissed += rxq->ring_full; + stats->imissed += rxq->stats.ring_full;if (i <RTE_ETHDEV_QUEUE_STAT_CNTRS ) { stats->q_ipackets[i] = rxq->stats.packets;
@@ -458,7 +458,6 @@ hn_dev_stats_reset(struct rte_eth_dev *dev)continue ;memset (&rxq->stats,0 ,sizeof (struct hn_stats )); - rxq->ring_full =0 ; } }
drivers/net/netvsc/hn_rxtx.c +2 -2
@@ -534,7 +534,7 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb,hn_update_packet_stats (&rxq->stats, m);if (unlikely (rte_ring_sp_enqueue (rxq->rx_ring, m) !=0 )) { - ++rxq->ring_full; + ++rxq->stats.ring_full;rte_pktmbuf_free (m); } }
@@ -1007,7 +1007,7 @@ static struct hn_txdesc *hn_new_txd(struct hn_data *hv,struct hn_txdesc *txd;if (rte_mempool_get (hv->tx_pool, (void **)&txd)) { - ++txq->stats.nomemory; + ++txq->stats.ring_full;PMD_TX_LOG (DEBUG ,"tx pool exhausted!" );return NULL ; }
drivers/net/netvsc/hn_var.h +1 -2
@@ -39,7 +39,7 @@ struct hn_stats {uint64_t packets;uint64_t bytes;uint64_t errors; -uint64_t nomemory; +uint64_t ring_full;uint64_t multicast;uint64_t broadcast;/* Size bins in array as RFC 2819, undersized [0], 64 [1], etc */
@@ -78,7 +78,6 @@ struct hn_rx_queue {uint16_t port_id;uint16_t queue_id;struct hn_stats stats; -uint64_t ring_full;void *event_buf; };
Signature · 1 line
2.18.0
PATCH 4/5 net/netvsc: implement link state change callback
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Implement callback functionality on link state changes.
This is not really driven off of interrupt file descriptor like most other PMD's. Instead, it happens when a link state change message arrives in the common ring buffer.
--- doc/guides/nics/netvsc.rst | 3 ++- drivers/net/netvsc/hn_ethdev.c | 12 +++++------- drivers/net/netvsc/hn_rndis.c | 11 ++++++++--- drivers/net/netvsc/hn_rndis.h | 2 +- drivers/net/netvsc/hn_rxtx.c | 4 ++-- drivers/net/netvsc/hn_var.h | 1 + 6 files changed, 19 insertions(+), 14 deletions(-)
doc/guides/nics/netvsc.rst +2 -1
@@ -28,7 +28,8 @@ In this release, the hyper PMD driver provides the basic functionality of packet * VLAN tags are always stripped and presented in mbuf tci field. -* The Hyper-V driver does not use or support Link State or Rx interrupt. +* The Hyper-V driver does not use or support interrupts. Link state change + callback is done via change events in the packet ring. * The maximum number of queues is limited by the host (currently 64). When used with 4.16 kernel only a single queue is available.
drivers/net/netvsc/hn_ethdev.c +5 -7
@@ -107,6 +107,10 @@ eth_dev_vmbus_allocate(struct rte_vmbus_device *dev, size_t private_data_size) } eth_dev->device = &dev->device; + +/* interrupt is simulated */ + dev->intr_handle.type =RTE_INTR_HANDLE_EXT ; + eth_dev->data->dev_flags |=RTE_ETH_DEV_INTR_LSC ; eth_dev->intr_handle = &dev->intr_handle;return eth_dev;
@@ -187,7 +191,7 @@ static int hn_parse_args(const struct rte_eth_dev *dev)* means block this call until link is up. * which is not worth supporting. */ -static int +int hn_dev_link_update (struct rte_eth_dev *dev, __rte_unused int wait_to_complete) {
@@ -554,12 +558,6 @@ hn_dev_start(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE (); -/* check if lsc interrupt feature is enabled */ -if (dev->data->dev_conf.intr_conf.lsc) { -PMD_DRV_LOG (ERR ,"link status not supported yet" ); -return -ENOTSUP ; - } - return hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_ALL_MULTICAST |
drivers/net/netvsc/hn_rndis.c +8 -3
@@ -11,6 +11,7 @@#include <errno.h> #include <unistd.h> +#include <rte_ethdev_driver.h> #include <rte_ethdev.h> #include <rte_string_fns.h> #include <rte_memzone.h>
@@ -281,7 +282,7 @@ static int hn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, &nvs_rndis, sizeof(nvs_rndis), 0U, NULL); } -void hn_rndis_link_status(struct hn_data *hv __rte_unused, const void *msg) +void hn_rndis_link_status (struct rte_eth_dev *dev,const void *msg) {const struct rndis_status_msg *indicate = msg;
@@ -290,15 +291,19 @@ void hn_rndis_link_status(struct hn_data *hv __rte_unused, const void *msg)PMD_DRV_LOG (DEBUG ,"link status %#x" , indicate->status);switch (indicate->status) { -case RNDIS_STATUS_LINK_SPEED_CHANGE :case RNDIS_STATUS_NETWORK_CHANGE :case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG :/* ignore not in DPDK API */ break ; +case RNDIS_STATUS_LINK_SPEED_CHANGE :case RNDIS_STATUS_MEDIA_CONNECT :case RNDIS_STATUS_MEDIA_DISCONNECT : -/* TODO handle as LSC interrupt */ +if (dev->data->dev_conf.intr_conf.lsc && +hn_dev_link_update (dev,0 ) ==0 ) +_rte_eth_dev_callback_process (dev, +RTE_ETH_EVENT_INTR_LSC , +NULL );break ;default : PMD_DRV_LOG(NOTICE, "unknown RNDIS indication: %#x",
drivers/net/netvsc/hn_rndis.h +1 -1
@@ -6,7 +6,7 @@ struct hn_data;void hn_rndis_receive_response (struct hn_data *hv,const void *data,uint32_t len); -void hn_rndis_link_status (struct hn_data *hv,const void *data); +void hn_rndis_link_status (struct rte_eth_dev *dev,const void *msg);int hn_rndis_attach (struct hn_data *hv);void hn_rndis_detach (struct hn_data *hv);int hn_rndis_get_eaddr (struct hn_data *hv,uint8_t *eaddr);
drivers/net/netvsc/hn_rxtx.c +2 -2
@@ -601,7 +601,7 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq, }static void -hn_rndis_receive (const struct rte_eth_dev *dev,struct hn_rx_queue *rxq, +hn_rndis_receive (struct rte_eth_dev *dev,struct hn_rx_queue *rxq,struct hn_rx_bufinfo *rxb,void *buf,uint32_t len) {const struct rndis_msghdr *hdr = buf;
@@ -613,7 +613,7 @@ hn_rndis_receive(const struct rte_eth_dev *dev, struct hn_rx_queue *rxq,break ;case RNDIS_INDICATE_STATUS_MSG : -hn_rndis_link_status (rxq->hv, buf); +hn_rndis_link_status (dev, buf);break ;case RNDIS_INITIALIZE_CMPLT :
drivers/net/netvsc/hn_var.h +1 -0
@@ -142,6 +142,7 @@ uint16_t hn_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);int hn_tx_pool_init (struct rte_eth_dev *dev); +int hn_dev_link_update (struct rte_eth_dev *dev,int wait);int hn_dev_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf);
Signature · 1 line
2.18.0
Re: [PATCH 4/5] net/netvsc: implement link state change callback
Hi Stephen,
Quoted 7 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Implement callback functionality on link state changes.
This is not really driven off of interrupt file descriptor like most other PMD's. Instead, it happens when a link state change message arrives in the common ring buffer.
Does this mean that the lsc event will be processed in a dataplane thread? Looking at the _rte_eth_dev_callback_process() call, it seems so.
Shouldn't this be executed in the context of the eal-intr-thread instead? This thread is marked control and should be configured with the proper afinity, unless dataplane threads.
Maybe I missed something, it's just to double-check that this will behave nicely with applications relying on the eal-intr-thread afinity.
Signature · 2 lines
Gaëtan Rivet 6WIND
Re: [PATCH 4/5] net/netvsc: implement link state change callback
Quoted 15 lines · On Fri, 31 Aug 2018 10:25:47 +0200 Gaëtan Rivet <[email protected]> wrote:
Hi Stephen,
Quoted 7 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Implement callback functionality on link state changes.
This is not really driven off of interrupt file descriptor like most other PMD's. Instead, it happens when a link state change message arrives in the common ring buffer.Does this mean that the lsc event will be processed in a dataplane thread? Looking at the
_rte_eth_dev_callback_process()call, it seems so.
Quoted 10 lines
Shouldn't this be executed in the context of the eal-intr-thread instead? This thread is marked control and should be configured with the proper afinity, unless dataplane threads.
Maybe I missed something, it's just to double-check that this will behave nicely with applications relying on the eal-intr-thread afinity.
Signature · 2 lines
Gaëtan Rivet 6WIND
There is no EAL API to take the event and propogate it over to the eal interrupt thread. The interrupt thread is buried in the internals of EAL.
PATCH 5/5 net/netvsc: integrated VF support
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Integrate accelerated networking support into netvsc PMD. This allows netvsc to manage VF without using failsafe or vdev_netvsc. For the exception vswitch path some tests like transmit
get a 22% increase in packets/sec.
For the VF path, the code is slightly shorter but has no real change in performance.
Pro:
* using netvsc is more like other DPDK NIC's
* the exception packet uses less CPU
* much smaller code size
* no locking required on VF transmit/receive path
* no legacy Linux network device to get mangled by userspace
* much simpler (1K vs 9K) LOC
* unified extended statistics
Con:
* using netvsc has more complex startup model
* no bifurcated driver support
* no flow support (since host does not have flow API).
* no tunnel offload support
* no receive interrupt support
--- devtools/checkpatches.sh | 2 +- doc/guides/nics/netvsc.rst | 12 +- doc/guides/rel_notes/release_18_11.rst | 14 +- drivers/net/netvsc/Makefile | 1 + drivers/net/netvsc/hn_ethdev.c | 109 +++++- drivers/net/netvsc/hn_nvs.c | 11 +- drivers/net/netvsc/hn_nvs.h | 9 + drivers/net/netvsc/hn_rndis.c | 31 ++ drivers/net/netvsc/hn_rndis.h | 1 + drivers/net/netvsc/hn_rxtx.c | 136 ++++--- drivers/net/netvsc/hn_var.h | 43 ++- drivers/net/netvsc/hn_vf.c | 512 +++++++++++++++++++++++++ drivers/net/netvsc/meson.build | 2 +- 13 files changed, 799 insertions(+), 84 deletions(-) create mode 100644 drivers/net/netvsc/hn_vf.c
devtools/checkpatches.sh +1 -1
@@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash # SPDX-License-Identifier: BSD-3-Clause # Copyright 2015 6WIND S.A.
doc/guides/nics/netvsc.rst +4 -8
@@ -34,14 +34,10 @@ In this release, the hyper PMD driver provides the basic functionality of packet * The maximum number of queues is limited by the host (currently 64). When used with 4.16 kernel only a single queue is available. -.. note:: - This driver is intended for use with **Hyper-V only** and is - not recommended for use on Azure because accelerated Networking - (SR-IOV) is not supported. - - On Azure, use the :doc:`vdev_netvsc` which - automatically configures the necessary TAP and failsave drivers. - +* This driver supports SR-IOV network acceleration. + If SR-IOV is enabled then the driver will transparently manage the interface, + and send and receive packets using the VF path. + The VDEV_NETVSC and FAILSAFE drivers are *not* used when using netvsc PMD. Installation ------------
doc/guides/rel_notes/release_18_11.rst +12 -2
@@ -54,6 +54,12 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added support for SR-IOV in netvsc PMD.** + + The ``netvsc`` poll mode driver now supports the Accelerated Networking + SR-IOV option in Hyper-V and Azure. This is an alternative to the previous + vdev_netvsc, tap, and failsafe drivers combination. + API Changes -----------
@@ -122,7 +128,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_bus_fslmc.so.1 librte_bus_pci.so.1 librte_bus_vdev.so.1 - librte_bus_vmbus.so.1 + + librte_bus_vmbus.so.1 librte_cfgfile.so.2 librte_cmdline.so.2 librte_common_octeontx.so.1
@@ -159,6 +165,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_pmd_ring.so.2 librte_pmd_softnic.so.1 librte_pmd_vhost.so.2 + + librte_pmd_netvsc.so.1 librte_port.so.3 librte_power.so.1 librte_rawdev.so.1
@@ -185,6 +192,10 @@ Known Issues Also, make sure to start the actual text at the margin. ========================================================= +* When using SR-IOV (VF) support with netvsc PMD and the Mellanox mlx5 bifurcated + driver; the Linux netvsc device must be brought up before the netvsc device is + unbound and passed to the DPDK. + Tested Platforms ----------------
@@ -204,4 +215,3 @@ Tested Platforms This section is a comment. Do not overwrite or remove it. Also, make sure to start the actual text at the margin. ========================================================= -
drivers/net/netvsc/Makefile +1 -0
@@ -15,6 +15,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_rndis.c SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_nvs.c +SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_vf.c LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
drivers/net/netvsc/hn_ethdev.c +88 -21
236 lines not on this page · raw message
drivers/net/netvsc/hn_nvs.c +10 -1
@@ -532,10 +532,19 @@ void hn_nvs_set_datapath(struct hn_data *hv, uint32_t path) {struct hn_nvs_datapath dp; +int error; + +PMD_DRV_LOG (DEBUG ,"set datapath %s" , + path ?"VF" :"Synthetic" );memset (&dp,0 ,sizeof (dp)); dp.type =NVS_TYPE_SET_DATAPATH ; dp.active_path = path; -hn_nvs_req_send (hv, &dp,sizeof (dp)); + error =hn_nvs_req_send (hv, &dp,sizeof (dp)); +if (error) { +PMD_DRV_LOG (ERR , +"send set datapath failed: %d" , + error); + } }
drivers/net/netvsc/hn_nvs.h +9 -0
@@ -105,6 +105,12 @@ struct hn_nvs_ndis_init {uint8_t rsvd[28 ]; } __rte_packed; +struct hn_nvs_vf_association { +uint32_t type;/* NVS_TYPE_VFASSOC_NOTE */ +uint32_t allocated; +uint32_t serial; +} __rte_packed; +#define NVS_DATAPATH_SYNTHETIC 0#define NVS_DATAPATH_VF 1
@@ -207,6 +213,9 @@ void hn_nvs_detach(struct hn_data *hv);void hn_nvs_ack_rxbuf (struct vmbus_channel *chan,uint64_t tid);int hn_nvs_alloc_subchans (struct hn_data *hv,uint32_t *nsubch);void hn_nvs_set_datapath (struct hn_data *hv,uint32_t path); +void hn_nvs_handle_vfassoc (struct rte_eth_dev *dev, +const struct vmbus_chanpkt_hdr *hdr, +const void *data); static inline int hn_nvs_send(struct vmbus_channel *chan, uint16_t flags,
drivers/net/netvsc/hn_rndis.c +31 -0
@@ -914,6 +914,37 @@ int hn_rndis_get_offload(struct hn_data *hv,return 0 ; } +uint32_t +hn_rndis_get_ptypes (struct hn_data *hv) +{ +struct ndis_offload hwcaps; +uint32_t ptypes; +int error; + +memset (&hwcaps,0 ,sizeof (hwcaps)); + + error =hn_rndis_query_hwcaps (hv, &hwcaps); +if (error) { +PMD_DRV_LOG (ERR ,"hwcaps query failed: %d" , error); +return RTE_PTYPE_L2_ETHER ; + } + + ptypes =RTE_PTYPE_L2_ETHER ; + +if (hwcaps.ndis_csum.ndis_ip4_rxcsum &NDIS_RXCSUM_CAP_IP4 ) + ptypes |=RTE_PTYPE_L3_IPV4 ; + +if ((hwcaps.ndis_csum.ndis_ip4_rxcsum &NDIS_RXCSUM_CAP_TCP4 ) || + (hwcaps.ndis_csum.ndis_ip6_rxcsum &NDIS_RXCSUM_CAP_TCP6 )) + ptypes |=RTE_PTYPE_L4_TCP ; + +if ((hwcaps.ndis_csum.ndis_ip4_rxcsum &NDIS_RXCSUM_CAP_UDP4 ) || + (hwcaps.ndis_csum.ndis_ip6_rxcsum &NDIS_RXCSUM_CAP_UDP6 )) + ptypes |=RTE_PTYPE_L4_UDP ; + +return ptypes; +} +int hn_rndis_set_rxfilter (struct hn_data *hv,uint32_t filter) {
drivers/net/netvsc/hn_rndis.h +1 -0
@@ -24,6 +24,7 @@ int hn_rndis_query_rsscaps(struct hn_data *hv, unsigned int *rxr_cnt0);int hn_rndis_conf_rss (struct hn_data *hv,const struct rte_eth_rss_conf *rss_conf); +uint32_t hn_rndis_get_ptypes (struct hn_data *hv);#ifdef RTE_LIBRTE_NETVSC_DEBUG_DUMP void hn_rndis_dump (const void *buf);
drivers/net/netvsc/hn_rxtx.c +88 -48
238 lines not on this page · raw message
drivers/net/netvsc/hn_var.h +41 -2
60 lines not on this page · raw message
drivers/net/netvsc/hn_vf.c new file +512 -0
512 lines not on this page · raw message
drivers/net/netvsc/meson.build +1 -1
@@ -3,7 +3,7 @@ build = dpdk_conf.has('RTE_LIBRTE_VMBUS_BUS') version = 2 -sources = files('hn_ethdev.c', 'hn_rxtx.c', 'hn_rndis.c', 'hn_nvs.c') +sources = files('hn_ethdev.c', 'hn_rxtx.c', 'hn_rndis.c', 'hn_nvs.c', 'hn_vf.c') deps += ['bus_vmbus' ]
Signature · 1 line
2.18.0
Re: [PATCH 5/5] net/netvsc: integrated VF support
Quoted 48 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Integrate accelerated networking support into netvsc PMD. This allows netvsc to manage VF without using failsafe or
vdev_netvsc. For the exception vswitch path some tests like transmit
get a 22% increase in packets/sec.
For the VF path, the code is slightly shorter but has no real change in performance.Pro:
* using netvsc is more like other DPDK NIC's
* the exception packet uses less CPU
* much smaller code size
* no locking required on VF transmit/receive path
* no legacy Linux network device to get mangled by userspace
* much simpler (1K vs 9K) LOC
* unified extended statisticsCon:
* using netvsc has more complex startup model
* no bifurcated driver support
* no flow support (since host does not have flow API).
* no tunnel offload support
* no receive interrupt supportSigned-off-by Stephen Hemminger <[email protected]>--- devtools/checkpatches.sh | 2 +- doc/guides/nics/netvsc.rst | 12 +- doc/guides/rel_notes/release_18_11.rst | 14 +- drivers/net/netvsc/Makefile | 1 + drivers/net/netvsc/hn_ethdev.c | 109 +++++- drivers/net/netvsc/hn_nvs.c | 11 +- drivers/net/netvsc/hn_nvs.h | 9 + drivers/net/netvsc/hn_rndis.c | 31 ++ drivers/net/netvsc/hn_rndis.h | 1 + drivers/net/netvsc/hn_rxtx.c | 136 ++++--- drivers/net/netvsc/hn_var.h | 43 ++- drivers/net/netvsc/hn_vf.c | 512 +++++++++++++++++++++++++ drivers/net/netvsc/meson.build | 2 +- 13 files changed, 799 insertions(+), 84 deletions(-) create mode 100644 drivers/net/netvsc/hn_vf.cdevtools/checkpatches.sh +0
-0
devtools/checkpatches.sh line 3
Quoted 4 lines
devtools/checkpatches.sh +1
-1@@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash # SPDX-License-Identifier: BSD-3-Clause # Copyright 2015 6WIND S.A.
This tool patch shouldn't be part of driver update, would you mind sending a separate patch for it?
Re: [PATCH 5/5] net/netvsc: integrated VF support
Quoted 44 lines · On Fri, 14 Sep 2018 13:57:58 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 43 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Integrate accelerated networking support into netvsc PMD. This allows netvsc to manage VF without using failsafe or
vdev_netvsc. For the exception vswitch path some tests like transmit
get a 22% increase in packets/sec.
For the VF path, the code is slightly shorter but has no real change in performance.Pro:
* using netvsc is more like other DPDK NIC's
* the exception packet uses less CPU
* much smaller code size
* no locking required on VF transmit/receive path
* no legacy Linux network device to get mangled by userspace
* much simpler (1K vs 9K) LOC
* unified extended statisticsCon:
* using netvsc has more complex startup model
* no bifurcated driver support
* no flow support (since host does not have flow API).
* no tunnel offload support
* no receive interrupt supportSigned-off-by Stephen Hemminger <[email protected]>--- devtools/checkpatches.sh | 2 +- doc/guides/nics/netvsc.rst | 12 +- doc/guides/rel_notes/release_18_11.rst | 14 +- drivers/net/netvsc/Makefile | 1 + drivers/net/netvsc/hn_ethdev.c | 109 +++++- drivers/net/netvsc/hn_nvs.c | 11 +- drivers/net/netvsc/hn_nvs.h | 9 + drivers/net/netvsc/hn_rndis.c | 31 ++ drivers/net/netvsc/hn_rndis.h | 1 + drivers/net/netvsc/hn_rxtx.c | 136 ++++--- drivers/net/netvsc/hn_var.h | 43 ++- drivers/net/netvsc/hn_vf.c | 512 +++++++++++++++++++++++++ drivers/net/netvsc/meson.build | 2 +- 13 files changed, 799 insertions(+), 84 deletions(-) create mode 100644 drivers/net/netvsc/hn_vf.c
Quoted 12 lines
devtools/checkpatches.sh line 3
Quoted 9 lines
devtools/checkpatches.sh +1
-1@@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash # SPDX-License-Identifier: BSD-3-Clause # Copyright 2015 6WIND S.A.This tool patch shouldn't be part of driver update, would you mind sending a separate patch for it?
Sorry, that slipped in. Will drop it.
Quoted 9 lines · Stephen Hemminger
These patches are against dpdk-net-next/master because that is where previous patches have already been merged.
Stephen Hemminger (5):
bus/vmbus: add devargs support
net/netvsc: allow tuning latency with devargs net/netvsc: exhausting transmit descriptors is not an error net/netvsc: implement link state change callback net/netvsc: integrated VF support
A highlevel question, since netvsc PMD is upstreamed, can we remove vdev_netvsc one?
Quoted 4 lines · On Fri, 31 Aug 2018 13:04:18 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger
These patches are against dpdk-net-next/master because that is where previous patches have already been merged.
Quoted 8 lines
Quoted 6 lines
Stephen Hemminger (5):
bus/vmbus: add devargs support
net/netvsc: allow tuning latency with devargs net/netvsc: exhausting transmit descriptors is not an error net/netvsc: implement link state change callback net/netvsc: integrated VF supportA highlevel question, since netvsc PMD is upstreamed, can we remove
vdev_netvscone?
No.
There are some use cases that still need bifurcated model. And also netvsc PMD is still in experimental state and vdev_netvsc/failsafe/tap are more stable.
I hope maybe by 19.11?
31/08/2018 17:15, Stephen Hemminger:
Quoted 14 lines
Quoted 11 lines · On Fri, 31 Aug 2018 13:04:18 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 9 lines · Stephen Hemminger
These patches are against dpdk-net-next/master because that is where previous patches have already been merged.
Stephen Hemminger (5):
bus/vmbus: add devargs support
net/netvsc: allow tuning latency with devargs net/netvsc: exhausting transmit descriptors is not an error net/netvsc: implement link state change callback net/netvsc: integrated VF support
Quoted 8 lines
Quoted 1 line
A highlevel question, since netvsc PMD is upstreamed, can we remove
vdev_netvscone?No.
There are some use cases that still need bifurcated model. And also netvsc PMD is still in experimental state and vdev_netvsc/failsafe/tap are more stable.
I hope maybe by 19.11?
19.11 would be reasonnable target to deprecate vdev_netvsc.
Quoted 9 lines · Stephen Hemminger
These patches are against dpdk-net-next/master because that is where previous patches have already been merged.
Stephen Hemminger (5):
bus/vmbus: add devargs support
net/netvsc: allow tuning latency with devargs net/netvsc: exhausting transmit descriptors is not an error net/netvsc: implement link state change callback net/netvsc: integrated VF support
Series applied to dpdk-next-net/master, thanks.
(checkpatches.sh update dropped from patch, devarg syntax in function comment updated.)