[dpdk-dev] Flow Director - big endian handling
Hi, Yaacov Thank you for pointing that. Actually, Intel's NIC expects big endian when set flow_director_filter, and little endian when set flow_director_mask. But in rte_eth level, we need to make them consistent. I think what you say make sense, to leave the handling bytes order to PMD or just keep consistency. I will work on that. Thanks a lot! Jingjing From: Yaacov Hazan [mailto:yaac...@mellanox.com] Sent: Wednesday, December 30, 2015 5:57 PM To: Wu, Jingjing Cc: dev at dpdk.org Subject: Flow Director - big endian handling Hi JingJing, I looked at your patch for flow director - app/testpmd: update flow director commands - a56335925919d26c81dec8accf31c39d2f790c5a. It seems there is some mismatch in the handling of big endian between the filter and mask. In the cmd_flow_director_filter_parsed function, which add the filter values, you called to rte_cpu_to_be_16 for the vlan_tci and ports values. But in cmd_flow_director_mask_parsed function, which set the mask, you didn't called to rte_cpu_to_be_16 for those values (valn_tci & ports). Does Intel's NICs (or Intel's PMDs) expected form application side to handle the big endian in different way for the filter values and the mask values? If yes, it is very confusing from the application/user point of view. I think that it is more make sense to leave the decision and handling of the big endian to the PMD layer, or at least to keep consistency for the expected handling in the application layer. Thanks, Yaacov.
[dpdk-dev] [PATCH v4 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in l3fwd
> > +#define PORT_IDLE 0 > > +#define PORT_INIT 1 > > +#define PORT_WORK 2 > > +#define PORT_STOP 3 > > +#define PORT_QUIT 4 > > Seems ok, but over-complicated. > I think all you need is just IDLE, INIT, QUIT. Yes for l2/l3fwd 3 states are enough. I implement a full state machine so it can also serve as an example on how to do this in other cases, like where stop might be called before or during init. > Konstantin
[dpdk-dev] [PATCH v3 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in l3fwd
> -Original Message- > From: Ananyev, Konstantin > Sent: Wednesday, December 30, 2015 7:30 PM > To: Wang, Zhihong ; dev at dpdk.org > Cc: stephen at networkplumber.org; Qiu, Michael > Subject: RE: [PATCH v3 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in > l3fwd > > > > > -Original Message- > > From: Wang, Zhihong > > Sent: Wednesday, December 30, 2015 3:15 AM > > To: Ananyev, Konstantin; dev at dpdk.org > > Cc: stephen at networkplumber.org; Qiu, Michael > > Subject: RE: [PATCH v3 3/3] examples/l3fwd: Handle SIGINT and SIGTERM > > in l3fwd > > > > > > +static uint8_t > > > > +start_ports(void) > > > > +{ > > > > + unsigned portid, nb_ports, avail_ports; > > > > + int ret; > > > > + > > > > + nb_ports = rte_eth_dev_count(); > > > > + avail_ports = 0; > > > > + for (portid = 0; portid < nb_ports; portid++) { > > > > + if ((enabled_port_mask & (1 << portid)) == 0) > > > > + continue; > > > > + avail_ports++; > > > > + port_started = true; > > > > > > Why do you need it at each iteration? > > > > Only become true when the first enabled port about to started. In case > > there's > no port enabled at all. > > In my opinion no need to optimize since it's not performance sensitive > > and the logic is correct :) > > > > > > > > > > > + printf("Starting port %d...", portid); > > > > + ret = rte_eth_dev_start(portid); > > > > + if (ret < 0) > > > > + rte_exit(EXIT_FAILURE, > > > > + "rte_eth_dev_start: err=%d, > > > > port=%d\n", > > > > + ret, portid); > > > > + /* > > > > +* If enabled, put device in promiscuous mode. > > > > +* This allows IO forwarding mode to forward packets > > > > +* to itself through 2 cross-connected ports of the > > > > +* target machine. > > > > +*/ > > > > + if (promiscuous_on) > > > > + rte_eth_promiscuous_enable(portid); > > > > + printf(" Done\n"); > > > > + } > > > > + > > > > + return avail_ports; > > > > +} > > > > [...] > > > > > > +static void > > > > +signal_handler(int signum) > > > > +{ > > > > + if (signum == SIGINT || signum == SIGTERM) { > > > > + printf("\nSignal %d received, preparing to exit...\n", > > > > + signum); > > > > + if (port_started) { > > > > + printf("Ports started already...\n"); > > > > + signo_quit = signum; > > > > + force_quit = true; > > > > + } else { > > > > > > > > > Hmm, and what if signal_handler() would be executed not in the > > > context of master lcore? > > > Then there could be a raise condition, and you could end up here, > > > while master lcore would be in the middle of > start_ports()->rte_eth_dev_start(). > > > > Good point! Then we need rte_atomic16_cmpset() to avoid the race condition. > > > > > > > Probably not a big deal, but why do you need this if (port_started) > > > {...} else {...} at all? > > > Why not just: > > > > If no port has been started, then just kill itself. > > This is for cases like when you just started it and then want to shut > > it down, it'll wait a long time for initialization (memory, etc.) before the > force_quit signal take effect. > > Do you mean rte_eal_init()? > Then why not to install non-default signal handlers after rte_eal_init()? > Konstantin Yes that does sounds better :) > > > > > > > > > > > signal_handler(int signum) > > > { > > > signo_quit = signum; > > > force_quit = true; > > > } > > > ? > > > > > > Konstantin > > > > > > > + printf("Ports not started yet...\n"); > > > > + printf("Bye...\n"); > > > > + /* exit with the expected status */ > > > > + signal(signum, SIG_DFL); > > > > + kill(getpid(), signum); > > > > + } > > > > + } > > > > +} > > > > +
[dpdk-dev] [PATCH v4 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in l3fwd
> -Original Message- > From: Stephen Hemminger [mailto:stephen at networkplumber.org] > Sent: Thursday, December 31, 2015 10:09 AM > To: Wang, Zhihong > Cc: Ananyev, Konstantin ; dev at dpdk.org; > Qiu, > Michael > Subject: Re: [PATCH v4 3/3] examples/l3fwd: Handle SIGINT and SIGTERM in > l3fwd > > On Thu, 31 Dec 2015 01:44:20 + > "Wang, Zhihong" wrote: > > > > > +#define PORT_IDLE 0 > > > > +#define PORT_INIT 1 > > > > +#define PORT_WORK 2 > > > > +#define PORT_STOP 3 > > > > +#define PORT_QUIT 4 > > > > > > Seems ok, but over-complicated. > > > I think all you need is just IDLE, INIT, QUIT. > > > > Yes for l2/l3fwd 3 states are enough. > > I implement a full state machine so it can also serve as an example on how > > to > do this in other cases, like where stop might be called before or during init. > > These are examples, it is better to have as little code as necessary to get > the job > done. That makes the example clearer. Adding extra unnecessary complexity > just makes it harder to understand. Thanks for the suggestions! I'll send the v5 combining your comments and Konstantin's together to make it simpler.
[dpdk-dev] [RFC 0/5] virtio support for container
Hi Fedin, First of all, when you say openvswitch, are you referring to ovs-dpdk? And can you detail your test case? Like, how do you want ovs_on_host and ovs_in_container to be connected? Through two-direct-connected physical NICs, or one vhost port in ovs_on_host and one virtio port in ovs_in_container? Thanks, Jianfeng > -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Pavel Fedin > Sent: Wednesday, December 30, 2015 5:47 PM > To: dev at dpdk.org > Subject: Re: [dpdk-dev] [RFC 0/5] virtio support for container > > Hello everybody! > > I am currently working on improved version of this patchset, and i am testing > it with openvswitch. I run two openvswitch instances: > on host and in container. Both ovs instances forward packets between its > LOCAL port and vhost/virtio port. This way i can > comfortably run PING between my host and container. > The problem is that the patchset seems to be broken somehow. ovs- > vswitchd fails to open dpdk0 device, and if i set --log-level=9 > for DPDK, i see this in the console: > --- cut --- > Broadcast message from systemd-journald at localhost.localdomain (Wed > 2015-12-30 11:13:00 MSK): > > ovs-vswitchd[557]: EAL: TSC frequency is ~3400032 KHz > > > Broadcast message from systemd-journald at localhost.localdomain (Wed > 2015-12-30 11:13:00 MSK): > > ovs-vswitchd[560]: EAL: memzone_reserve_aligned_thread_unsafe(): > memzone already exists > > > Broadcast message from systemd-journald at localhost.localdomain (Wed > 2015-12-30 11:13:00 MSK): > > ovs-vswitchd[560]: RING: Cannot reserve memory > --- cut --- > > How can i debug this? > > Kind regards, > Pavel Fedin > Expert Engineer > Samsung Electronics Research center Russia > >
[dpdk-dev] [RFC 0/5] virtio support for container
Hello! > First of all, when you say openvswitch, are you referring to ovs-dpdk? I am referring to mainline ovs, compiled with dpdk, and using userspace dataplane. AFAIK ovs-dpdk is early Intel fork, which is abandoned at the moment. > And can you detail your test case? Like, how do you want ovs_on_host and > ovs_in_container to > be connected? > Through two-direct-connected physical NICs, or one vhost port in ovs_on_host > and one virtio > port in ovs_in_container? vhost port. i. e. | LOCAL--dpdkvhostuser<+>cvio->LOCAL ovs| ovs | host |container By this time i advanced in my research. ovs not only crashes by itself, but manages to crash host side. It does this by doing reconfiguration sequence without sending VHOST_USER_SET_MEM_TABLE, therefore host-side ovs tries to refer old addresses and dies badly. Those messages about memory pool already being present are perhaps OK. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
[dpdk-dev] [RFC 0/5] virtio support for container
> -Original Message- > From: Pavel Fedin [mailto:p.fedin at samsung.com] > Sent: Thursday, December 31, 2015 5:40 PM > To: Tan, Jianfeng; dev at dpdk.org > Subject: RE: [dpdk-dev] [RFC 0/5] virtio support for container > > Hello! > > > First of all, when you say openvswitch, are you referring to ovs-dpdk? > > I am referring to mainline ovs, compiled with dpdk, and using userspace > dataplane. > AFAIK ovs-dpdk is early Intel fork, which is abandoned at the moment. > > > And can you detail your test case? Like, how do you want ovs_on_host and > ovs_in_container to > > be connected? > > Through two-direct-connected physical NICs, or one vhost port in > ovs_on_host and one virtio > > port in ovs_in_container? > > vhost port. i. e. > > | > LOCAL--dpdkvhostuser<+>cvio->LOCAL > ovs| ovs > | > host |container > > By this time i advanced in my research. ovs not only crashes by itself, but > manages to crash host side. It does this by doing > reconfiguration sequence without sending VHOST_USER_SET_MEM_TABLE, > therefore host-side ovs tries to refer old addresses and dies > badly. Yes, this case is exactly suited for this patchset. Before you start another ovs_in_container, previous ones get killed? If so, vhost information in ovs_on_host will be wiped as the unix socket is broken. And by the way, ovs just allows one virtio for one vhost port, much different from the exmpale, vhost-switch. Thanks, Jianfeng > Those messages about memory pool already being present are perhaps OK. > > Kind regards, > Pavel Fedin > Expert Engineer > Samsung Electronics Research center Russia >
[dpdk-dev] [RFC 0/5] virtio support for container
Hello! > Before you start another ovs_in_container, previous ones get killed? Of course. It crashes. > If so, vhost information in ovs_on_host will be wiped as the unix socket is > broken. Yes. And ovs_on_host crashes because: a) ovs_in_container does not send VHOST_USER_SET_MEM_TABLE (i don't know why yet) b) set_vring_addr() does not make sure that dev->mem is set. I am preparing a patch to fix (b). Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
[dpdk-dev] [RFC 0/5] virtio support for container
Hi, > a) ovs_in_container does not send VHOST_USER_SET_MEM_TABLE Please check if rte_eth_dev_start() is called. (rte_eth_dev_start -> virtio_dev_start -> vtpci_reinit_complete -> kick_all_vq) > b) set_vring_addr() does not make sure that dev->mem is set. > I am preparing a patch to fix (b). Yes, it seems like a bug, lack of necessary check. Thanks, Jianfeng
[dpdk-dev] [RFC 0/5] virtio support for container
Hello! > > a) ovs_in_container does not send VHOST_USER_SET_MEM_TABLE > Please check if rte_eth_dev_start() is called. > (rte_eth_dev_start -> virtio_dev_start -> vtpci_reinit_complete -> > kick_all_vq) > > > b) set_vring_addr() does not make sure that dev->mem is set. > > I am preparing a patch to fix (b). > > Yes, it seems like a bug, lack of necessary check. I've made some progress about (a). It's tricky. This caused by this fragment: if (vhost_user_read(vhost->sockfd, &msg, len, fds, fd_num) < 0) return 0; Here you ignore errors. And this particular request for some reason ends up in EBADF. The most magic part is that sometimes it just works... Not sure if i can finish it today, and here in Russia we have New Year holidays until 11th. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
[dpdk-dev] [RFC 0/5] virtio support for container
Hello! > > I've made some progress about (a). It's tricky. This caused by this fragment: > > if (vhost_user_read(vhost->sockfd, &msg, len, fds, fd_num) < 0) > return 0; > > Here you ignore errors. And this particular request for some reason ends up > in EBADF. The most magic part is that sometimes it just > works... > Not sure if i can finish it today, and here in Russia we have New Year > holidays > until 11th. Oops, I made a mistake here. I got vhost_user_read() and vhost_user_write() backwards. + len = VHOST_USER_HDR_SIZE + msg.size; + if (vhost_user_read(hw->sockfd, &msg, len, fds, fd_num) < 0) + return 0; + + if (need_reply) { + if (vhost_user_write(hw->sockfd, &msg) < 0) + return -1; + + if (req != msg.request) { + PMD_DRV_LOG(ERR, "Received unexpected msg type." + " Expected %d received %d", + req, msg.request); + return -1; + } Thanks, Jianfeng
[dpdk-dev] [RFC 0/5] virtio support for container
Hello! > > Here you ignore errors. And this particular request for some reason ends up > > in EBADF. The most magic part is that sometimes it just > > works... > > Not sure if i can finish it today, and here in Russia we have New Year > > holidays > > until 11th. > > Oops, I made a mistake here. I got vhost_user_read() and vhost_user_write() > backwards. But nevertheless they do the right thing. vhost_user_read() actually writes the message into socket, and vhost_user_write() reads it. So they should work correctly. I've just checked, fd number is not corrupted. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
[dpdk-dev] [RFC 0/5] virtio support for container
Hello! > > a) ovs_in_container does not send VHOST_USER_SET_MEM_TABLE > Please check if rte_eth_dev_start() is called. > (rte_eth_dev_start -> virtio_dev_start -> vtpci_reinit_complete -> > kick_all_vq) I've figured out what happened, and it's my fault only :( I have modified your patchset and added --shared-mem option. And forgot to specify it to gdb :) Without it memory is not shared, and rte_memseg_info_get() returned fd = -1. And if you put it into control message for sendmsg(), you get your -EBADF. So please ignore this. But, nevertheless, ovs in container still dies with: --- cut --- Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fff97fff700 (LWP 3866)] virtio_recv_mergeable_pkts (rx_queue=0x7fffd46a9a80, rx_pkts=0x7fff97ffe850, nb_pkts=32) at /home/p.fedin/dpdk/drivers/net/virtio/virtio_rxtx.c:683 683 /home/p.fedin/dpdk/drivers/net/virtio/virtio_rxtx.c: No such file or directory. Missing separate debuginfos, use: dnf debuginfo-install keyutils-libs-1.5.9-7.fc23.x86_64 krb5-libs-1.13.2-11.fc23.x86_64 libcap-ng-0.7.7-2.fc23.x86_64 libcom_err-1.42.13-3.fc23.x86_64 libselinux-2.4-4.fc23.x86_64 openssl-libs-1.0.2d-2.fc23.x86_64 pcre-8.37-4.fc23.x86_64 zlib-1.2.8-9.fc23.x86_64 (gdb) where #0 virtio_recv_mergeable_pkts (rx_queue=0x7fffd46a9a80, rx_pkts=0x7fff97ffe850, nb_pkts=32) at /home/p.fedin/dpdk/drivers/net/virtio/virtio_rxtx.c:683 #1 0x00669ee8 in rte_eth_rx_burst (nb_pkts=32, rx_pkts=0x7fff97ffe850, queue_id=0, port_id=0 '\000') at /home/p.fedin/dpdk/build/include/rte_ethdev.h:2510 #2 netdev_dpdk_rxq_recv (rxq_=, packets=0x7fff97ffe850, c=0x7fff97ffe84c) at lib/netdev-dpdk.c:1033 #3 0x005e8ca1 in netdev_rxq_recv (rx=, buffers=buffers at entry=0x7fff97ffe850, cnt=cnt at entry=0x7fff97ffe84c) at lib/netdev.c:654 #4 0x005cb338 in dp_netdev_process_rxq_port (pmd=pmd at entry=0x7fffac7f8010, rxq=, port=, port=) at lib/dpif-netdev.c:2510 #5 0x005cc649 in pmd_thread_main (f_=0x7fffac7f8010) at lib/dpif-netdev.c:2671 #6 0x00628424 in ovsthread_wrapper (aux_=) at lib/ovs-thread.c:340 #7 0x770f660a in start_thread () from /lib64/libpthread.so.0 #8 0x76926bbd in clone () from /lib64/libc.so.6 (gdb) --- cut --- and l2fwd does not reproduce this. So, let's wait until 11.01.2016. And happy New Year to everybody who reads it (and who doesn't) :) Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
[dpdk-dev] [PATCH 00/12] Add API to get packet type info
HAPPRY NEW YEAR! A new ether API rte_eth_dev_get_ptype_info() is added to query what packet type information will be provided by current pmd driver of the specifed port. To achieve this, a new function pointer, dev_ptype_info_get, is added into struct eth_dev_ops. For those devices who do not implement it, it means it will not provide any ptype info. Jianfeng Tan (12): ethdev: add API to query what/if packet type is set pmd/cxgbe: add dev_ptype_info_get implementation pmd/e1000: add dev_ptype_info_get implementation pmd/enic: add dev_ptype_info_get implementation pmd/fm10k: add dev_ptype_info_get implementation pmd/i40e: add dev_ptype_info_get implementation pmd/ixgbe: add dev_ptype_info_get implementation pmd/mlx4: add dev_ptype_info_get implementation pmd/mlx5: add dev_ptype_info_get implementation pmd/nfp: add dev_ptype_info_get implementation pmd/vmxnet3: add dev_ptype_info_get implementation examples/l3fwd: add option to parse ptype drivers/net/cxgbe/cxgbe_ethdev.c | 17 +++ drivers/net/e1000/igb_ethdev.c | 48 drivers/net/enic/enic_ethdev.c | 20 + drivers/net/fm10k/fm10k_ethdev.c | 60 + drivers/net/fm10k/fm10k_rxtx.c | 5 +++ drivers/net/fm10k/fm10k_rxtx_vec.c | 5 +++ drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c| 1 + drivers/net/i40e/i40e_rxtx.c | 69 - drivers/net/i40e/i40e_rxtx.h | 2 + drivers/net/ixgbe/ixgbe_ethdev.c | 50 + drivers/net/ixgbe/ixgbe_ethdev.h | 2 + drivers/net/ixgbe/ixgbe_rxtx.c | 5 ++- drivers/net/mlx4/mlx4.c | 27 +++ drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_ethdev.c | 25 +++ drivers/net/mlx5/mlx5_rxtx.c | 2 + drivers/net/nfp/nfp_net.c| 18 drivers/net/vmxnet3/vmxnet3_ethdev.c | 20 + examples/l3fwd/main.c| 86 lib/librte_ether/rte_ethdev.c| 12 + lib/librte_ether/rte_ethdev.h| 22 + lib/librte_mbuf/rte_mbuf.h | 13 ++ 24 files changed, 511 insertions(+), 2 deletions(-) -- 2.1.4
[dpdk-dev] [PATCH 04/12] pmd/enic: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/enic/enic_ethdev.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 2a88043..112480e 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -54,6 +54,9 @@ #define ENICPMD_FUNC_TRACE() (void)0 #endif +static uint16_t enicpmd_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts); + /* * The set of PCI devices this driver supports */ @@ -431,6 +434,22 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, DEV_TX_OFFLOAD_TCP_CKSUM; } +static int enicpmd_dev_ptype_info_get(struct rte_eth_dev *dev, + uint32_t ptype_mask, uint32_t ptypes[]) +{ + int num = 0; + + if (dev->rx_pkt_burst == enicpmd_recv_pkts) { + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + } + } else + num = -ENOTSUP; + + return num; +} + static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev) { struct enic *enic = pmd_priv(eth_dev); @@ -566,6 +585,7 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = { .stats_reset = enicpmd_dev_stats_reset, .queue_stats_mapping_set = NULL, .dev_infos_get= enicpmd_dev_info_get, + .dev_ptype_info_get = enicpmd_dev_ptype_info_get, .mtu_set = NULL, .vlan_filter_set = enicpmd_vlan_filter_set, .vlan_tpid_set= NULL, -- 2.1.4
[dpdk-dev] [PATCH 01/12] ethdev: add API to query what/if packet type is set
Add a new API rte_eth_dev_get_ptype_info to query what/if packet type will be set by current rx burst function. Signed-off-by: Jianfeng Tan --- lib/librte_ether/rte_ethdev.c | 12 lib/librte_ether/rte_ethdev.h | 22 ++ lib/librte_mbuf/rte_mbuf.h| 13 + 3 files changed, 47 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index ed971b4..1885374 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1614,6 +1614,18 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info) dev_info->driver_name = dev->data->drv_name; } +int +rte_eth_dev_get_ptype_info(uint8_t port_id, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_ptype_info_get, -ENOTSUP); + return (*dev->dev_ops->dev_ptype_info_get)(dev, ptype_mask, ptypes); +} + void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr) { diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index bada8ad..e97b632 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1021,6 +1021,10 @@ typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); /**< @internal Get specific informations of an Ethernet device. */ +typedef int (*eth_dev_ptype_info_get_t)(struct rte_eth_dev *dev, + uint32_t ptype_mask, uint32_t ptypes[]); +/**< @internal Get ptype info of eth_rx_burst_t. */ + typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev, uint16_t queue_id); /**< @internal Start rx and tx of a queue of an Ethernet device. */ @@ -1347,6 +1351,7 @@ struct eth_dev_ops { eth_queue_stats_mapping_set_t queue_stats_mapping_set; /**< Configure per queue stat counter mapping. */ eth_dev_infos_get_tdev_infos_get; /**< Get device info. */ + eth_dev_ptype_info_get_t dev_ptype_info_get; /** Get ptype info */ mtu_set_t mtu_set; /**< Set MTU. */ vlan_filter_set_t vlan_filter_set; /**< Filter VLAN Setup. */ vlan_tpid_set_tvlan_tpid_set; /**< Outer VLAN TPID Setup. */ @@ -2273,6 +2278,23 @@ extern void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info); /** + * Retrieve the contextual information of an Ethernet device. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param ptype_mask + * A hint of what kind of packet type which the caller is interested in + * @param ptypes + * An array of packet types to be filled with + * @return + * - (>=0) if successful. Indicate number of valid values in ptypes array. + * - (-ENOTSUP) if hardware-assisted VLAN stripping not configured. + * - (-ENODEV) if *port_id* invalid. + */ +extern int rte_eth_dev_get_ptype_info(uint8_t port_id, +uint32_t ptype_mask, uint32_t ptypes[]); + +/** * Retrieve the MTU of an Ethernet device. * * @param port_id diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f234ac9..21d4aa2 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -282,6 +282,8 @@ extern "C" { * It is used for outer packet for tunneling cases. */ #define RTE_PTYPE_L2_MASK 0x000f + +#define RTE_PTYPE_L2_MAX_NUM 4 /** * IP (Internet Protocol) version 4 packet type. * It is used for outer packet for tunneling cases, and does not contain any @@ -349,6 +351,8 @@ extern "C" { * It is used for outer packet for tunneling cases. */ #define RTE_PTYPE_L3_MASK 0x00f0 + +#define RTE_PTYPE_L3_MAX_NUM 6 /** * TCP (Transmission Control Protocol) packet type. * It is used for outer packet for tunneling cases. @@ -435,6 +439,8 @@ extern "C" { * It is used for outer packet for tunneling cases. */ #define RTE_PTYPE_L4_MASK 0x0f00 + +#define RTE_PTYPE_L4_MAX_NUM 6 /** * IP (Internet Protocol) in IP (Internet Protocol) tunneling packet type. * @@ -508,6 +514,8 @@ extern "C" { * Mask of tunneling packet types. */ #define RTE_PTYPE_TUNNEL_MASK 0xf000 + +#define RTE_PTYPE_TUNNEL_MAX_NUM 6 /** * Ethernet packet type. * It is used for inner packet type only. @@ -527,6 +535,8 @@ extern "C" { * Mask of inner layer 2 packet types. */ #define RTE_PTYPE_INNER_L2_MASK 0x000f + +#define RTE_PTYPE_INNER_L2_MAX_NUM 2 /** * IP (Internet Protocol) version 4 packet type. * It is used for inner packet only, and does not co
[dpdk-dev] [PATCH 05/12] pmd/fm10k: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/fm10k/fm10k_ethdev.c | 60 ++ drivers/net/fm10k/fm10k_rxtx.c | 5 drivers/net/fm10k/fm10k_rxtx_vec.c | 5 3 files changed, 70 insertions(+) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index e4aed94..51e4fe0 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1335,6 +1335,65 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, }; } +#ifdef RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE +static int +fm10k_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + if ((dev->rx_pkt_burst == fm10k_recv_pkts) || + (dev->rx_pkt_burst == fm10k_recv_scattered_pkts)) { + /* refers to rx_desc_to_ol_flags() */ + if ((ptype_mask & RTE_PTYPE_L2_MASK) == RTE_PTYPE_L2_MASK) + ptypes[num++] = RTE_PTYPE_L2_ETHER; + + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV4_EXT; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + ptypes[num++] = RTE_PTYPE_L3_IPV6_EXT; + } + + if ((ptype_mask & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_MASK) { + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + } + } else if ((dev->rx_pkt_burst == fm10k_recv_pkts_vec) || + (dev->rx_pkt_burst == fm10k_recv_scattered_pkts_vec)) { + /* refers to fm10k_desc_to_pktype_v() */ + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV4_EXT; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + ptypes[num++] = RTE_PTYPE_L3_IPV6_EXT; + } + + if ((ptype_mask & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_MASK) { + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + } + + if ((ptype_mask & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_MASK) { + ptypes[num++] = RTE_PTYPE_TUNNEL_GENEVE; + ptypes[num++] = RTE_PTYPE_TUNNEL_NVGRE; + ptypes[num++] = RTE_PTYPE_TUNNEL_VXLAN; + ptypes[num++] = RTE_PTYPE_TUNNEL_GRE; + } + } else + num = -ENOTSUP; + + return num; +} +#else +static int +fm10k_dev_ptype_info_get(struct rte_eth_dev *dev __rte_unused, + uint32_t ptype_mask __rte_unused, + uint32_t ptypes[] __rte_unused) +{ + return -ENOTSUP; +} +#endif + static int fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) { @@ -2423,6 +2482,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = { .xstats_reset = fm10k_stats_reset, .link_update= fm10k_link_update, .dev_infos_get = fm10k_dev_infos_get, + .dev_ptype_info_get = fm10k_dev_ptype_info_get, .vlan_filter_set= fm10k_vlan_filter_set, .vlan_offload_set = fm10k_vlan_offload_set, .mac_addr_add = fm10k_macaddr_add, diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c index e958865..9b2d6f2 100644 --- a/drivers/net/fm10k/fm10k_rxtx.c +++ b/drivers/net/fm10k/fm10k_rxtx.c @@ -65,6 +65,11 @@ static inline void dump_rxd(union fm10k_rx_desc *rxd) } #endif +/* + * @note + * When this function is changed, make corresponding change to + * fm10k_dev_ptype_info_get() + */ static inline void rx_desc_to_ol_flags(struct rte_mbuf *m, const union fm10k_rx_desc *d) { diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c index 2a57eef..6fc22fc 100644 --- a/drivers/net/fm10k/fm10k_rxtx_vec.c +++ b/drivers/net/fm10k/fm10k_rxtx_vec.c @@ -109,6 +109,11 @@ fm10k_desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts) rx_pkts[3]->ol_flags = vol.e[3]; } +/* + * @note + * When this function is changed, make corresponding change to + * fm10k_dev_ptype_info_get() + */ static inline void fm10k_desc_to_pktype_v(__m128i descs[4], struct rte_mbuf **rx_pkts) { -- 2.1.4
[dpdk-dev] [PATCH 02/12] pmd/cxgbe: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/cxgbe/cxgbe_ethdev.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 97ef152..f17d5d5 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -767,6 +767,22 @@ static int cxgbe_flow_ctrl_set(struct rte_eth_dev *eth_dev, &pi->link_cfg); } +static int cxgbe_dev_ptype_info_get(struct rte_eth_dev *eth_dev __rte_unused, + uint32_t ptype_mask, uint32_t ptypes[]) +{ + int num = 0; + + if (eth_dev->rx_pkt_burst == cxgbe_recv_pkts) { + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + } + } else + num = -ENOTSUP; + + return num; +} + static struct eth_dev_ops cxgbe_eth_dev_ops = { .dev_start = cxgbe_dev_start, .dev_stop = cxgbe_dev_stop, @@ -777,6 +793,7 @@ static struct eth_dev_ops cxgbe_eth_dev_ops = { .allmulticast_disable = cxgbe_dev_allmulticast_disable, .dev_configure = cxgbe_dev_configure, .dev_infos_get = cxgbe_dev_info_get, + .dev_ptype_info_get = cxgbe_dev_ptype_info_get, .link_update= cxgbe_dev_link_update, .mtu_set= cxgbe_dev_mtu_set, .tx_queue_setup = cxgbe_dev_tx_queue_setup, -- 2.1.4
[dpdk-dev] [PATCH 06/12] pmd/i40e: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/i40e/i40e_ethdev.c| 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 69 ++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bf6220d..1f5251b 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -439,6 +439,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .xstats_reset = i40e_dev_stats_reset, .queue_stats_mapping_set = i40e_dev_queue_stats_mapping_set, .dev_infos_get= i40e_dev_info_get, + .dev_ptype_info_get = i40e_dev_ptype_info_get, .vlan_filter_set = i40e_vlan_filter_set, .vlan_tpid_set= i40e_vlan_tpid_set, .vlan_offload_set = i40e_vlan_offload_set, diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 14d2a50..5d924de 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -196,6 +196,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .xstats_reset = i40evf_dev_xstats_reset, .dev_close= i40evf_dev_close, .dev_infos_get= i40evf_dev_info_get, + .dev_ptype_info_get = i40e_dev_ptype_info_get, .vlan_filter_set = i40evf_vlan_filter_set, .vlan_offload_set = i40evf_vlan_offload_set, .vlan_pvid_set= i40evf_vlan_pvid_set, diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 39d94ec..bf4f504 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -194,7 +194,11 @@ i40e_get_iee15888_flags(struct rte_mbuf *mb, uint64_t qword) } #endif -/* For each value it means, datasheet of hardware can tell more details */ +/* + * For each value it means, datasheet of hardware can tell more details + * + * @note: fix i40e_dev_ptype_info_get() if any change here. + */ static inline uint32_t i40e_rxd_pkt_type_mapping(uint8_t ptype) { @@ -2094,6 +2098,69 @@ i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) } int +i40e_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if ((dev->rx_pkt_burst == i40e_recv_pkts) + || (dev->rx_pkt_burst == i40e_recv_scattered_pkts) +#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC + || (dev->rx_pkt_burst == i40e_recv_pkts_bulk_alloc) +#endif + ) { + /* refers to i40e_rxd_pkt_type_mapping() */ + if ((ptype_mask & RTE_PTYPE_L2_MASK) == RTE_PTYPE_L2_MASK) { + ptypes[num++] = RTE_PTYPE_L2_ETHER; + ptypes[num++] = RTE_PTYPE_L2_ETHER_TIMESYNC; + ptypes[num++] = RTE_PTYPE_L2_ETHER_LLDP; + ptypes[num++] = RTE_PTYPE_L2_ETHER_ARP; + } + + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; + ptypes[num++] = RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; + } + + if ((ptype_mask & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_MASK) { + ptypes[num++] = RTE_PTYPE_L4_FRAG; + ptypes[num++] = RTE_PTYPE_L4_ICMP; + ptypes[num++] = RTE_PTYPE_L4_NONFRAG; + ptypes[num++] = RTE_PTYPE_L4_SCTP; + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + } + + if ((ptype_mask & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_MASK) { + ptypes[num++] = RTE_PTYPE_TUNNEL_GRENAT; + ptypes[num++] = RTE_PTYPE_TUNNEL_IP; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L2_MASK) == RTE_PTYPE_INNER_L2_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L2_ETHER; + ptypes[num++] = RTE_PTYPE_INNER_L2_ETHER_VLAN; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L4_FRAG; + ptypes[num++] = RTE_PTYPE_INNER_L4_ICMP; + ptypes[num++] = RTE_PTYPE_INNER_L4_NONFRAG; + ptypes[num++] = RTE_PTYPE_INNER_L4_SCTP; + ptypes[num++] = RTE_PTYPE_INNER_L4_TCP; + pty
[dpdk-dev] [PATCH 03/12] pmd/e1000: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/e1000/igb_ethdev.c | 48 ++ 1 file changed, 48 insertions(+) diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index d1bbcda..0a9abd6 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -103,6 +103,8 @@ static void eth_igb_stats_reset(struct rte_eth_dev *dev); static void eth_igb_xstats_reset(struct rte_eth_dev *dev); static void eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); +static int eth_igb_ptype_info_get(struct rte_eth_dev *dev, + uint32_t ptype_mask, uint32_t ptypes[]); static void eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int eth_igb_flow_ctrl_get(struct rte_eth_dev *dev, @@ -319,6 +321,7 @@ static const struct eth_dev_ops eth_igb_ops = { .stats_reset = eth_igb_stats_reset, .xstats_reset = eth_igb_xstats_reset, .dev_infos_get= eth_igb_infos_get, + .dev_ptype_info_get = eth_igb_ptype_info_get, .mtu_set = eth_igb_mtu_set, .vlan_filter_set = eth_igb_vlan_filter_set, .vlan_tpid_set= eth_igb_vlan_tpid_set, @@ -376,6 +379,7 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = { .xstats_reset = eth_igbvf_stats_reset, .vlan_filter_set = igbvf_vlan_filter_set, .dev_infos_get= eth_igbvf_infos_get, + .dev_ptype_info_get = eth_igb_ptype_info_get, .rx_queue_setup = eth_igb_rx_queue_setup, .rx_queue_release = eth_igb_rx_queue_release, .tx_queue_setup = eth_igb_tx_queue_setup, @@ -1910,6 +1914,50 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_desc_lim = tx_desc_lim; } +static int +eth_igb_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if (dev->rx_pkt_burst == eth_igb_recv_pkts || + dev->rx_pkt_burst == eth_igb_recv_scattered_pkts) { + /* refers to igb_rxd_pkt_info_to_pkt_type() */ + + if ((ptype_mask & RTE_PTYPE_L2_MASK) == RTE_PTYPE_L2_MASK) + ptypes[num++] = RTE_PTYPE_L2_ETHER; + + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV4_EXT; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + ptypes[num++] = RTE_PTYPE_L3_IPV6_EXT; + } + + if ((ptype_mask & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_MASK) { + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + ptypes[num++] = RTE_PTYPE_L4_SCTP; + } + + if ((ptype_mask & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_MASK) + ptypes[num++] = RTE_PTYPE_TUNNEL_IP; + + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6_EXT; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L4_TCP; + ptypes[num++] = RTE_PTYPE_INNER_L4_UDP; + } + } else + num = -ENOTSUP; + + return num; +} + static void eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { -- 2.1.4
[dpdk-dev] [PATCH 07/12] pmd/ixgbe: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/ixgbe/ixgbe_ethdev.c | 50 drivers/net/ixgbe/ixgbe_ethdev.h | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 5 +++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4c4c6df..de5c3a9 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -166,6 +166,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev, uint8_t is_rx); static void ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); +static int ixgbe_dev_ptype_info_get(struct rte_eth_dev *dev, + uint32_t ptype_mask, uint32_t ptypes[]); static void ixgbevf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); @@ -428,6 +430,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .xstats_reset = ixgbe_dev_xstats_reset, .queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set, .dev_infos_get= ixgbe_dev_info_get, + .dev_ptype_info_get = ixgbe_dev_ptype_info_get, .mtu_set = ixgbe_dev_mtu_set, .vlan_filter_set = ixgbe_vlan_filter_set, .vlan_tpid_set= ixgbe_vlan_tpid_set, @@ -512,6 +515,7 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = { .xstats_reset = ixgbevf_dev_stats_reset, .dev_close= ixgbevf_dev_close, .dev_infos_get= ixgbevf_dev_info_get, + .dev_ptype_info_get = ixgbe_dev_ptype_info_get, .mtu_set = ixgbevf_dev_set_mtu, .vlan_filter_set = ixgbevf_vlan_filter_set, .vlan_strip_queue_set = ixgbevf_vlan_strip_queue_set, @@ -2829,6 +2833,52 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->flow_type_rss_offloads = IXGBE_RSS_OFFLOAD_ALL; } +static int +ixgbe_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if ((dev->rx_pkt_burst == ixgbe_recv_pkts) + || (dev->rx_pkt_burst == ixgbe_recv_pkts_lro_single_alloc) + || (dev->rx_pkt_burst == ixgbe_recv_pkts_lro_bulk_alloc) + || (dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc) + ) { + /* refers to ixgbe_rxd_pkt_info_to_pkt_type() */ + if ((ptype_mask & RTE_PTYPE_L2_MASK) == RTE_PTYPE_L2_MASK) + ptypes[num++] = RTE_PTYPE_L2_ETHER; + + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV4_EXT; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + ptypes[num++] = RTE_PTYPE_L3_IPV6_EXT; + } + + if ((ptype_mask & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_MASK) { + ptypes[num++] = RTE_PTYPE_L4_SCTP; + ptypes[num++] = RTE_PTYPE_L4_TCP; + ptypes[num++] = RTE_PTYPE_L4_UDP; + } + + if ((ptype_mask & RTE_PTYPE_TUNNEL_MASK) == RTE_PTYPE_TUNNEL_MASK) + ptypes[num++] = RTE_PTYPE_TUNNEL_IP; + + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6_EXT; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L4_TCP; + ptypes[num++] = RTE_PTYPE_INNER_L4_UDP; + } + } else + num = -ENOTSUP; + + return num; +} + static void ixgbevf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index d26771a..2479830 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -379,6 +379,8 @@ void ixgbevf_dev_rxtx_start(struct rte_eth_dev *dev); uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); +uint16_t ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts); uint16_t ixgbe_recv_pkts_lro_single_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 52a263c..d324
[dpdk-dev] [PATCH 08/12] pmd/mlx4: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/mlx4/mlx4.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 207bfe2..85afa32 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -2836,6 +2836,8 @@ rxq_cleanup(struct rxq *rxq) * @param flags * RX completion flags returned by poll_length_flags(). * + * @note: fix mlx4_dev_ptype_info_get() if any change here. + * * @return * Packet type for struct rte_mbuf. */ @@ -4268,6 +4270,30 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) priv_unlock(priv); } +static int +mlx4_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if ((dev->rx_pkt_burst == mlx4_rx_burst) + || (dev->rx_pkt_burst == mlx4_rx_burst_sp)) { + /* refers to rxq_cq_to_pkt_type() */ + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV4; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6; + } + } else + num = -ENOTSUP; + + return num; +} + /** * DPDK callback to get device statistics. * @@ -4989,6 +5015,7 @@ static const struct eth_dev_ops mlx4_dev_ops = { .stats_reset = mlx4_stats_reset, .queue_stats_mapping_set = NULL, .dev_infos_get = mlx4_dev_infos_get, + .dev_ptypes_info_get = mlx4_dev_ptype_info_get, .vlan_filter_set = mlx4_vlan_filter_set, .vlan_tpid_set = NULL, .vlan_strip_queue_set = NULL, -- 2.1.4
[dpdk-dev] [PATCH 09/12] pmd/mlx5: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/mlx5/mlx5.c| 1 + drivers/net/mlx5/mlx5.h| 2 ++ drivers/net/mlx5/mlx5_ethdev.c | 25 + drivers/net/mlx5/mlx5_rxtx.c | 2 ++ 4 files changed, 30 insertions(+) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 821ee0f..e18b1e9 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -153,6 +153,7 @@ static const struct eth_dev_ops mlx5_dev_ops = { .stats_get = mlx5_stats_get, .stats_reset = mlx5_stats_reset, .dev_infos_get = mlx5_dev_infos_get, + .dev_ptype_info_get = mlx5_dev_ptype_info_get, .vlan_filter_set = mlx5_vlan_filter_set, .rx_queue_setup = mlx5_rx_queue_setup, .tx_queue_setup = mlx5_tx_queue_setup, diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index b84d31d..928193d 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -156,6 +156,8 @@ int priv_get_mtu(struct priv *, uint16_t *); int priv_set_flags(struct priv *, unsigned int, unsigned int); int mlx5_dev_configure(struct rte_eth_dev *); void mlx5_dev_infos_get(struct rte_eth_dev *, struct rte_eth_dev_info *); +int mlx5_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]); int mlx5_link_update(struct rte_eth_dev *, int); int mlx5_dev_set_mtu(struct rte_eth_dev *, uint16_t); int mlx5_dev_get_flow_ctrl(struct rte_eth_dev *, struct rte_eth_fc_conf *); diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 1159fa3..aab7e06 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -526,6 +526,31 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) priv_unlock(priv); } +int +mlx5_dev_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if ((dev->rx_pkt_burst == mlx5_rx_burst) + || (dev->rx_pkt_burst == mlx5_rx_burst_sp)) { + /* refers to rxq_cq_to_pkt_type() */ + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4; + ptypes[num++] = RTE_PTYPE_L3_IPV6; + } + + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV4; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6; + } + } else + num = -ENOTSUP; + + return num; + +} + /** * DPDK callback to retrieve physical link information (unlocked version). * diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index fa5e648..79bdf8d 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -603,6 +603,8 @@ stop: * @param flags * RX completion flags returned by poll_length_flags(). * + * @note: fix mlx5_dev_ptype_info_get() if any change here. + * * @return * Packet type for struct rte_mbuf. */ -- 2.1.4
[dpdk-dev] [PATCH 10/12] pmd/nfp: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/nfp/nfp_net.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index bc2089f..c121d7b 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -1075,6 +1075,23 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) #endif } +static int +nfp_net_ptype_info_get(struct rte_eth_dev *dev, uint32_t ptype_mask, + uint32_t ptypes[]) +{ + int num = 0; + + if (dev->rx_pkt_burst == nfp_net_recv_pkts) { + /* refers to nfp_net_set_hash() */ + if ((ptype_mask & RTE_PTYPE_INNER_L3_MASK) == RTE_PTYPE_INNER_L3_MASK) { + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV4; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6; + ptypes[num++] = RTE_PTYPE_INNER_L3_IPV6_EXT; + ptypes[num++] = RTE_PTYPE_INNER_L4_MASK; + } + } +} + static uint32_t nfp_net_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx) { @@ -2294,6 +2311,7 @@ static struct eth_dev_ops nfp_net_eth_dev_ops = { .stats_get = nfp_net_stats_get, .stats_reset= nfp_net_stats_reset, .dev_infos_get = nfp_net_infos_get, + .dev_ptype_info_get = nfp_net_ptype_info_get, .mtu_set= nfp_net_dev_mtu_set, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update= nfp_net_reta_update, -- 2.1.4
[dpdk-dev] [PATCH 11/12] pmd/vmxnet3: add dev_ptype_info_get implementation
Signed-off-by: Jianfeng Tan --- drivers/net/vmxnet3/vmxnet3_ethdev.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index c363bf6..6bc8d9a 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -86,6 +86,8 @@ static void vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); static void vmxnet3_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); +static int vmxnet3_dev_ptype_info_get(struct rte_eth_dev *dev, + uint32_t ptype_mask, uint32_t ptypes[]); static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on); static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); @@ -118,6 +120,7 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = { .link_update = vmxnet3_dev_link_update, .stats_get= vmxnet3_dev_stats_get, .dev_infos_get= vmxnet3_dev_info_get, + .dev_ptype_info_get = vmxnet3_dev_ptype_info_get, .vlan_filter_set = vmxnet3_dev_vlan_filter_set, .vlan_offload_set = vmxnet3_dev_vlan_offload_set, .rx_queue_setup = vmxnet3_dev_rx_queue_setup, @@ -718,6 +721,23 @@ vmxnet3_dev_info_get(__attribute__((unused))struct rte_eth_dev *dev, struct rte_ }; } +static int +vmxnet3_dev_ptype_info_get(struct rte_eth_dev *dev, + uint32_t ptype_mask, uint32_t ptypes[]) +{ + int num = 0; + + if (dev->rx_pkt_burst == vmxnet3_recv_pkts) { + if ((ptype_mask & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_MASK) { + ptypes[num++] = RTE_PTYPE_L3_IPV4_EXT; + ptypes[num++] = RTE_PTYPE_L3_IPV4; + } + } else + num = -ENOTSUP; + + return num; +} + /* return 0 means link status changed, -1 means not changed */ static int vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wait_to_complete) -- 2.1.4
[dpdk-dev] [PATCH 12/12] examples/l3fwd: add option to parse ptype
Firstly, use rte_eth_dev_get_ptype_info() API to check if device will parse needed packet type. If not, specifying the newly added option, --parse-ptype to do it in the callback softly. Signed-off-by: Jianfeng Tan --- examples/l3fwd/main.c | 86 +++ 1 file changed, 86 insertions(+) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 5b0c2dd..ccbdce3 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -174,6 +174,7 @@ static __m128i val_eth[RTE_MAX_ETHPORTS]; static uint32_t enabled_port_mask = 0; static int promiscuous_on = 0; /**< Ports set in promiscuous mode off by default. */ static int numa_on = 1; /**< NUMA is enabled by default. */ +static int parse_ptype = 0; /**< parse packet type using rx callback */ #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) static int ipv6 = 0; /**< ipv6 is false by default. */ @@ -2022,6 +2023,7 @@ parse_eth_dest(const char *optarg) #define CMD_LINE_OPT_IPV6 "ipv6" #define CMD_LINE_OPT_ENABLE_JUMBO "enable-jumbo" #define CMD_LINE_OPT_HASH_ENTRY_NUM "hash-entry-num" +#define CMD_LINE_OPT_PARSE_PTYPE "parse-ptype" /* Parse the argument given in the command line of the application */ static int @@ -2038,6 +2040,7 @@ parse_args(int argc, char **argv) {CMD_LINE_OPT_IPV6, 0, 0, 0}, {CMD_LINE_OPT_ENABLE_JUMBO, 0, 0, 0}, {CMD_LINE_OPT_HASH_ENTRY_NUM, 1, 0, 0}, + {CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0}, {NULL, 0, 0, 0} }; @@ -2125,6 +2128,12 @@ parse_args(int argc, char **argv) } } #endif + if (!strncmp(lgopts[option_index].name, CMD_LINE_OPT_PARSE_PTYPE, + sizeof(CMD_LINE_OPT_PARSE_PTYPE))) { + printf("soft parse-ptype is enabled \n"); + parse_ptype = 1; + } + break; default: @@ -2559,6 +2568,75 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) } } +static int +check_packet_type_ok(int portid) +{ + int i; + int ret; + uint32_t ptypes[RTE_PTYPE_L3_MAX_NUM]; + int ptype_l3_ipv4 = 0, ptype_l3_ipv6 = 0; + + ret = rte_eth_dev_get_ptype_info(portid, RTE_PTYPE_L3_MASK, ptypes); + for (i = 0; i < ret; ++i) { + if (ptypes[i] & RTE_PTYPE_L3_IPV4) + ptype_l3_ipv4 = 1; + if (ptypes[i] & RTE_PTYPE_L3_IPV6) + ptype_l3_ipv6 = 1; + } + + if (ptype_l3_ipv4 == 0) + printf("port %d cannot parse RTE_PTYPE_L3_IPV4\n", portid); + + if (ptype_l3_ipv6 == 0) + printf("port %d cannot parse RTE_PTYPE_L3_IPV6\n", portid); + + if (ptype_l3_ipv4 || ptype_l3_ipv6) + return 1; + + return 0; +} +static inline void +parse_packet_type(struct rte_mbuf *m) +{ + struct ether_hdr *eth_hdr; + struct vlan_hdr *vlan_hdr; + uint32_t packet_type = 0; + uint16_t ethertype; + + eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); + if (ethertype == ETHER_TYPE_VLAN) { + vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); + } + switch (ethertype) { + case ETHER_TYPE_IPv4: + packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; + break; + case ETHER_TYPE_IPv6: + packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; + break; + default: + break; + } + + m->packet_type = packet_type; +} + +static uint16_t +cb_parse_packet_type(uint8_t port __rte_unused, + uint16_t queue __rte_unused, + struct rte_mbuf *pkts[], + uint16_t nb_pkts, + uint16_t max_pkts __rte_unused, + void *user_param __rte_unused) +{ + unsigned i; + + for (i = 0; i < nb_pkts; ++i) + parse_packet_type(pkts[i]); +} + int main(int argc, char **argv) { @@ -2672,6 +2750,11 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); + if (!check_packet_type_ok(portid) && !parse_ptype) + rte_exit(EXIT_FAILURE, + "port %d cannot parse packet type, please add --%s\n", + portid, CMD_LINE_OPT_PARSE_PTYPE); + qconf = &lcore_conf[lcore_id]; qconf->tx_queue_id[portid] = queueid; queueid++; @@ -2705,6 +2788,9 @@ main(int argc, char **argv) if (ret < 0)
[dpdk-dev] [PATCH] eal: map io resources for non x86 architectures
On Tue, Dec 29, 2015 at 8:21 PM, Santosh Shukla wrote: > On Tue, Dec 29, 2015 at 7:34 PM, Alex Williamson > wrote: >> On Tue, 2015-12-29 at 16:17 +0530, Santosh Shukla wrote: >>> On Tue, Dec 29, 2015 at 3:26 PM, Burakov, Anatoly >>> wrote: >>> > Hi Santosh, >>> > >>> > > On Fri, Dec 18, 2015 at 6:25 PM, Santosh Shukla >> > > om> >>> > > wrote: >>> > > > On Fri, Dec 18, 2015 at 1:51 PM, Yuanhan Liu >>> > > > wrote: >>> > > > > On Fri, Dec 18, 2015 at 01:24:41PM +0530, Santosh Shukla >>> > > > > wrote: >>> > > > > > > > I guess we have done enough evaluation / investigation >>> > > > > > > > that >>> > > > > > > > suggest - so to map iopci region to userspace in arch >>> > > > > > > > agnostic-way - >>> > > > > > > > >>> > > > > > > > # either we need to modify kernel >>> > > > > > > >- Make sure all the non-x86 arch to >>> > > > > > > > support >>> > > > > > > > mapping for iopci region (i.e. pci_mmap_page_range). I >>> > > > > > > > don;t >>> > > > > > > > think its a correct approach though. >>> > > > > > > > or >>> > > > > > > >- include /dev/ioport char-mem device >>> > > > > > > > file who >>> > > > > > > > could do more than byte operation, Note that this >>> > > > > > > > implementation >>> > > > > > > > does not exist in kernel. I could send an RFC to lkml. >>> > > > > > > >>> > > > > > > Maybe you could propose the two to lkml, to get some >>> > > > > > > feedbacks >>> > > > > > > from those kernel/ARM gurus? Please cc me if you do so. >>> > > > > > > >>> > > > > > >>> > > > > > The latter one I already shared old lkml thread, Pl. >>> > > > > > revisit my v1 >>> > > > > > 0/6 patch [1] and in that refer [2]. >>> > > > > >>> > > > > Oops, sorry, a bit busy, that I didn't look at it carefully. >>> > > > > My bad, >>> > > > > anyway. >>> > > > > >>> > > > > > Josh has already proposed to lkml but for some reason >>> > > > > > thread didn't >>> > > > > > went far. I can restart that discussion giving dpdk use- >>> > > > > > case as an >>> > > > > > example/ requirement. >>> > > > > >>> > > > > I had a quick go through of the discussion. Both hpa and Arnd >>> > > > > seem to >>> > > > > be fine with the ioctl interface on /dev/port. Have you tried >>> > > > > that? >>> > > > > And if you want to restart it, ioctl might be a better option >>> > > > > than >>> > > > > /dev/ioport, judging from the discussion. >>> > > > > >>> > > > >>> > > > I tried legacy patch and re-writing with ioctl-way; doing >>> > > > changes in >>> > > > dpdk port as well in kernel, had to test on quite other hw not >>> > > > only >>> > > > arm64 though! so it will take time for me, I am travelling >>> > > > tomorrow so >>> > > > bit delayed, We'll post patch to lkml and share dpdk-virtio >>> > > > feedback >>> > > > perhaps by Monday. >>> > > > >>> > > >>> > > I posted a query about /dev/ioports approach in lkml thread [1], >>> > > and Arnd >>> > > suggested to use vfio framework but it looks like vfio too does >>> > > not map >>> > > ioresource_io region. Same communicated to Arnd and waiting for >>> > > his reply. >>> > > >>> > > In mean time I like to ask general question; >>> > > - Has anyone tried vfio/non-iommu approach for virtio pmd driver? >>> > > If not >>> > > then Is there any plan? Someone planning to take up. >>> > > [1] https://lkml.org/lkml/2015/12/23/145 >>> > >>> > I have submitted a patch to support no-iommu mode, but I'm not >>> > aware of anyone trying VFIO-noiommu at all. That's probably >>> > expected since it's Christmas/New Year in a lot of places, and >>> > everyone is on a break. >>> > >>> > That said, I'm not sure I completely understand what is it that >>> > you're asking about. The code you're referring to (in vfio_pci.c, >>> > line 854 as of kernel 4.3) is checking if a PCI BAR is available >>> > for IO (hence checking if the IORESOURCE_MEM >>> >>> >>> Thanks for reply! You comment might help to move this discuss to next >>> level. >>> >>> Look at kernel/resource.c, it exports two symbol ioport_resource and >>> iomem_resource and sets appropriate flag type i.e.. IORESOURCE_IO and >>> IORESOURCE_MEM. In virtio-net case; it creates both pci region i.e.. >>> _io bar and _mem bar. dpdk virtio pmd driver (<= 0.95 virtio spec) >>> uses pci _io bar region for device initialization as virtio headers >>> are locate at pci _io bar region. Since it uses pci _iobar region so >>> likely it update pci_resource.[index].flag = IORESOURCE_IO. and vfio >>> mmap function wont handle ioresource_io (i guess). And that is why I >>> asked same to lkml thread. >>> >>> >>> bit is set). There isn't any "ioresource_mem" region as far as VFIO >>> is >>> concerned, there are only BARs, ROM, VGA and PCI >>> config regions (linux/vfio.h, line 314 as of kernel 4.3). So if >>> you're >>> missing some PCI regions for VFIO to map, they would first need to be >>> added to VFIO kernel implementation before they can be used by DPDK. >>> That is, unless I'm misunderstanding something :) >>
[dpdk-dev] VFIO no-iommu
On Wed, Dec 23, 2015 at 4:49 PM, Burakov, Anatoly wrote: > Hi Alex, > >> I've re-posted the unified patch upstream and it should start showing up in >> the next linux-next build. I expect the dpdk code won't be merged until >> after this gets back into a proper kernel, but could we get the dpdk >> modifications posted as rfc for others looking to try it? > > I have already posted a patch that should work with No-IOMMU. > > http://dpdk.org/dev/patchwork/patch/9619/ > > Apologies for not CC-ing you. I too would be interested to know if other > people are having any issues with the patch. > I tried this patch for virtio-net pmd driver on arm64 and It worked for me. I didn't reviewed patch, but functionally nothing broke in my test environment, we'll review as time permit.. for now Tested-by: Santosh Shukla > Thanks, > Anatoly
[dpdk-dev] [RFC 0/5] virtio support for container
Hello! Last minute note. I have found the problem but have no time to research and fix it. It happens because ovs first creates the device, starts it, then stops it, and reconfigures queues. The second queue allocation happens from within netdev_set_multiq(). Then ovs restarts the device and proceeds to actually using it. But, queues are not initialized properly in DPDK after the second allocation. Because of this thing: /* On restart after stop do not touch queues */ if (hw->started) return 0; It keeps us away from calling virtio_dev_rxtx_start(), which should in turn call virtio_dev_vring_start(), which calls vring_init(). So, VIRTQUEUE_NUSED() dies badly because vq->vq_ring all contains NULLs. See you all after 10th. And happy New Year again! Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia > -Original Message- > From: Pavel Fedin [mailto:p.fedin at samsung.com] > Sent: Thursday, December 31, 2015 4:47 PM > To: 'Tan, Jianfeng'; 'dev at dpdk.org' > Subject: RE: [dpdk-dev] [RFC 0/5] virtio support for container > > Hello! > > > > a) ovs_in_container does not send VHOST_USER_SET_MEM_TABLE > > Please check if rte_eth_dev_start() is called. > > (rte_eth_dev_start -> virtio_dev_start -> vtpci_reinit_complete -> > > kick_all_vq) > > I've figured out what happened, and it's my fault only :( I have modified > your patchset and > added --shared-mem option. And forgot to specify it to gdb :) Without it > memory is not shared, > and rte_memseg_info_get() returned fd = -1. And if you put it into control > message for > sendmsg(), you get your -EBADF. > So please ignore this. > But, nevertheless, ovs in container still dies with: > --- cut --- > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 0x7fff97fff700 (LWP 3866)] > virtio_recv_mergeable_pkts (rx_queue=0x7fffd46a9a80, rx_pkts=0x7fff97ffe850, > nb_pkts=32) at > /home/p.fedin/dpdk/drivers/net/virtio/virtio_rxtx.c:683 > 683 /home/p.fedin/dpdk/drivers/net/virtio/virtio_rxtx.c: No such file or > directory. > Missing separate debuginfos, use: dnf debuginfo-install > keyutils-libs-1.5.9-7.fc23.x86_64 > krb5-libs-1.13.2-11.fc23.x86_64 libcap-ng-0.7.7-2.fc23.x86_64 > libcom_err-1.42.13- > 3.fc23.x86_64 libselinux-2.4-4.fc23.x86_64 openssl-libs-1.0.2d-2.fc23.x86_64 > pcre-8.37- > 4.fc23.x86_64 zlib-1.2.8-9.fc23.x86_64 > (gdb) where > #0 virtio_recv_mergeable_pkts (rx_queue=0x7fffd46a9a80, > rx_pkts=0x7fff97ffe850, nb_pkts=32) > at /home/p.fedin/dpdk/drivers/net/virtio/virtio_rxtx.c:683 > #1 0x00669ee8 in rte_eth_rx_burst (nb_pkts=32, > rx_pkts=0x7fff97ffe850, queue_id=0, > port_id=0 '\000') at /home/p.fedin/dpdk/build/include/rte_ethdev.h:2510 > #2 netdev_dpdk_rxq_recv (rxq_=, packets=0x7fff97ffe850, > c=0x7fff97ffe84c) at > lib/netdev-dpdk.c:1033 > #3 0x005e8ca1 in netdev_rxq_recv (rx=, > buffers=buffers at entry=0x7fff97ffe850, cnt=cnt at entry=0x7fff97ffe84c) at > lib/netdev.c:654 > #4 0x005cb338 in dp_netdev_process_rxq_port (pmd=pmd at > entry=0x7fffac7f8010, > rxq=, port=, port=) at > lib/dpif-netdev.c:2510 > #5 0x005cc649 in pmd_thread_main (f_=0x7fffac7f8010) at > lib/dpif-netdev.c:2671 > #6 0x00628424 in ovsthread_wrapper (aux_=) at > lib/ovs-thread.c:340 > #7 0x770f660a in start_thread () from /lib64/libpthread.so.0 > #8 0x76926bbd in clone () from /lib64/libc.so.6 > (gdb) > --- cut --- > > and l2fwd does not reproduce this. So, let's wait until 11.01.2016. And > happy New Year to > everybody who reads it (and who doesn't) :) > > Kind regards, > Pavel Fedin > Expert Engineer > Samsung Electronics Research center Russia
[dpdk-dev] [PATCH v5 2/3] examples/l2fwd: Handle SIGINT and SIGTERM in l2fwd
On Wed, 30 Dec 2015 16:59:50 -0500 Zhihong Wang wrote: > +static void > +signal_handler(int signum) > +{ > + if (signum == SIGINT || signum == SIGTERM) { > + printf("\n\nSignal %d received, preparing to exit...\n", > + signum); > + force_quit = true; Actually, the if () is redundant since you only registered SIGINT, and SIGTERM those are the only signals you could possibly receive. Acked-by: Stephen Hemminger
[dpdk-dev] Is there an interrupt mode PMD for virtio
On Tue, 29 Dec 2015 12:51:43 +0800 HePeng wrote: > Hi, > I am asking if there is an interrupt mode PMD for virtio driver. > I check with l3fwd-power code, it is based on VFIO driver. However, > it seems that current virtio driver does not support VFIO. > > Thanks. > HePeng I have a version that was posted once, that works but it required a different version of uio driver that provided MSI support. Since that uio driver required patching the kernel, and the kernel maintainer of UIO didn't want that patch, that work was abandoned. The intention is to use VFIO in no-IOMMU mode instead. Once VFIO with no-IOMMU is working, I will rework the virtio (and vmxnet3) changes to support that. If you want to help or do it your self, I can send the old code.
[dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
On Tue, 29 Dec 2015 10:53:26 +0800 Ziye Yang wrote: > This patch is used to add the class_id support > for pci_probe since some devices need the class_info > (class_code, subclass_code, programming_interface) > > Signed-off-by: Ziye Yang Since rte_pci is exposed to application this breaks the ABI.