[dpdk-dev] [PATCH v4 3/5] ethdev: add API to get hairpin peer ports list
Bing Zhao
bingz at nvidia.com
Thu Oct 15 06:03:57 CEST 2020
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon <thomas at monjalon.net>
> Sent: Wednesday, October 14, 2020 11:02 PM
> To: Bing Zhao <bingz at nvidia.com>
> Cc: Ori Kam <orika at nvidia.com>; ferruh.yigit at intel.com;
> arybchenko at solarflare.com; mdr at ashroe.eu; nhorman at tuxdriver.com;
> bernard.iremonger at intel.com; beilei.xing at intel.com;
> wenzhuo.lu at intel.com; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 3/5] ethdev: add API to get
> hairpin peer ports list
>
> External email: Use caution opening links or attachments
>
>
> 13/10/2020 18:19, Bing Zhao:
> > --- a/lib/librte_ethdev/rte_ethdev.c
> > +++ b/lib/librte_ethdev/rte_ethdev.c
> > @@ -2208,6 +2208,30 @@ struct rte_eth_dev *
> > return ret;
> > }
> >
> > +int
> > +rte_eth_hairpin_get_peer_ports(uint16_t cur_port, uint16_t
> *peer_ports,
> > + size_t len, uint32_t direction) {
> > + struct rte_eth_dev *dev;
> > + int ret;
> > +
> > + if (!peer_ports || !len)
> > + return -EINVAL;
> > +
> > + RTE_ETH_VALID_PORTID_OR_ERR_RET(cur_port, -EINVAL);
>
> should be -ENODEV
Fixed
>
> > + dev = &rte_eth_devices[cur_port];
> > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops-
> >hairpin_get_peer_ports,
> > + -ENOTSUP);
> > +
> > + ret = (*dev->dev_ops->hairpin_get_peer_ports)(dev,
> peer_ports,
> > + len,
> direction);
> > + if (ret < 0)
> > + RTE_ETHDEV_LOG(ERR, "Failed to get %d hairpin
> peer %s ports",
> > + cur_port, direction ? "RX" : "TX");
>
> Missing \n
Thanks, done.
>
> > +
> > + return ret;
> > +}
> > --- a/lib/librte_ethdev/rte_ethdev.h
> > +++ b/lib/librte_ethdev/rte_ethdev.h
> > * @warning
> > * @b EXPERIMENTAL: this API may change, or be removed, without
> prior notice
> > *
> > + * Get all the hairpin peer RX / TX ports of the current port.
> > + * The caller should ensure that the array is large enough to
> save
> > + the ports
> > + * list.
> > + *
> > + * @param cur_port
> > + * The current port identifier of the Ethernet device.
>
> Why current? In general we use "port_id".
Changed to port_id
>
> > + * @param peer_ports
> > + * Pointer to the array to store the peer ports list.
> > + * @param len
> > + * Length of the array to store the port identifiers.
> > + * @param direction
> > + * Current port to peer port direction
> > + * positive - current used as TX to get all peer RX ports.
> > + * zero - current used as RX to get all peer TX ports.
> > + *
> > + * @return
> > + * - (0 or positive) actual peer ports number.
> > + * - (-EINVAL) if bad parameter.
> > + * - (-ENOTSUP) if hardware doesn't support.
> > + * - Others detailed errors from PMD drivers.
>
> Please add ENODEV
Done.
>
> > + */
> > +__rte_experimental
> > +int rte_eth_hairpin_get_peer_ports(uint16_t cur_port, uint16_t
> *peer_ports,
> > + size_t len, uint32_t direction);
>
>
Thanks a lot~
More information about the dev
mailing list