[v6,01/17] net/r8169: add PMD driver skeleton

Message ID 20241108121123.248797-2-howard_wang@realsil.com.cn (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series Modify code as suggested by the maintainer. |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Howard Wang Nov. 8, 2024, 12:11 p.m. UTC
Meson build infrastructure, r8169_ethdev minimal skeleton,
header with Realtek NIC device and vendor IDs.

Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
---
 MAINTAINERS                            |   8 ++
 doc/guides/nics/features/r8169.ini     |   9 ++
 doc/guides/nics/index.rst              |   1 +
 doc/guides/nics/r8169.rst              |  19 ++++
 doc/guides/rel_notes/release_24_11.rst |   5 +
 drivers/net/meson.build                |   1 +
 drivers/net/r8169/meson.build          |   6 +
 drivers/net/r8169/r8169_compat.h       |  17 +++
 drivers/net/r8169/r8169_ethdev.c       | 147 +++++++++++++++++++++++++
 drivers/net/r8169/r8169_ethdev.h       |  31 ++++++
 10 files changed, 244 insertions(+)
 create mode 100644 doc/guides/nics/features/r8169.ini
 create mode 100644 doc/guides/nics/r8169.rst
 create mode 100644 drivers/net/r8169/meson.build
 create mode 100644 drivers/net/r8169/r8169_compat.h
 create mode 100644 drivers/net/r8169/r8169_ethdev.c
 create mode 100644 drivers/net/r8169/r8169_ethdev.h
  

Comments

Stephen Hemminger Nov. 8, 2024, 3:58 p.m. UTC | #1
On Fri, 8 Nov 2024 20:11:07 +0800
Howard Wang <howard_wang@realsil.com.cn> wrote:

> +#define RTL_DEV_PRIVATE(eth_dev) \
> +	((struct rtl_adapter *)((eth_dev)->data->dev_private))
> +

Note: that dev_private is void * so cast is not required.
No need to change the code, but less is more.
  
Ferruh Yigit Nov. 11, 2024, 12:14 a.m. UTC | #2
On 11/8/2024 12:11 PM, Howard Wang wrote:
> Meson build infrastructure, r8169_ethdev minimal skeleton,
> header with Realtek NIC device and vendor IDs.
> 
> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>

<...>

> +/*
> + * The set of PCI devices this driver supports
> + */
> +static const struct rte_pci_id pci_id_r8169_map[] = {
> +	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
> +	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
> +	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
> +	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },
>

What do you think to add macros for the PCI device IDs, naming them
makes it easier to know which devices are supported.

<...>

> +
> +#define RTL_DEV_PRIVATE(eth_dev) \
> +	((struct rtl_adapter *)((eth_dev)->data->dev_private))
> +
> 

This macro is only used a few patches later, what do you think to add
this macro when used?
  
Howard Wang Nov. 11, 2024, 3:46 a.m. UTC | #3
Dear Ferruh,

I apologize for the issues that have arisen during the process of splitting a complete driver into several small patches.

On 11/8/2024 12:11 PM, Howard Wang wrote:
> Meson build infrastructure, r8169_ethdev minimal skeleton, header with 
> Realtek NIC device and vendor IDs.
>
> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>

<...>

===> I referred to Atlantic’s approach for this, and as a matter of fact, his first commit message was done in this manner. 
I will think again about how it should be modified.

net/atlantic: add PMD driver skeleton
Makefile/meson build infrastructure, atl_ethdev minimal skeleton,
header with aquantia aQtion NIC device and vendor IDs.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>



What do you think to add macros for the PCI device IDs, naming them makes it easier to know which devices are supported.

===> Regarding the device ID, for 0x8125, the supported device is indeed called 8125. So, should we name a macro like DEVICE_ID_RTL8125 to replace it?

Best regards,
Howard Wang

-----邮件原件-----
发件人: Ferruh Yigit <ferruh.yigit@amd.com> 
发送时间: 2024年11月11日 8:15
收件人: 王颢 <howard_wang@realsil.com.cn>; dev@dpdk.org
抄送: pro_nic_dpdk@realtek.com
主题: Re: [PATCH v6 01/17] net/r8169: add PMD driver skeleton


External mail.



On 11/8/2024 12:11 PM, Howard Wang wrote:
> Meson build infrastructure, r8169_ethdev minimal skeleton, header with 
> Realtek NIC device and vendor IDs.
>
> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>

<...>

> +/*
> + * The set of PCI devices this driver supports  */ static const 
> +struct rte_pci_id pci_id_r8169_map[] = {
> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },
>

What do you think to add macros for the PCI device IDs, naming them makes it easier to know which devices are supported.

<...>

> +
> +#define RTL_DEV_PRIVATE(eth_dev) \
> +     ((struct rtl_adapter *)((eth_dev)->data->dev_private))
> +
>

This macro is only used a few patches later, what do you think to add this macro when used?
  
Ferruh Yigit Nov. 11, 2024, 9:08 a.m. UTC | #4
On 11/11/2024 3:46 AM, 王颢 wrote:
> Dear Ferruh,
> 
> I apologize for the issues that have arisen during the process of splitting a complete driver into several small patches.
> 
> On 11/8/2024 12:11 PM, Howard Wang wrote:
>> Meson build infrastructure, r8169_ethdev minimal skeleton, header with 
>> Realtek NIC device and vendor IDs.
>>
>> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
> 
> <...>
> 
> ===> I referred to Atlantic’s approach for this, and as a matter of fact, his first commit message was done in this manner. 
> I will think again about how it should be modified.
> 

No problem with the commit splits and orders, thanks for the update there.

Only comment in this patch is 'RTL_DEV_PRIVATE' macro is not used in the
patch and it can be added when you use the macro, so this is a simple issue.

Also I have a comment that build fails after some patchs, this also does
not require changing how patch split done, just fix build after each patch.

I am not sure if there is a misunderstanding but change requests are
mostly simple ones, I expect they can be fixed in one or two days, and I
am hopping to merge the driver in -rc2 or -rc3 at worst.

> net/atlantic: add PMD driver skeleton
> Makefile/meson build infrastructure, atl_ethdev minimal skeleton,
> header with aquantia aQtion NIC device and vendor IDs.
> 
> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
> Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
> 
> 
> 
> What do you think to add macros for the PCI device IDs, naming them makes it easier to know which devices are supported.
> 
> ===> Regarding the device ID, for 0x8125, the supported device is indeed called 8125. So, should we name a macro like DEVICE_ID_RTL8125 to replace it?
>


Ahh, I see, matching is simple for 8125, device id and product number is
same :), is it same for all supported devices?
	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },

> 
> Best regards,
> Howard Wang
> 
> -----邮件原件-----
> 发件人: Ferruh Yigit <ferruh.yigit@amd.com> 
> 发送时间: 2024年11月11日 8:15
> 收件人: 王颢 <howard_wang@realsil.com.cn>; dev@dpdk.org
> 抄送: pro_nic_dpdk@realtek.com
> 主题: Re: [PATCH v6 01/17] net/r8169: add PMD driver skeleton
> 
> 
> External mail.
> 
> 
> 
> On 11/8/2024 12:11 PM, Howard Wang wrote:
>> Meson build infrastructure, r8169_ethdev minimal skeleton, header with 
>> Realtek NIC device and vendor IDs.
>>
>> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
> 
> <...>
> 
>> +/*
>> + * The set of PCI devices this driver supports  */ static const 
>> +struct rte_pci_id pci_id_r8169_map[] = {
>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },
>>
> 
> What do you think to add macros for the PCI device IDs, naming them makes it easier to know which devices are supported.
> 
> <...>
> 
>> +
>> +#define RTL_DEV_PRIVATE(eth_dev) \
>> +     ((struct rtl_adapter *)((eth_dev)->data->dev_private))
>> +
>>
> 
> This macro is only used a few patches later, what do you think to add this macro when used?
> 
>
  
Howard Wang Nov. 11, 2024, 9:24 a.m. UTC | #5
Dear 

Ahh, I see, matching is simple for 8125, device id and product number is same :), is it same for all supported devices?

===> Yes, up until now, the Linux inbox driver has been doing it this way too.

I am not sure if there is a misunderstanding but change requests are mostly simple ones, I expect they can be fixed in one or two days, and I am hopping to merge the driver in -rc2 or -rc3 at worst.
===> I will do it as soon as possible. I have had a fever recently, so it might be a bit slow.

Best Regards,
Howard Wang

-----邮件原件-----
发件人: Ferruh Yigit <ferruh.yigit@amd.com> 
发送时间: 2024年11月11日 17:09
收件人: 王颢 <howard_wang@realsil.com.cn>; dev@dpdk.org
抄送: pro_nic_dpdk@realtek.com
主题: Re: 答复: [PATCH v6 01/17] net/r8169: add PMD driver skeleton


External mail.



On 11/11/2024 3:46 AM, 王颢 wrote:
> Dear Ferruh,
>
> I apologize for the issues that have arisen during the process of splitting a complete driver into several small patches.
>
> On 11/8/2024 12:11 PM, Howard Wang wrote:
>> Meson build infrastructure, r8169_ethdev minimal skeleton, header 
>> with Realtek NIC device and vendor IDs.
>>
>> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
>
> <...>
>
> ===> I referred to Atlantic’s approach for this, and as a matter of fact, his first commit message was done in this manner.
> I will think again about how it should be modified.
>

No problem with the commit splits and orders, thanks for the update there.

Only comment in this patch is 'RTL_DEV_PRIVATE' macro is not used in the patch and it can be added when you use the macro, so this is a simple issue.

Also I have a comment that build fails after some patchs, this also does not require changing how patch split done, just fix build after each patch.

I am not sure if there is a misunderstanding but change requests are mostly simple ones, I expect they can be fixed in one or two days, and I am hopping to merge the driver in -rc2 or -rc3 at worst.

> net/atlantic: add PMD driver skeleton
> Makefile/meson build infrastructure, atl_ethdev minimal skeleton, 
> header with aquantia aQtion NIC device and vendor IDs.
>
> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
> Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
>
>
>
> What do you think to add macros for the PCI device IDs, naming them makes it easier to know which devices are supported.
>
> ===> Regarding the device ID, for 0x8125, the supported device is indeed called 8125. So, should we name a macro like DEVICE_ID_RTL8125 to replace it?
>


Ahh, I see, matching is simple for 8125, device id and product number is same :), is it same for all supported devices?
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },

>
> Best regards,
> Howard Wang
>
> -----邮件原件-----
> 发件人: Ferruh Yigit <ferruh.yigit@amd.com>
> 发送时间: 2024年11月11日 8:15
> 收件人: 王颢 <howard_wang@realsil.com.cn>; dev@dpdk.org
> 抄送: pro_nic_dpdk@realtek.com
> 主题: Re: [PATCH v6 01/17] net/r8169: add PMD driver skeleton
>
>
> External mail.
>
>
>
> On 11/8/2024 12:11 PM, Howard Wang wrote:
>> Meson build infrastructure, r8169_ethdev minimal skeleton, header 
>> with Realtek NIC device and vendor IDs.
>>
>> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
>
> <...>
>
>> +/*
>> + * The set of PCI devices this driver supports  */ static const 
>> +struct rte_pci_id pci_id_r8169_map[] = {
>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },
>>
>
> What do you think to add macros for the PCI device IDs, naming them makes it easier to know which devices are supported.
>
> <...>
>
>> +
>> +#define RTL_DEV_PRIVATE(eth_dev) \
>> +     ((struct rtl_adapter *)((eth_dev)->data->dev_private))
>> +
>>
>
> This macro is only used a few patches later, what do you think to add this macro when used?
>
>
  
Ferruh Yigit Nov. 11, 2024, 9:31 a.m. UTC | #6
On 11/11/2024 9:24 AM, 王颢 wrote:
> Dear 
> 
> Ahh, I see, matching is simple for 8125, device id and product number is same :), is it same for all supported devices?
> 
> ===> Yes, up until now, the Linux inbox driver has been doing it this way too.
> 

Got it, so OK to keep the code as it is, thanks for the clarification.

> I am not sure if there is a misunderstanding but change requests are mostly simple ones, I expect they can be fixed in one or two days, and I am hopping to merge the driver in -rc2 or -rc3 at worst.
> ===> I will do it as soon as possible. I have had a fever recently, so it might be a bit slow.
>

Great, thanks. (And I hope you get better soon ;)

> 
> Best Regards,
> Howard Wang
> 
> -----邮件原件-----
> 发件人: Ferruh Yigit <ferruh.yigit@amd.com> 
> 发送时间: 2024年11月11日 17:09
> 收件人: 王颢 <howard_wang@realsil.com.cn>; dev@dpdk.org
> 抄送: pro_nic_dpdk@realtek.com
> 主题: Re: 答复: [PATCH v6 01/17] net/r8169: add PMD driver skeleton
> 
> 
> External mail.
> 
> 
> 
> On 11/11/2024 3:46 AM, 王颢 wrote:
>> Dear Ferruh,
>>
>> I apologize for the issues that have arisen during the process of splitting a complete driver into several small patches.
>>
>> On 11/8/2024 12:11 PM, Howard Wang wrote:
>>> Meson build infrastructure, r8169_ethdev minimal skeleton, header 
>>> with Realtek NIC device and vendor IDs.
>>>
>>> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
>>
>> <...>
>>
>> ===> I referred to Atlantic’s approach for this, and as a matter of fact, his first commit message was done in this manner.
>> I will think again about how it should be modified.
>>
> 
> No problem with the commit splits and orders, thanks for the update there.
> 
> Only comment in this patch is 'RTL_DEV_PRIVATE' macro is not used in the patch and it can be added when you use the macro, so this is a simple issue.
> 
> Also I have a comment that build fails after some patchs, this also does not require changing how patch split done, just fix build after each patch.
> 
> I am not sure if there is a misunderstanding but change requests are mostly simple ones, I expect they can be fixed in one or two days, and I am hopping to merge the driver in -rc2 or -rc3 at worst.
> 
>> net/atlantic: add PMD driver skeleton
>> Makefile/meson build infrastructure, atl_ethdev minimal skeleton, 
>> header with aquantia aQtion NIC device and vendor IDs.
>>
>> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
>> Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
>>
>>
>>
>> What do you think to add macros for the PCI device IDs, naming them makes it easier to know which devices are supported.
>>
>> ===> Regarding the device ID, for 0x8125, the supported device is indeed called 8125. So, should we name a macro like DEVICE_ID_RTL8125 to replace it?
>>
> 
> 
> Ahh, I see, matching is simple for 8125, device id and product number is same :), is it same for all supported devices?
>         { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
>         { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
>         { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
>         { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },
> 
>>
>> Best regards,
>> Howard Wang
>>
>> -----邮件原件-----
>> 发件人: Ferruh Yigit <ferruh.yigit@amd.com>
>> 发送时间: 2024年11月11日 8:15
>> 收件人: 王颢 <howard_wang@realsil.com.cn>; dev@dpdk.org
>> 抄送: pro_nic_dpdk@realtek.com
>> 主题: Re: [PATCH v6 01/17] net/r8169: add PMD driver skeleton
>>
>>
>> External mail.
>>
>>
>>
>> On 11/8/2024 12:11 PM, Howard Wang wrote:
>>> Meson build infrastructure, r8169_ethdev minimal skeleton, header 
>>> with Realtek NIC device and vendor IDs.
>>>
>>> Signed-off-by: Howard Wang <howard_wang@realsil.com.cn>
>>
>> <...>
>>
>>> +/*
>>> + * The set of PCI devices this driver supports  */ static const 
>>> +struct rte_pci_id pci_id_r8169_map[] = {
>>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
>>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
>>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
>>> +     { RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },
>>>
>>
>> What do you think to add macros for the PCI device IDs, naming them makes it easier to know which devices are supported.
>>
>> <...>
>>
>>> +
>>> +#define RTL_DEV_PRIVATE(eth_dev) \
>>> +     ((struct rtl_adapter *)((eth_dev)->data->dev_private))
>>> +
>>>
>>
>> This macro is only used a few patches later, what do you think to add this macro when used?
>>
>>
>
  

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 9a812b3632..f68cf48a9d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -995,6 +995,14 @@  F: drivers/net/qede/
 F: doc/guides/nics/qede.rst
 F: doc/guides/nics/features/qede*.ini
 
+Realtek r8169
+M: Howard Wang <howard_wang@realsil.com.cn>
+M: ChunHao Lin <hau@realtek.com>
+M: Xing Wang <xing_wang@realsil.com.cn>
+F: drivers/net/r8169
+F: doc/guides/nics/r8169.rst
+F: doc/guides/nics/features/r8169.ini
+
 Solarflare sfc_efx
 M: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
 F: drivers/common/sfc_efx/
diff --git a/doc/guides/nics/features/r8169.ini b/doc/guides/nics/features/r8169.ini
new file mode 100644
index 0000000000..dd1ce4db5c
--- /dev/null
+++ b/doc/guides/nics/features/r8169.ini
@@ -0,0 +1,9 @@ 
+;
+; Supported features of the 'r8169' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+x86-32               = Y
+x86-64               = Y
diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 8e371ac4a5..50688d9f64 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -60,6 +60,7 @@  Network Interface Controller Drivers
     pcap_ring
     pfe
     qede
+    r8169
     sfc_efx
     softnic
     tap
diff --git a/doc/guides/nics/r8169.rst b/doc/guides/nics/r8169.rst
new file mode 100644
index 0000000000..071aebcdbf
--- /dev/null
+++ b/doc/guides/nics/r8169.rst
@@ -0,0 +1,19 @@ 
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2024 Realtek Corporation. All rights reserved
+
+R8169 Poll Mode Driver
+======================
+
+The R8169 PMD provides poll mode driver support for Realtek 2.5 and 5 Gigabit
+Ethernet NICs.
+
+More information about Realtek 2.5G Ethernet NIC can be found at `RTL8125
+<https://www.realtek.com/Product/Index?id=3962&cate_id=786&menu_id=1010>`_.
+More information about Realtek 5G Ethernet NIC can be found at `RTL8126
+<https://www.realtek.com/Product/ProductHitsDetail?id=4425&menu_id=643>`_.
+
+Supported Chipsets and NICs
+---------------------------
+
+- Realtek RTL8125 2.5 Gigabit Ethernet Controller
+- Realtek RTL8126 5 Gigabit Ethernet Controller
diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst
index 66b970e036..2393db1e54 100644
--- a/doc/guides/rel_notes/release_24_11.rst
+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -219,6 +219,11 @@  New Features
 
   * Added support for DMA queue priority configuration.
 
+* **Added Realtek network PMD.**
+
+  Added a new network PMD which supports Realtek 2.5 and 5 Gigabit
+  Ethernet NICs.
+
 * **Added event device pre-scheduling support.**
 
   Added support for pre-scheduling of events to event ports
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 0a12914534..dafd637ba4 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -52,6 +52,7 @@  drivers = [
         'pcap',
         'pfe',
         'qede',
+        'r8169',
         'ring',
         'sfc',
         'softnic',
diff --git a/drivers/net/r8169/meson.build b/drivers/net/r8169/meson.build
new file mode 100644
index 0000000000..f14d4ae8fb
--- /dev/null
+++ b/drivers/net/r8169/meson.build
@@ -0,0 +1,6 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2024 Realtek Corporation. All rights reserved
+
+sources = files(
+		'r8169_ethdev.c',
+)
diff --git a/drivers/net/r8169/r8169_compat.h b/drivers/net/r8169/r8169_compat.h
new file mode 100644
index 0000000000..e337ce3afa
--- /dev/null
+++ b/drivers/net/r8169/r8169_compat.h
@@ -0,0 +1,17 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Realtek Corporation. All rights reserved
+ */
+
+#ifndef _R8169_COMPAT_H_
+#define _R8169_COMPAT_H_
+
+#include <stdint.h>
+
+typedef uint8_t   u8;
+typedef uint16_t  u16;
+typedef uint32_t  u32;
+typedef uint64_t  u64;
+
+#define PCI_VENDOR_ID_REALTEK 0x10EC
+
+#endif
diff --git a/drivers/net/r8169/r8169_ethdev.c b/drivers/net/r8169/r8169_ethdev.c
new file mode 100644
index 0000000000..740f7957be
--- /dev/null
+++ b/drivers/net/r8169/r8169_ethdev.c
@@ -0,0 +1,147 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Realtek Corporation. All rights reserved
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+
+#include <rte_eal.h>
+
+#include <rte_common.h>
+#include <rte_pci.h>
+#include <bus_pci_driver.h>
+#include <rte_ether.h>
+#include <ethdev_driver.h>
+#include <ethdev_pci.h>
+#include <dev_driver.h>
+
+#include "r8169_ethdev.h"
+#include "r8169_compat.h"
+
+static int rtl_dev_configure(struct rte_eth_dev *dev);
+static int rtl_dev_start(struct rte_eth_dev *dev);
+static int rtl_dev_stop(struct rte_eth_dev *dev);
+static int rtl_dev_reset(struct rte_eth_dev *dev);
+static int rtl_dev_close(struct rte_eth_dev *dev);
+
+/*
+ * The set of PCI devices this driver supports
+ */
+static const struct rte_pci_id pci_id_r8169_map[] = {
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000) },
+	{.vendor_id = 0, /* sentinel */ },
+};
+
+static const struct eth_dev_ops rtl_eth_dev_ops = {
+	.dev_configure	      = rtl_dev_configure,
+	.dev_start	      = rtl_dev_start,
+	.dev_stop	      = rtl_dev_stop,
+	.dev_close	      = rtl_dev_close,
+	.dev_reset	      = rtl_dev_reset,
+};
+
+static int
+rtl_dev_configure(struct rte_eth_dev *dev __rte_unused)
+{
+	return 0;
+}
+
+/*
+ * Configure device link speed and setup link.
+ * It returns 0 on success.
+ */
+static int
+rtl_dev_start(struct rte_eth_dev *dev  __rte_unused)
+{
+	return 0;
+}
+
+/*
+ * Stop device: disable RX and TX functions to allow for reconfiguring.
+ */
+static int
+rtl_dev_stop(struct rte_eth_dev *dev  __rte_unused)
+{
+	return 0;
+}
+
+/*
+ * Reset and stop device.
+ */
+static int
+rtl_dev_close(struct rte_eth_dev *dev)
+{
+	int ret_stp;
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	ret_stp = rtl_dev_stop(dev);
+
+	return ret_stp;
+}
+
+static int
+rtl_dev_init(struct rte_eth_dev *dev)
+{
+	dev->dev_ops = &rtl_eth_dev_ops;
+
+	/* For secondary processes, the primary process has done all the work */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	return 0;
+}
+
+static int
+rtl_dev_uninit(struct rte_eth_dev *dev)
+{
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return -EPERM;
+
+	rtl_dev_close(dev);
+
+	return 0;
+}
+
+static int
+rtl_dev_reset(struct rte_eth_dev *dev)
+{
+	int ret;
+
+	ret = rtl_dev_uninit(dev);
+	if (ret)
+		return ret;
+
+	ret = rtl_dev_init(dev);
+
+	return ret;
+}
+
+static int
+rtl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+	      struct rte_pci_device *pci_dev)
+{
+	return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct rtl_adapter),
+					     rtl_dev_init);
+}
+
+static int
+rtl_pci_remove(struct rte_pci_device *pci_dev)
+{
+	return rte_eth_dev_pci_generic_remove(pci_dev, rtl_dev_uninit);
+}
+
+static struct rte_pci_driver rte_r8169_pmd = {
+	.id_table  = pci_id_r8169_map,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+	.probe     = rtl_pci_probe,
+	.remove    = rtl_pci_remove,
+};
+
+RTE_PMD_REGISTER_PCI(net_r8169, rte_r8169_pmd);
+RTE_PMD_REGISTER_PCI_TABLE(net_r8169, pci_id_r8169_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_r8169, "* igb_uio | uio_pci_generic | vfio-pci");
diff --git a/drivers/net/r8169/r8169_ethdev.h b/drivers/net/r8169/r8169_ethdev.h
new file mode 100644
index 0000000000..561caa7acf
--- /dev/null
+++ b/drivers/net/r8169/r8169_ethdev.h
@@ -0,0 +1,31 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Realtek Corporation. All rights reserved
+ */
+
+#ifndef _R8169_ETHDEV_H_
+#define _R8169_ETHDEV_H_
+
+#include <stdint.h>
+
+#include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
+
+#include "r8169_compat.h"
+
+struct rtl_sw_stats {
+	u64 tx_packets;
+	u64 tx_bytes;
+	u64 tx_errors;
+	u64 rx_packets;
+	u64 rx_bytes;
+	u64 rx_errors;
+};
+
+struct rtl_adapter {
+	struct rtl_sw_stats sw_stats;
+};
+
+#define RTL_DEV_PRIVATE(eth_dev) \
+	((struct rtl_adapter *)((eth_dev)->data->dev_private))
+
+#endif