diff mbox series

[v4,03/41] bus/dpaa: add compatibility and helper macros

Message ID 20170909112132.13936-4-shreyansh.jain@nxp.com
State Superseded
Headers show
Series None | expand

Commit Message

Shreyansh Jain Sept. 9, 2017, 11:20 a.m. UTC
From: Hemant Agrawal <hemant.agrawal@nxp.com>


Linked list, bit operations and compatibility macros.

Signed-off-by: Geoff Thorpe <geoff.thorpe@nxp.com>

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 v3:
 - Removed checkpatch warning and duplicate PER_CPU macro
---
 drivers/bus/dpaa/include/compat.h    | 389 +++++++++++++++++++++++++++++++++++
 drivers/bus/dpaa/include/dpaa_bits.h |  65 ++++++
 drivers/bus/dpaa/include/dpaa_list.h | 101 +++++++++
 3 files changed, 555 insertions(+)
 create mode 100644 drivers/bus/dpaa/include/compat.h
 create mode 100644 drivers/bus/dpaa/include/dpaa_bits.h
 create mode 100644 drivers/bus/dpaa/include/dpaa_list.h

-- 
2.9.3

Comments

Ferruh Yigit Sept. 18, 2017, 2:49 p.m. UTC | #1
On 9/9/2017 12:20 PM, Shreyansh Jain wrote:
> From: Hemant Agrawal <hemant.agrawal@nxp.com>

> 

> Linked list, bit operations and compatibility macros.

> 

> Signed-off-by: Geoff Thorpe <geoff.thorpe@nxp.com>

> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>


<...>

> diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h

> new file mode 100644

> index 0000000..a1fd53e

> --- /dev/null

> +++ b/drivers/bus/dpaa/include/compat.h

> @@ -0,0 +1,389 @@

> +/*-

> + * This file is provided under a dual BSD/GPLv2 license. When using or

> + * redistributing this file, you may do so under either license.


The content of the file looks like for Linux, is the file coming from an
existing GPL license? If so, is it allowed to add BSD license to this?

> + *

> + *   BSD LICENSE

> + *

> + * Copyright 2011 Freescale Semiconductor, Inc.

> + * All rights reserved.

> + *

> + * Redistribution and use in source and binary forms, with or without

> + * modification, are permitted provided that the following conditions are met:

> + * * Redistributions of source code must retain the above copyright

> + * notice, this list of conditions and the following disclaimer.

> + * * Redistributions in binary form must reproduce the above copyright

> + * notice, this list of conditions and the following disclaimer in the

> + * documentation and/or other materials provided with the distribution.

> + * * Neither the name of the above-listed copyright holders nor the

> + * names of any contributors may be used to endorse or promote products

> + * derived from this software without specific prior written permission.

> + *

> + *   GPL LICENSE SUMMARY

> + *

> + * ALTERNATIVELY, this software may be distributed under the terms of the

> + * GNU General Public License ("GPL") as published by the Free Software

> + * Foundation, either version 2 of that License or (at your option) any

> + * later version.

> + *

> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE

> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE

> + * POSSIBILITY OF SUCH DAMAGE.

> + */


<...>

> +#ifdef ARRAY_SIZE

> +#undef ARRAY_SIZE

> +#endif

> +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))


Can re-use RTE_DIM

<...>

> +#define ASSERT(x) do {\

> +	if (!(x)) \

> +		rte_panic("DPAA: x"); \

> +} while (0)

> +#define DPAA_BUG_ON(x) ASSERT(!(x))


Can use RTE_ASSERT

<...>

> +

> +#ifndef __DPAA_LIST_H

> +#define __DPAA_LIST_H

> +

> +/****************/

> +/* Linked-lists */

> +/****************/


Do we need to maintain a linked list implementation, why no just use
sys/queue.h ones as done many places in DPDK?

> +

> +struct list_head {

> +	struct list_head *prev;

> +	struct list_head *next;

> +};

> +


<...>
Shreyansh Jain Sept. 19, 2017, 1:18 p.m. UTC | #2
On Monday 18 September 2017 08:19 PM, Ferruh Yigit wrote:
> On 9/9/2017 12:20 PM, Shreyansh Jain wrote:

>> From: Hemant Agrawal <hemant.agrawal@nxp.com>

>>

>> Linked list, bit operations and compatibility macros.

>>

>> Signed-off-by: Geoff Thorpe <geoff.thorpe@nxp.com>

>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> 

> <...>

> 

>> diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h

>> new file mode 100644

>> index 0000000..a1fd53e

>> --- /dev/null

>> +++ b/drivers/bus/dpaa/include/compat.h

>> @@ -0,0 +1,389 @@

>> +/*-

>> + * This file is provided under a dual BSD/GPLv2 license. When using or

>> + * redistributing this file, you may do so under either license.

> 

> The content of the file looks like for Linux, is the file coming from an

> existing GPL license? If so, is it allowed to add BSD license to this?

> 

>> + *

>> + *   BSD LICENSE

>> + *

>> + * Copyright 2011 Freescale Semiconductor, Inc.

>> + * All rights reserved.

>> + *

>> + * Redistribution and use in source and binary forms, with or without

>> + * modification, are permitted provided that the following conditions are met:

>> + * * Redistributions of source code must retain the above copyright

>> + * notice, this list of conditions and the following disclaimer.

>> + * * Redistributions in binary form must reproduce the above copyright

>> + * notice, this list of conditions and the following disclaimer in the

>> + * documentation and/or other materials provided with the distribution.

>> + * * Neither the name of the above-listed copyright holders nor the

>> + * names of any contributors may be used to endorse or promote products

>> + * derived from this software without specific prior written permission.

>> + *

>> + *   GPL LICENSE SUMMARY

>> + *

>> + * ALTERNATIVELY, this software may be distributed under the terms of the

>> + * GNU General Public License ("GPL") as published by the Free Software

>> + * Foundation, either version 2 of that License or (at your option) any

>> + * later version.

>> + *

>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE

>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE

>> + * POSSIBILITY OF SUCH DAMAGE.

>> + */

> 

> <...>

> 

>> +#ifdef ARRAY_SIZE

>> +#undef ARRAY_SIZE

>> +#endif

>> +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

> 

> Can re-use RTE_DIM


I can change this. Thanks for highlighting.

> 

> <...>

> 

>> +#define ASSERT(x) do {\

>> +	if (!(x)) \

>> +		rte_panic("DPAA: x"); \

>> +} while (0)

>> +#define DPAA_BUG_ON(x) ASSERT(!(x))

> 

> Can use RTE_ASSERT


I will change this.

> 

> <...>

> 

>> +

>> +#ifndef __DPAA_LIST_H

>> +#define __DPAA_LIST_H

>> +

>> +/****************/

>> +/* Linked-lists */

>> +/****************/

> 

> Do we need to maintain a linked list implementation, why no just use

> sys/queue.h ones as done many places in DPDK?

> 

>> +

>> +struct list_head {

>> +	struct list_head *prev;

>> +	struct list_head *next;

>> +};

>> +

> 

> <...>

> 


The underlying DPAA infrastructure code is shared between kernel and 
userspace. That is why, changing the internal headers (for example, 
using RTE_* queues) is something I want to avoid until absolutely 
necessary. The outer layers (drivers/*/dpaa/<here>) are something I am 
trying to keep as close to possible to DPDK.

-
Shreyansh
Ferruh Yigit Sept. 19, 2017, 1:40 p.m. UTC | #3
On 9/19/2017 2:18 PM, Shreyansh Jain wrote:
> On Monday 18 September 2017 08:19 PM, Ferruh Yigit wrote:

>> On 9/9/2017 12:20 PM, Shreyansh Jain wrote:

>>> From: Hemant Agrawal <hemant.agrawal@nxp.com>

>>>

>>> Linked list, bit operations and compatibility macros.

>>>

>>> Signed-off-by: Geoff Thorpe <geoff.thorpe@nxp.com>

>>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

>>

>> <...>

>>

>>> diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h

>>> new file mode 100644

>>> index 0000000..a1fd53e

>>> --- /dev/null

>>> +++ b/drivers/bus/dpaa/include/compat.h

>>> @@ -0,0 +1,389 @@

>>> +/*-

>>> + * This file is provided under a dual BSD/GPLv2 license. When using or

>>> + * redistributing this file, you may do so under either license.

>>

>> The content of the file looks like for Linux, is the file coming from an

>> existing GPL license? If so, is it allowed to add BSD license to this?

>>

>>> + *

>>> + *   BSD LICENSE

>>> + *

>>> + * Copyright 2011 Freescale Semiconductor, Inc.

>>> + * All rights reserved.

>>> + *

>>> + * Redistribution and use in source and binary forms, with or without

>>> + * modification, are permitted provided that the following conditions are met:

>>> + * * Redistributions of source code must retain the above copyright

>>> + * notice, this list of conditions and the following disclaimer.

>>> + * * Redistributions in binary form must reproduce the above copyright

>>> + * notice, this list of conditions and the following disclaimer in the

>>> + * documentation and/or other materials provided with the distribution.

>>> + * * Neither the name of the above-listed copyright holders nor the

>>> + * names of any contributors may be used to endorse or promote products

>>> + * derived from this software without specific prior written permission.

>>> + *

>>> + *   GPL LICENSE SUMMARY

>>> + *

>>> + * ALTERNATIVELY, this software may be distributed under the terms of the

>>> + * GNU General Public License ("GPL") as published by the Free Software

>>> + * Foundation, either version 2 of that License or (at your option) any

>>> + * later version.

>>> + *

>>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

>>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

>>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

>>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE

>>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

>>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

>>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

>>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

>>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

>>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE

>>> + * POSSIBILITY OF SUCH DAMAGE.

>>> + */

>>


<...>

>>> +

>>> +#ifndef __DPAA_LIST_H

>>> +#define __DPAA_LIST_H

>>> +

>>> +/****************/

>>> +/* Linked-lists */

>>> +/****************/

>>

>> Do we need to maintain a linked list implementation, why no just use

>> sys/queue.h ones as done many places in DPDK?

>>

>>> +

>>> +struct list_head {

>>> +	struct list_head *prev;

>>> +	struct list_head *next;

>>> +};

>>> +

>>

>> <...>

>>

> 

> The underlying DPAA infrastructure code is shared between kernel and 

> userspace. That is why, changing the internal headers (for example, 

> using RTE_* queues) is something I want to avoid until absolutely 

> necessary. The outer layers (drivers/*/dpaa/<here>) are something I am 

> trying to keep as close to possible to DPDK.


I understand you want to escape from maintaining a copy of common files
for DPDK, this has been done by many drivers, as not changing "base"
files, this makes sense.

But for this case, file is "dpaa_list.h" and as far as I can see all it
has is linked list implementation, this looked easy to exclude, but if
not you can ignore the comment.

> 

> -

> Shreyansh

>
Shreyansh Jain Sept. 19, 2017, 1:57 p.m. UTC | #4
On Tuesday 19 September 2017 07:10 PM, Ferruh Yigit wrote:
> On 9/19/2017 2:18 PM, Shreyansh Jain wrote:

>> On Monday 18 September 2017 08:19 PM, Ferruh Yigit wrote:

>>> On 9/9/2017 12:20 PM, Shreyansh Jain wrote:

>>>> From: Hemant Agrawal <hemant.agrawal@nxp.com>

>>>>

>>>> Linked list, bit operations and compatibility macros.

>>>>

>>>> Signed-off-by: Geoff Thorpe <geoff.thorpe@nxp.com>

>>>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

>>>

>>> <...>

>>>

>>>> diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h

>>>> new file mode 100644

>>>> index 0000000..a1fd53e

>>>> --- /dev/null

>>>> +++ b/drivers/bus/dpaa/include/compat.h

>>>> @@ -0,0 +1,389 @@

>>>> +/*-

>>>> + * This file is provided under a dual BSD/GPLv2 license. When using or

>>>> + * redistributing this file, you may do so under either license.

>>>

>>> The content of the file looks like for Linux, is the file coming from an

>>> existing GPL license? If so, is it allowed to add BSD license to this?

>>>

>>>> + *

>>>> + *   BSD LICENSE

>>>> + *

>>>> + * Copyright 2011 Freescale Semiconductor, Inc.

>>>> + * All rights reserved.

>>>> + *

>>>> + * Redistribution and use in source and binary forms, with or without

>>>> + * modification, are permitted provided that the following conditions are met:

>>>> + * * Redistributions of source code must retain the above copyright

>>>> + * notice, this list of conditions and the following disclaimer.

>>>> + * * Redistributions in binary form must reproduce the above copyright

>>>> + * notice, this list of conditions and the following disclaimer in the

>>>> + * documentation and/or other materials provided with the distribution.

>>>> + * * Neither the name of the above-listed copyright holders nor the

>>>> + * names of any contributors may be used to endorse or promote products

>>>> + * derived from this software without specific prior written permission.

>>>> + *

>>>> + *   GPL LICENSE SUMMARY

>>>> + *

>>>> + * ALTERNATIVELY, this software may be distributed under the terms of the

>>>> + * GNU General Public License ("GPL") as published by the Free Software

>>>> + * Foundation, either version 2 of that License or (at your option) any

>>>> + * later version.

>>>> + *

>>>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

>>>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

>>>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

>>>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE

>>>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

>>>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

>>>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

>>>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

>>>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

>>>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE

>>>> + * POSSIBILITY OF SUCH DAMAGE.

>>>> + */

>>>

> 

> <...>

> 

>>>> +

>>>> +#ifndef __DPAA_LIST_H

>>>> +#define __DPAA_LIST_H

>>>> +

>>>> +/****************/

>>>> +/* Linked-lists */

>>>> +/****************/

>>>

>>> Do we need to maintain a linked list implementation, why no just use

>>> sys/queue.h ones as done many places in DPDK?

>>>

>>>> +

>>>> +struct list_head {

>>>> +	struct list_head *prev;

>>>> +	struct list_head *next;

>>>> +};

>>>> +

>>>

>>> <...>

>>>

>>

>> The underlying DPAA infrastructure code is shared between kernel and

>> userspace. That is why, changing the internal headers (for example,

>> using RTE_* queues) is something I want to avoid until absolutely

>> necessary. The outer layers (drivers/*/dpaa/<here>) are something I am

>> trying to keep as close to possible to DPDK.

> 

> I understand you want to escape from maintaining a copy of common files

> for DPDK, this has been done by many drivers, as not changing "base"

> files, this makes sense.

> 

> But for this case, file is "dpaa_list.h" and as far as I can see all it

> has is linked list implementation, this looked easy to exclude, but if

> not you can ignore the comment.


Got your point. I will respin and see how much is the impact.
Thanks for inputs.

> 

>>

>> -

>> Shreyansh

>>

> 

>
Shreyansh Jain Sept. 26, 2017, 12:43 p.m. UTC | #5
On Tuesday 19 September 2017 07:27 PM, Shreyansh Jain wrote:
> On Tuesday 19 September 2017 07:10 PM, Ferruh Yigit wrote:

>> On 9/19/2017 2:18 PM, Shreyansh Jain wrote:

>>> On Monday 18 September 2017 08:19 PM, Ferruh Yigit wrote:

>>>> On 9/9/2017 12:20 PM, Shreyansh Jain wrote:

>>>>> From: Hemant Agrawal <hemant.agrawal@nxp.com>

>>>>>

>>>>> Linked list, bit operations and compatibility macros.

>>>>>

>>>>> Signed-off-by: Geoff Thorpe <geoff.thorpe@nxp.com>

>>>>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

>>>>


[...]

>>>>> + */

>>>>

>>

>> <...>

>>

>>>>> +

>>>>> +#ifndef __DPAA_LIST_H

>>>>> +#define __DPAA_LIST_H

>>>>> +

>>>>> +/****************/

>>>>> +/* Linked-lists */

>>>>> +/****************/

>>>>

>>>> Do we need to maintain a linked list implementation, why no just use

>>>> sys/queue.h ones as done many places in DPDK?

>>>>

>>>>> +

>>>>> +struct list_head {

>>>>> +    struct list_head *prev;

>>>>> +    struct list_head *next;

>>>>> +};

>>>>> +

>>>>

>>>> <...>

>>>>

>>>

>>> The underlying DPAA infrastructure code is shared between kernel and

>>> userspace. That is why, changing the internal headers (for example,

>>> using RTE_* queues) is something I want to avoid until absolutely

>>> necessary. The outer layers (drivers/*/dpaa/<here>) are something I am

>>> trying to keep as close to possible to DPDK.

>>

>> I understand you want to escape from maintaining a copy of common files

>> for DPDK, this has been done by many drivers, as not changing "base"

>> files, this makes sense.

>>

>> But for this case, file is "dpaa_list.h" and as far as I can see all it

>> has is linked list implementation, this looked easy to exclude, but if

>> not you can ignore the comment.

> 

> Got your point. I will respin and see how much is the impact.

> Thanks for inputs.


I tried to work around the dpaa_list.h use in DPAA code - but, the 
changes are subtle but large in number - though, restricted only to base 
framework.
I would prefer to skip this for a while as the driver is stable now. I 
would probably do this change in a incremental manner to keep it traceable.

Ferruh, Is that OK with you?
Ferruh Yigit Sept. 27, 2017, 11:09 p.m. UTC | #6
On 9/26/2017 1:43 PM, Shreyansh Jain wrote:
> On Tuesday 19 September 2017 07:27 PM, Shreyansh Jain wrote:

>> On Tuesday 19 September 2017 07:10 PM, Ferruh Yigit wrote:

>>> On 9/19/2017 2:18 PM, Shreyansh Jain wrote:

>>>> On Monday 18 September 2017 08:19 PM, Ferruh Yigit wrote:

>>>>> On 9/9/2017 12:20 PM, Shreyansh Jain wrote:

>>>>>> From: Hemant Agrawal <hemant.agrawal@nxp.com>

>>>>>>

>>>>>> Linked list, bit operations and compatibility macros.

>>>>>>

>>>>>> Signed-off-by: Geoff Thorpe <geoff.thorpe@nxp.com>

>>>>>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

>>>>>

> 

> [...]

> 

>>>>>> + */

>>>>>

>>>

>>> <...>

>>>

>>>>>> +

>>>>>> +#ifndef __DPAA_LIST_H

>>>>>> +#define __DPAA_LIST_H

>>>>>> +

>>>>>> +/****************/

>>>>>> +/* Linked-lists */

>>>>>> +/****************/

>>>>>

>>>>> Do we need to maintain a linked list implementation, why no just use

>>>>> sys/queue.h ones as done many places in DPDK?

>>>>>

>>>>>> +

>>>>>> +struct list_head {

>>>>>> +    struct list_head *prev;

>>>>>> +    struct list_head *next;

>>>>>> +};

>>>>>> +

>>>>>

>>>>> <...>

>>>>>

>>>>

>>>> The underlying DPAA infrastructure code is shared between kernel and

>>>> userspace. That is why, changing the internal headers (for example,

>>>> using RTE_* queues) is something I want to avoid until absolutely

>>>> necessary. The outer layers (drivers/*/dpaa/<here>) are something I am

>>>> trying to keep as close to possible to DPDK.

>>>

>>> I understand you want to escape from maintaining a copy of common files

>>> for DPDK, this has been done by many drivers, as not changing "base"

>>> files, this makes sense.

>>>

>>> But for this case, file is "dpaa_list.h" and as far as I can see all it

>>> has is linked list implementation, this looked easy to exclude, but if

>>> not you can ignore the comment.

>>

>> Got your point. I will respin and see how much is the impact.

>> Thanks for inputs.

> 

> I tried to work around the dpaa_list.h use in DPAA code - but, the 

> changes are subtle but large in number - though, restricted only to base 

> framework.

> I would prefer to skip this for a while as the driver is stable now. I 

> would probably do this change in a incremental manner to keep it traceable.

> 

> Ferruh, Is that OK with you?


That is OK, if it is not easy to escape from it.
diff mbox series

Patch

diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h
new file mode 100644
index 0000000..a1fd53e
--- /dev/null
+++ b/drivers/bus/dpaa/include/compat.h
@@ -0,0 +1,389 @@ 
+/*-
+ * This file is provided under a dual BSD/GPLv2 license. When using or
+ * redistributing this file, you may do so under either license.
+ *
+ *   BSD LICENSE
+ *
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the above-listed copyright holders nor the
+ * names of any contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ *   GPL LICENSE SUMMARY
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __COMPAT_H
+#define __COMPAT_H
+
+#include <sched.h>
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <stdint.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <pthread.h>
+#include <linux/types.h>
+#include <stdbool.h>
+#include <ctype.h>
+#include <malloc.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <limits.h>
+#include <assert.h>
+#include <dirent.h>
+#include <inttypes.h>
+#include <error.h>
+#include <rte_byteorder.h>
+#include <rte_atomic.h>
+#include <rte_spinlock.h>
+#include <rte_common.h>
+#include <rte_debug.h>
+
+/* The following definitions are primarily to allow the single-source driver
+ * interfaces to be included by arbitrary program code. Ie. for interfaces that
+ * are also available in kernel-space, these definitions provide compatibility
+ * with certain attributes and types used in those interfaces.
+ */
+
+/* Required compiler attributes */
+#define __maybe_unused	__rte_unused
+#define __always_unused	__rte_unused
+#define __packed	__rte_packed
+#define noinline	__attribute__((noinline))
+
+#define L1_CACHE_BYTES 64
+#define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES)))
+#define __stringify_1(x) #x
+#define __stringify(x)	__stringify_1(x)
+
+#ifdef ARRAY_SIZE
+#undef ARRAY_SIZE
+#endif
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+/* Debugging */
+#define prflush(fmt, args...) \
+	do { \
+		printf(fmt, ##args); \
+		fflush(stdout); \
+	} while (0)
+
+#define pr_crit(fmt, args...)	 prflush("CRIT:" fmt, ##args)
+#define pr_err(fmt, args...)	 prflush("ERR:" fmt, ##args)
+#define pr_warn(fmt, args...)	 prflush("WARN:" fmt, ##args)
+#define pr_info(fmt, args...)	 prflush(fmt, ##args)
+
+#ifdef RTE_LIBRTE_DPAA_DEBUG_BUS
+#ifdef pr_debug
+#undef pr_debug
+#endif
+#define pr_debug(fmt, args...)	printf(fmt, ##args)
+#else
+#define pr_debug(fmt, args...) {}
+#endif
+
+#define ASSERT(x) do {\
+	if (!(x)) \
+		rte_panic("DPAA: x"); \
+} while (0)
+#define DPAA_BUG_ON(x) ASSERT(!(x))
+
+/* Required types */
+typedef uint8_t		u8;
+typedef uint16_t	u16;
+typedef uint32_t	u32;
+typedef uint64_t	u64;
+typedef uint64_t	dma_addr_t;
+typedef cpu_set_t	cpumask_t;
+typedef uint32_t	phandle;
+typedef uint32_t	gfp_t;
+typedef uint32_t	irqreturn_t;
+
+#define IRQ_HANDLED	0
+#define request_irq	qbman_request_irq
+#define free_irq	qbman_free_irq
+
+#define __iomem
+#define GFP_KERNEL	0
+#define __raw_readb(p)	(*(const volatile unsigned char *)(p))
+#define __raw_readl(p)	(*(const volatile unsigned int *)(p))
+#define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); }
+
+/* to be used as an upper-limit only */
+#define NR_CPUS			64
+
+/* Waitqueue stuff */
+typedef struct { }		wait_queue_head_t;
+#define DECLARE_WAIT_QUEUE_HEAD(x) int dummy_##x __always_unused
+#define wake_up(x)		do { } while (0)
+
+/* I/O operations */
+static inline u32 in_be32(volatile void *__p)
+{
+	volatile u32 *p = __p;
+	return rte_be_to_cpu_32(*p);
+}
+
+static inline void out_be32(volatile void *__p, u32 val)
+{
+	volatile u32 *p = __p;
+	*p = rte_cpu_to_be_32(val);
+}
+
+#define dcbt_ro(p) __builtin_prefetch(p, 0)
+#define dcbt_rw(p) __builtin_prefetch(p, 1)
+
+#define dcbz(p) { asm volatile("dc zva, %0" : : "r" (p) : "memory"); }
+#define dcbz_64(p) dcbz(p)
+#define hwsync() rte_rmb()
+#define lwsync() rte_wmb()
+#define dcbf(p) { asm volatile("dc cvac, %0" : : "r"(p) : "memory"); }
+#define dcbf_64(p) dcbf(p)
+#define dccivac(p) { asm volatile("dc civac, %0" : : "r"(p) : "memory"); }
+
+#define dcbit_ro(p) \
+	do { \
+		dccivac(p);						\
+		asm volatile("prfm pldl1keep, [%0, #64]" : : "r" (p));	\
+	} while (0)
+
+#define barrier() { asm volatile ("" : : : "memory"); }
+#define cpu_relax barrier
+
+static inline uint64_t mfatb(void)
+{
+	uint64_t ret, ret_new, timeout = 200;
+
+	asm volatile ("mrs %0, cntvct_el0" : "=r" (ret));
+	asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new));
+	while (ret != ret_new && timeout--) {
+		ret = ret_new;
+		asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new));
+	}
+	DPAA_BUG_ON(!timeout && (ret != ret_new));
+	return ret * 64;
+}
+
+/* Spin for a few cycles without bothering the bus */
+static inline void cpu_spin(int cycles)
+{
+	uint64_t now = mfatb();
+
+	while (mfatb() < (now + cycles))
+		;
+}
+
+/* Qman/Bman API inlines and macros; */
+#ifdef lower_32_bits
+#undef lower_32_bits
+#endif
+#define lower_32_bits(x) ((u32)(x))
+
+#ifdef upper_32_bits
+#undef upper_32_bits
+#endif
+#define upper_32_bits(x) ((u32)(((x) >> 16) >> 16))
+
+/*
+ * Swap bytes of a 48-bit value.
+ */
+static inline uint64_t
+__bswap_48(uint64_t x)
+{
+	return  ((x & 0x0000000000ffULL) << 40) |
+		((x & 0x00000000ff00ULL) << 24) |
+		((x & 0x000000ff0000ULL) <<  8) |
+		((x & 0x0000ff000000ULL) >>  8) |
+		((x & 0x00ff00000000ULL) >> 24) |
+		((x & 0xff0000000000ULL) >> 40);
+}
+
+/*
+ * Swap bytes of a 40-bit value.
+ */
+static inline uint64_t
+__bswap_40(uint64_t x)
+{
+	return  ((x & 0x00000000ffULL) << 32) |
+		((x & 0x000000ff00ULL) << 16) |
+		((x & 0x0000ff0000ULL)) |
+		((x & 0x00ff000000ULL) >> 16) |
+		((x & 0xff00000000ULL) >> 32);
+}
+
+/*
+ * Swap bytes of a 24-bit value.
+ */
+static inline uint32_t
+__bswap_24(uint32_t x)
+{
+	return  ((x & 0x0000ffULL) << 16) |
+		((x & 0x00ff00ULL)) |
+		((x & 0xff0000ULL) >> 16);
+}
+
+#define be64_to_cpu(x) rte_be_to_cpu_64(x)
+#define be32_to_cpu(x) rte_be_to_cpu_32(x)
+#define be16_to_cpu(x) rte_be_to_cpu_16(x)
+
+#define cpu_to_be64(x) rte_cpu_to_be_64(x)
+#define cpu_to_be32(x) rte_cpu_to_be_32(x)
+#define cpu_to_be16(x) rte_cpu_to_be_16(x)
+
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+
+#define cpu_to_be48(x) __bswap_48(x)
+#define be48_to_cpu(x) __bswap_48(x)
+
+#define cpu_to_be40(x) __bswap_40(x)
+#define be40_to_cpu(x) __bswap_40(x)
+
+#define cpu_to_be24(x) __bswap_24(x)
+#define be24_to_cpu(x) __bswap_24(x)
+
+#else /* RTE_BIG_ENDIAN */
+
+#define cpu_to_be48(x) (x)
+#define be48_to_cpu(x) (x)
+
+#define cpu_to_be40(x) (x)
+#define be40_to_cpu(x) (x)
+
+#define cpu_to_be24(x) (x)
+#define be24_to_cpu(x) (x)
+
+#endif /* RTE_BIG_ENDIAN */
+
+/* When copying aligned words or shorts, try to avoid memcpy() */
+/* memcpy() stuff - when you know alignments in advance */
+#define CONFIG_TRY_BETTER_MEMCPY
+
+#ifdef CONFIG_TRY_BETTER_MEMCPY
+static inline void copy_words(void *dest, const void *src, size_t sz)
+{
+	u32 *__dest = dest;
+	const u32 *__src = src;
+	size_t __sz = sz >> 2;
+
+	DPAA_BUG_ON((unsigned long)dest & 0x3);
+	DPAA_BUG_ON((unsigned long)src & 0x3);
+	DPAA_BUG_ON(sz & 0x3);
+	while (__sz--)
+		*(__dest++) = *(__src++);
+}
+
+static inline void copy_shorts(void *dest, const void *src, size_t sz)
+{
+	u16 *__dest = dest;
+	const u16 *__src = src;
+	size_t __sz = sz >> 1;
+
+	DPAA_BUG_ON((unsigned long)dest & 0x1);
+	DPAA_BUG_ON((unsigned long)src & 0x1);
+	DPAA_BUG_ON(sz & 0x1);
+	while (__sz--)
+		*(__dest++) = *(__src++);
+}
+
+static inline void copy_bytes(void *dest, const void *src, size_t sz)
+{
+	u8 *__dest = dest;
+	const u8 *__src = src;
+
+	while (sz--)
+		*(__dest++) = *(__src++);
+}
+#else
+#define copy_words memcpy
+#define copy_shorts memcpy
+#define copy_bytes memcpy
+#endif
+
+/* Allocator stuff */
+#define kmalloc(sz, t)	malloc(sz)
+#define vmalloc(sz)	malloc(sz)
+#define kfree(p)	{ if (p) free(p); }
+static inline void *kzalloc(size_t sz, gfp_t __foo __rte_unused)
+{
+	void *ptr = malloc(sz);
+
+	if (ptr)
+		memset(ptr, 0, sz);
+	return ptr;
+}
+
+static inline unsigned long get_zeroed_page(gfp_t __foo __rte_unused)
+{
+	void *p;
+
+	if (posix_memalign(&p, 4096, 4096))
+		return 0;
+	memset(p, 0, 4096);
+	return (unsigned long)p;
+}
+
+/* Spinlock stuff */
+#define spinlock_t		rte_spinlock_t
+#define __SPIN_LOCK_UNLOCKED(x)	RTE_SPINLOCK_INITIALIZER
+#define DEFINE_SPINLOCK(x)	spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
+#define spin_lock_init(x)	rte_spinlock_init(x)
+#define spin_lock_destroy(x)
+#define spin_lock(x)		rte_spinlock_lock(x)
+#define spin_unlock(x)		rte_spinlock_unlock(x)
+#define spin_lock_irq(x)	spin_lock(x)
+#define spin_unlock_irq(x)	spin_unlock(x)
+#define spin_lock_irqsave(x, f) spin_lock_irq(x)
+#define spin_unlock_irqrestore(x, f) spin_unlock_irq(x)
+
+#define atomic_t                rte_atomic32_t
+#define atomic_read(v)          rte_atomic32_read(v)
+#define atomic_set(v, i)        rte_atomic32_set(v, i)
+
+#define atomic_inc(v)           rte_atomic32_add(v, 1)
+#define atomic_dec(v)           rte_atomic32_sub(v, 1)
+
+#define atomic_inc_and_test(v)  rte_atomic32_inc_and_test(v)
+#define atomic_dec_and_test(v)  rte_atomic32_dec_and_test(v)
+
+#define atomic_inc_return(v)    rte_atomic32_add_return(v, 1)
+#define atomic_dec_return(v)    rte_atomic32_sub_return(v, 1)
+#define atomic_sub_and_test(i, v) (rte_atomic32_sub_return(v, i) == 0)
+
+#include <dpaa_list.h>
+#include <dpaa_bits.h>
+
+#endif /* __COMPAT_H */
diff --git a/drivers/bus/dpaa/include/dpaa_bits.h b/drivers/bus/dpaa/include/dpaa_bits.h
new file mode 100644
index 0000000..71f2d80
--- /dev/null
+++ b/drivers/bus/dpaa/include/dpaa_bits.h
@@ -0,0 +1,65 @@ 
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright 2017 NXP.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of NXP nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __DPAA_BITS_H
+#define __DPAA_BITS_H
+
+/* Bitfield stuff. */
+#define BITS_PER_ULONG	(sizeof(unsigned long) << 3)
+#define SHIFT_PER_ULONG	(((1 << 5) == BITS_PER_ULONG) ? 5 : 6)
+#define BITS_MASK(idx)	(1UL << ((idx) & (BITS_PER_ULONG - 1)))
+#define BITS_IDX(idx)	((idx) >> SHIFT_PER_ULONG)
+
+static inline void dpaa_set_bits(unsigned long mask,
+				 volatile unsigned long *p)
+{
+	*p |= mask;
+}
+
+static inline void dpaa_set_bit(int idx, volatile unsigned long *bits)
+{
+	dpaa_set_bits(BITS_MASK(idx), bits + BITS_IDX(idx));
+}
+
+static inline void dpaa_clear_bits(unsigned long mask,
+				   volatile unsigned long *p)
+{
+	*p &= ~mask;
+}
+
+static inline void dpaa_clear_bit(int idx,
+				  volatile unsigned long *bits)
+{
+	dpaa_clear_bits(BITS_MASK(idx), bits + BITS_IDX(idx));
+}
+
+#endif /* __DPAA_BITS_H */
diff --git a/drivers/bus/dpaa/include/dpaa_list.h b/drivers/bus/dpaa/include/dpaa_list.h
new file mode 100644
index 0000000..871e612
--- /dev/null
+++ b/drivers/bus/dpaa/include/dpaa_list.h
@@ -0,0 +1,101 @@ 
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright 2017 NXP.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of NXP nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __DPAA_LIST_H
+#define __DPAA_LIST_H
+
+/****************/
+/* Linked-lists */
+/****************/
+
+struct list_head {
+	struct list_head *prev;
+	struct list_head *next;
+};
+
+#define COMPAT_LIST_HEAD(n) \
+struct list_head n = { \
+	.prev = &n, \
+	.next = &n \
+}
+
+#define INIT_LIST_HEAD(p) \
+do { \
+	struct list_head *__p298 = (p); \
+	__p298->next = __p298; \
+	__p298->prev = __p298->next; \
+} while (0)
+#define list_entry(node, type, member) \
+	(type *)((void *)node - offsetof(type, member))
+#define list_empty(p) \
+({ \
+	const struct list_head *__p298 = (p); \
+	((__p298->next == __p298) && (__p298->prev == __p298)); \
+})
+#define list_add(p, l) \
+do { \
+	struct list_head *__p298 = (p); \
+	struct list_head *__l298 = (l); \
+	__p298->next = __l298->next; \
+	__p298->prev = __l298; \
+	__l298->next->prev = __p298; \
+	__l298->next = __p298; \
+} while (0)
+#define list_add_tail(p, l) \
+do { \
+	struct list_head *__p298 = (p); \
+	struct list_head *__l298 = (l); \
+	__p298->prev = __l298->prev; \
+	__p298->next = __l298; \
+	__l298->prev->next = __p298; \
+	__l298->prev = __p298; \
+} while (0)
+#define list_for_each(i, l)				\
+	for (i = (l)->next; i != (l); i = i->next)
+#define list_for_each_safe(i, j, l)			\
+	for (i = (l)->next, j = i->next; i != (l);	\
+	     i = j, j = i->next)
+#define list_for_each_entry(i, l, name) \
+	for (i = list_entry((l)->next, typeof(*i), name); &i->name != (l); \
+		i = list_entry(i->name.next, typeof(*i), name))
+#define list_for_each_entry_safe(i, j, l, name) \
+	for (i = list_entry((l)->next, typeof(*i), name), \
+		j = list_entry(i->name.next, typeof(*j), name); \
+		&i->name != (l); \
+		i = j, j = list_entry(j->name.next, typeof(*j), name))
+#define list_del(i) \
+do { \
+	(i)->next->prev = (i)->prev; \
+	(i)->prev->next = (i)->next; \
+} while (0)
+
+#endif /* __DPAA_LIST_H */