diff mbox

[API-NEXT] api: pktio api to enable/disable offload features

Message ID 1458555285-20317-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov March 21, 2016, 10:14 a.m. UTC
Introduce pktio offload functions api to enable and disable
such offload features like rx and tx check sum, tso, gro, lro
and etc..
Getting state of that features if needed might be retrieved with
odp_pktio_print().

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 include/odp/api/spec/packet_io.h         |   1 +
 include/odp/api/spec/packet_io_offload.h | 140 +++++++++++++++++++++++++++++++
 platform/Makefile.inc                    |   1 +
 3 files changed, 142 insertions(+)
 create mode 100644 include/odp/api/spec/packet_io_offload.h

Comments

Maxim Uvarov March 21, 2016, 10:48 a.m. UTC | #1
On 03/21/16 13:25, Nikolay Nikolaev wrote:
> On Mon, Mar 21, 2016 at 12:14 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>> Introduce pktio offload functions api to enable and disable
>> such offload features like rx and tx check sum, tso, gro, lro
>> and etc..
>> Getting state of that features if needed might be retrieved with
>> odp_pktio_print().
> I believe that "print" is for debug/test purposes, maybe will be
> better to have the full set/get pair?
>
> regards,
> Nikolay Nikolaev

That is first version which we can discuss. Options are: 1) add separate 
function per each option.
2) add some bit mask to odp_pktio_info() call and return current settings.

The reason why I did not add get to that version is might be app will 
not relay on default pktio
state after open() and will want to enable offloads. In that case app 
already know what is the state
of each offload. If you think it's reasonable to add also get states I 
can add them to v2.

Maxim.

>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>   include/odp/api/spec/packet_io.h         |   1 +
>>   include/odp/api/spec/packet_io_offload.h | 140 +++++++++++++++++++++++++++++++
>>   platform/Makefile.inc                    |   1 +
>>   3 files changed, 142 insertions(+)
>>   create mode 100644 include/odp/api/spec/packet_io_offload.h
>>
>> diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
>> index 6fe2cac..b237a58 100644
>> --- a/include/odp/api/spec/packet_io.h
>> +++ b/include/odp/api/spec/packet_io.h
>> @@ -18,6 +18,7 @@
>>   extern "C" {
>>   #endif
>>
>> +#include <odp/api/spec/packet_io_offload.h>
>>   #include <odp/api/spec/packet_io_stats.h>
>>   #include <odp/api/spec/queue.h>
>>
>> diff --git a/include/odp/api/spec/packet_io_offload.h b/include/odp/api/spec/packet_io_offload.h
>> new file mode 100644
>> index 0000000..ba19af6
>> --- /dev/null
>> +++ b/include/odp/api/spec/packet_io_offload.h
>> @@ -0,0 +1,140 @@
>> +/* Copyright (c) 2015, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:     BSD-3-Clause
>> + */
>> +
>> +/**
>> + * @file
>> + *
>> + * ODP Packet IO
>> + */
>> +
>> +#ifndef ODP_API_PACKET_IO_OFFLOAD_H_
>> +#define ODP_API_PACKET_IO_OFFLOAD_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +/** @addtogroup odp_packet_io
>> + *  @{
>> + */
>> +
>> +/**
>> + * Specifies whether RX checksumming should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_rx_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether TX checksumming should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_tx_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether TCP segmentation offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_tso_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether UDP fragmentation offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_ufo_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether generic segmentation offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_gso_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether generic receive offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_gro_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether large receive offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_lro_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether RX VLAN acceleration should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_rxvlan_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether RX VLAN acceleration should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_txvlan_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * @}
>> + */
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif
>> diff --git a/platform/Makefile.inc b/platform/Makefile.inc
>> index 62375a6..3138de8 100644
>> --- a/platform/Makefile.inc
>> +++ b/platform/Makefile.inc
>> @@ -41,6 +41,7 @@ odpapispecinclude_HEADERS = \
>>                    $(top_srcdir)/include/odp/api/spec/packet.h \
>>                    $(top_srcdir)/include/odp/api/spec/packet_flags.h \
>>                    $(top_srcdir)/include/odp/api/spec/packet_io.h \
>> +                 $(top_srcdir)/include/odp/api/spec/packet_io_offload.h \
>>                    $(top_srcdir)/include/odp/api/spec/packet_io_stats.h \
>>                    $(top_srcdir)/include/odp/api/spec/pool.h \
>>                    $(top_srcdir)/include/odp/api/spec/queue.h \
>> --
>> 2.7.1.250.gff4ea60
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov March 21, 2016, 10:48 a.m. UTC | #2
On 03/21/16 13:25, Nikolay Nikolaev wrote:
> On Mon, Mar 21, 2016 at 12:14 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>> Introduce pktio offload functions api to enable and disable
>> such offload features like rx and tx check sum, tso, gro, lro
>> and etc..
>> Getting state of that features if needed might be retrieved with
>> odp_pktio_print().
> I believe that "print" is for debug/test purposes, maybe will be
> better to have the full set/get pair?
>
> regards,
> Nikolay Nikolaev

That is first version which we can discuss. Options are: 1) add separate 
function per each option.
2) add some bit mask to odp_pktio_info() call and return current settings.

The reason why I did not add get to that version is might be app will 
not relay on default pktio
state after open() and will want to enable offloads. In that case app 
already know what is the state
of each offload. If you think it's reasonable to add also get states I 
can add them to v2.

Maxim.

>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>   include/odp/api/spec/packet_io.h         |   1 +
>>   include/odp/api/spec/packet_io_offload.h | 140 +++++++++++++++++++++++++++++++
>>   platform/Makefile.inc                    |   1 +
>>   3 files changed, 142 insertions(+)
>>   create mode 100644 include/odp/api/spec/packet_io_offload.h
>>
>> diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
>> index 6fe2cac..b237a58 100644
>> --- a/include/odp/api/spec/packet_io.h
>> +++ b/include/odp/api/spec/packet_io.h
>> @@ -18,6 +18,7 @@
>>   extern "C" {
>>   #endif
>>
>> +#include <odp/api/spec/packet_io_offload.h>
>>   #include <odp/api/spec/packet_io_stats.h>
>>   #include <odp/api/spec/queue.h>
>>
>> diff --git a/include/odp/api/spec/packet_io_offload.h b/include/odp/api/spec/packet_io_offload.h
>> new file mode 100644
>> index 0000000..ba19af6
>> --- /dev/null
>> +++ b/include/odp/api/spec/packet_io_offload.h
>> @@ -0,0 +1,140 @@
>> +/* Copyright (c) 2015, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:     BSD-3-Clause
>> + */
>> +
>> +/**
>> + * @file
>> + *
>> + * ODP Packet IO
>> + */
>> +
>> +#ifndef ODP_API_PACKET_IO_OFFLOAD_H_
>> +#define ODP_API_PACKET_IO_OFFLOAD_H_
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +/** @addtogroup odp_packet_io
>> + *  @{
>> + */
>> +
>> +/**
>> + * Specifies whether RX checksumming should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_rx_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether TX checksumming should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_tx_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether TCP segmentation offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_tso_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether UDP fragmentation offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_ufo_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether generic segmentation offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_gso_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether generic receive offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_gro_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether large receive offload should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_lro_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether RX VLAN acceleration should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_rxvlan_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * Specifies whether RX VLAN acceleration should be enabled.
>> + *
>> + * @param[in]  pktio           Ingress port pktio handle.
>> + * @param[in]  enable          1 - enable.
>> + *                             0 - disable.
>> + *
>> + * @retval                     0 on success
>> + * @retval                     !0 on failure
>> + */
>> +int odp_pktio_offload_txvlan_set(odp_pktio_t pktio, odp_bool_t enable);
>> +
>> +/**
>> + * @}
>> + */
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif
>> diff --git a/platform/Makefile.inc b/platform/Makefile.inc
>> index 62375a6..3138de8 100644
>> --- a/platform/Makefile.inc
>> +++ b/platform/Makefile.inc
>> @@ -41,6 +41,7 @@ odpapispecinclude_HEADERS = \
>>                    $(top_srcdir)/include/odp/api/spec/packet.h \
>>                    $(top_srcdir)/include/odp/api/spec/packet_flags.h \
>>                    $(top_srcdir)/include/odp/api/spec/packet_io.h \
>> +                 $(top_srcdir)/include/odp/api/spec/packet_io_offload.h \
>>                    $(top_srcdir)/include/odp/api/spec/packet_io_stats.h \
>>                    $(top_srcdir)/include/odp/api/spec/pool.h \
>>                    $(top_srcdir)/include/odp/api/spec/queue.h \
>> --
>> 2.7.1.250.gff4ea60
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 6fe2cac..b237a58 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -18,6 +18,7 @@ 
 extern "C" {
 #endif
 
+#include <odp/api/spec/packet_io_offload.h>
 #include <odp/api/spec/packet_io_stats.h>
 #include <odp/api/spec/queue.h>
 
diff --git a/include/odp/api/spec/packet_io_offload.h b/include/odp/api/spec/packet_io_offload.h
new file mode 100644
index 0000000..ba19af6
--- /dev/null
+++ b/include/odp/api/spec/packet_io_offload.h
@@ -0,0 +1,140 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Packet IO
+ */
+
+#ifndef ODP_API_PACKET_IO_OFFLOAD_H_
+#define ODP_API_PACKET_IO_OFFLOAD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup odp_packet_io
+ *  @{
+ */
+
+/**
+ * Specifies whether RX checksumming should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_rx_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * Specifies whether TX checksumming should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_tx_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * Specifies whether TCP segmentation offload should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_tso_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * Specifies whether UDP fragmentation offload should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_ufo_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * Specifies whether generic segmentation offload should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_gso_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * Specifies whether generic receive offload should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_gro_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * Specifies whether large receive offload should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_lro_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * Specifies whether RX VLAN acceleration should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_rxvlan_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * Specifies whether RX VLAN acceleration should be enabled.
+ *
+ * @param[in]	pktio		Ingress port pktio handle.
+ * @param[in]	enable		1 - enable.
+ *				0 - disable.
+ *
+ * @retval			0 on success
+ * @retval			!0 on failure
+ */
+int odp_pktio_offload_txvlan_set(odp_pktio_t pktio, odp_bool_t enable);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 62375a6..3138de8 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -41,6 +41,7 @@  odpapispecinclude_HEADERS = \
 		  $(top_srcdir)/include/odp/api/spec/packet.h \
 		  $(top_srcdir)/include/odp/api/spec/packet_flags.h \
 		  $(top_srcdir)/include/odp/api/spec/packet_io.h \
+		  $(top_srcdir)/include/odp/api/spec/packet_io_offload.h \
 		  $(top_srcdir)/include/odp/api/spec/packet_io_stats.h \
 		  $(top_srcdir)/include/odp/api/spec/pool.h \
 		  $(top_srcdir)/include/odp/api/spec/queue.h \