[dpdk-dev,v4] null: fake PMD capabilities
Checks
Commit Message
From: Paweł Małachowski <pawel.malachowski@atendesoftware.pl>
This allows for testing code which needs offloads to be supported.
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
---
drivers/net/null/rte_eth_null.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
Comments
On 12/14/2016 7:16 PM, Michał Mirosław wrote:
> From: Paweł Małachowski <pawel.malachowski@atendesoftware.pl>
>
> This allows for testing code which needs offloads to be supported.
>
> Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
> ---
> drivers/net/null/rte_eth_null.c | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> index 836d982..e60516f 100644
> --- a/drivers/net/null/rte_eth_null.c
> +++ b/drivers/net/null/rte_eth_null.c
> @@ -284,6 +284,9 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
> return 0;
> }
>
> +static void
> +eth_dev_void_ok(struct rte_eth_dev *dev __rte_unused) { return; }
> +
>
> static void
> eth_dev_info(struct rte_eth_dev *dev,
> @@ -304,6 +307,19 @@ eth_dev_info(struct rte_eth_dev *dev,
> dev_info->pci_dev = NULL;
> dev_info->reta_size = internals->reta_size;
> dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;
> + /* We hereby declare we can RX offload VLAN-s out of thin air (they are not there)
> + */
> + dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
> + DEV_RX_OFFLOAD_QINQ_STRIP;
> + /* We promise we will do any TX offloads before passing packets to /dev/null
> + */
> + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
> + DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |
> + DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM |
> + DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_UDP_TSO |
> + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_QINQ_INSERT |
> + DEV_TX_OFFLOAD_VXLAN_TNL_TSO | DEV_TX_OFFLOAD_GRE_TNL_TSO |
> + DEV_TX_OFFLOAD_IPIP_TNL_TSO | DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
What do you think reporting offload capa based on user provided devargs,
as suggested by Konstantin?And by default not report any.
> }
>
> static void
> @@ -477,7 +493,12 @@ static const struct eth_dev_ops ops = {
> .reta_update = eth_rss_reta_update,
> .reta_query = eth_rss_reta_query,
> .rss_hash_update = eth_rss_hash_update,
> - .rss_hash_conf_get = eth_rss_hash_conf_get
> + .rss_hash_conf_get = eth_rss_hash_conf_get,
> + /* Fake our capabilities */
> + .promiscuous_enable = eth_dev_void_ok,
> + .promiscuous_disable = eth_dev_void_ok,
> + .allmulticast_enable = eth_dev_void_ok,
> + .allmulticast_disable = eth_dev_void_ok
> };
>
> int
>
On Mon, Jan 09, 2017 at 12:07:36PM +0000, Ferruh Yigit wrote:
> On 12/14/2016 7:16 PM, Michał Mirosław wrote:
> > From: Paweł Małachowski <pawel.malachowski@atendesoftware.pl>
> >
> > This allows for testing code which needs offloads to be supported.
> >
> > Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
> > ---
> > drivers/net/null/rte_eth_null.c | 23 ++++++++++++++++++++++-
> > 1 file changed, 22 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> > index 836d982..e60516f 100644
> > --- a/drivers/net/null/rte_eth_null.c
> > +++ b/drivers/net/null/rte_eth_null.c
> > @@ -284,6 +284,9 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
> > return 0;
> > }
> >
> > +static void
> > +eth_dev_void_ok(struct rte_eth_dev *dev __rte_unused) { return; }
> > +
> >
> > static void
> > eth_dev_info(struct rte_eth_dev *dev,
> > @@ -304,6 +307,19 @@ eth_dev_info(struct rte_eth_dev *dev,
> > dev_info->pci_dev = NULL;
> > dev_info->reta_size = internals->reta_size;
> > dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;
> > + /* We hereby declare we can RX offload VLAN-s out of thin air (they are not there)
> > + */
> > + dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
> > + DEV_RX_OFFLOAD_QINQ_STRIP;
> > + /* We promise we will do any TX offloads before passing packets to /dev/null
> > + */
> > + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
> > + DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |
> > + DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM |
> > + DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_UDP_TSO |
> > + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_QINQ_INSERT |
> > + DEV_TX_OFFLOAD_VXLAN_TNL_TSO | DEV_TX_OFFLOAD_GRE_TNL_TSO |
> > + DEV_TX_OFFLOAD_IPIP_TNL_TSO | DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
>
> What do you think reporting offload capa based on user provided devargs,
> as suggested by Konstantin?And by default not report any.
I can see use of it for people that want to test software fallbacks for
their app. For those who need only a /dev/null port, it doesn't add any value.
Best Regards,
Michał Mirosław
On 1/11/2017 10:14 AM, Michał Mirosław wrote:
> On Mon, Jan 09, 2017 at 12:07:36PM +0000, Ferruh Yigit wrote:
>> On 12/14/2016 7:16 PM, Michał Mirosław wrote:
>>> From: Paweł Małachowski <pawel.malachowski@atendesoftware.pl>
>>>
>>> This allows for testing code which needs offloads to be supported.
>>>
>>> Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
>>> ---
>>> drivers/net/null/rte_eth_null.c | 23 ++++++++++++++++++++++-
>>> 1 file changed, 22 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
>>> index 836d982..e60516f 100644
>>> --- a/drivers/net/null/rte_eth_null.c
>>> +++ b/drivers/net/null/rte_eth_null.c
>>> @@ -284,6 +284,9 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
>>> return 0;
>>> }
>>>
>>> +static void
>>> +eth_dev_void_ok(struct rte_eth_dev *dev __rte_unused) { return; }
>>> +
>>>
>>> static void
>>> eth_dev_info(struct rte_eth_dev *dev,
>>> @@ -304,6 +307,19 @@ eth_dev_info(struct rte_eth_dev *dev,
>>> dev_info->pci_dev = NULL;
>>> dev_info->reta_size = internals->reta_size;
>>> dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;
>>> + /* We hereby declare we can RX offload VLAN-s out of thin air (they are not there)
>>> + */
>>> + dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
>>> + DEV_RX_OFFLOAD_QINQ_STRIP;
>>> + /* We promise we will do any TX offloads before passing packets to /dev/null
>>> + */
>>> + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
>>> + DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |
>>> + DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM |
>>> + DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_UDP_TSO |
>>> + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_QINQ_INSERT |
>>> + DEV_TX_OFFLOAD_VXLAN_TNL_TSO | DEV_TX_OFFLOAD_GRE_TNL_TSO |
>>> + DEV_TX_OFFLOAD_IPIP_TNL_TSO | DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
>>
>> What do you think reporting offload capa based on user provided devargs,
>> as suggested by Konstantin?And by default not report any.
>
> I can see use of it for people that want to test software fallbacks for
> their app. For those who need only a /dev/null port, it doesn't add any value.
That would help if user want to test some combination of offload flags,
instead of having all.
>
> Best Regards,
> Michał Mirosław
>
@@ -284,6 +284,9 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
return 0;
}
+static void
+eth_dev_void_ok(struct rte_eth_dev *dev __rte_unused) { return; }
+
static void
eth_dev_info(struct rte_eth_dev *dev,
@@ -304,6 +307,19 @@ eth_dev_info(struct rte_eth_dev *dev,
dev_info->pci_dev = NULL;
dev_info->reta_size = internals->reta_size;
dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;
+ /* We hereby declare we can RX offload VLAN-s out of thin air (they are not there)
+ */
+ dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |
+ DEV_RX_OFFLOAD_QINQ_STRIP;
+ /* We promise we will do any TX offloads before passing packets to /dev/null
+ */
+ dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
+ DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |
+ DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM |
+ DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_UDP_TSO |
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_QINQ_INSERT |
+ DEV_TX_OFFLOAD_VXLAN_TNL_TSO | DEV_TX_OFFLOAD_GRE_TNL_TSO |
+ DEV_TX_OFFLOAD_IPIP_TNL_TSO | DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
}
static void
@@ -477,7 +493,12 @@ static const struct eth_dev_ops ops = {
.reta_update = eth_rss_reta_update,
.reta_query = eth_rss_reta_query,
.rss_hash_update = eth_rss_hash_update,
- .rss_hash_conf_get = eth_rss_hash_conf_get
+ .rss_hash_conf_get = eth_rss_hash_conf_get,
+ /* Fake our capabilities */
+ .promiscuous_enable = eth_dev_void_ok,
+ .promiscuous_disable = eth_dev_void_ok,
+ .allmulticast_enable = eth_dev_void_ok,
+ .allmulticast_disable = eth_dev_void_ok
};
int