mbox series

[net-next,v11,00/13] Add Realtek automotive PCIe driver

Message ID 20231115133414.1221480-1-justinlai0215@realtek.com (mailing list archive)
Headers show
Series Add Realtek automotive PCIe driver | expand

Message

Justin Lai Nov. 15, 2023, 1:34 p.m. UTC
This series includes adding realtek automotive ethernet driver 
and adding rtase ethernet driver entry in MAINTAINERS file.

This ethernet device driver for the PCIe interface of 
Realtek Automotive Ethernet Switch,applicable to 
RTL9054, RTL9068, RTL9072, RTL9075, RTL9068, RTL9071.

v1 -> v2:
- Remove redundent debug message.
- Modify coding rule.
- Remove other function codes not related to netdev.

v2 -> v3:
- Remove SR-IOV function - We will add the SR-IOV function together when
uploading the vf driver in the future.
- Remove other unnecessary code and macro.

v3 -> v4:
- Remove function prototype - Our driver does not use recursion, so we
have reordered the code and removed the function prototypes.
- Define macro precisely - Improve macro code readability to make the
source code cleaner.

v4 -> v5:
- Modify ethtool function - Remove some unnecessary code.
- Don't use inline function - Let the compiler decide.

v5 -> v6:
- Some old macro definitions have been removed and replaced with the
lastest usage.
- Replace s32 with int to ensure consistency.
- Clearly point out the objects of the service and remove unnecessary
struct.

v6 -> v7:
- Split this driver into multiple patches.
- Reorganize this driver code and remove redundant code to make this
driver more concise.

v7 -> v8:
- Add the function to calculate time mitigation and the function to 
calculate packet number mitigation. Users can use these two functions 
to calculate the reg value that needs to be set for the mitigation value
they want to set.
- This device is usually used in automotive embedded systems. The page
pool api will use more memory in receiving packets and requires more 
verification, so we currently do not plan to use it in this patch.

v8 -> v9:
- Declare functions that are not extern as static functions and increase
the size of the character array named name in the rtase_int_vector struct
to correct the build warning noticed by the kernel test robot.

v9 -> v10:
- Currently we change to use the page pool api. However, when we allocate
more than one page to an rx buffer, it will cause system errors
in some cases. Therefore, we set the rx buffer to fixed size with 3776
(PAGE_SIZE - SKB_DATA_ALIGN(sizeof(skb_shared_info) )), and the maximum 
value of mtu is set to 3754(rx buffer size - VLAN_ETH_HLEN - ETH_FCS_LEN).
- When ndo_tx_timeout is called, it will dump some device information,
which can be used for debugging.
- When the mtu is greater than 1500, the device supports checksums
but not TSO.
- Fix compiler warnning.

v10 -> v11:
- Added error handling of rtase_init_ring().
- Modify the error related to asymmetric pause in rtase_get_settings.
- Fix compiler error.

Justin Lai (13):
  net:ethernet:realtek:rtase: Add pci table supported in this module
  net:ethernet:realtek:rtase: Implement the .ndo_open function
  net:ethernet:realtek:rtase: Implement the rtase_down function
  net:ethernet:realtek:rtase: Implement the interrupt routine and
    rtase_poll
  net:ethernet:realtek:rtase: Implement hardware configuration function
  net:ethernet:realtek:rtase: Implement .ndo_start_xmit function
  net:ethernet:realtek:rtase: Implement a function to receive packets
  net:ethernet:realtek:rtase: Implement net_device_ops
  net:ethernet:realtek:rtase: Implement pci_driver suspend and resume
    function
  net:ethernet:realtek:rtase: Implement ethtool function
  net:ethernet:realtek:rtase: Add a Makefile in the rtase folder
  net:ethernet:realtek: Update the Makefile and Kconfig in the realtek
    folder
  MAINTAINERS: Add the rtase ethernet driver entry

 MAINTAINERS                                   |    7 +
 drivers/net/ethernet/realtek/Kconfig          |   17 +
 drivers/net/ethernet/realtek/Makefile         |    1 +
 drivers/net/ethernet/realtek/rtase/Makefile   |   10 +
 drivers/net/ethernet/realtek/rtase/rtase.h    |  353 +++
 .../net/ethernet/realtek/rtase/rtase_main.c   | 2542 +++++++++++++++++
 drivers/net/ethernet/realtek/rtase/tt.c       | 2542 +++++++++++++++++
 drivers/net/ethernet/realtek/rtase/tt.h       |  353 +++
 8 files changed, 5825 insertions(+)
 create mode 100644 drivers/net/ethernet/realtek/rtase/Makefile
 create mode 100644 drivers/net/ethernet/realtek/rtase/rtase.h
 create mode 100644 drivers/net/ethernet/realtek/rtase/rtase_main.c
 create mode 100644 drivers/net/ethernet/realtek/rtase/tt.c
 create mode 100644 drivers/net/ethernet/realtek/rtase/tt.h

Comments

Simon Horman Nov. 16, 2023, 5:57 p.m. UTC | #1
On Wed, Nov 15, 2023 at 09:34:01PM +0800, Justin Lai wrote:
> This series includes adding realtek automotive ethernet driver 
> and adding rtase ethernet driver entry in MAINTAINERS file.
> 
> This ethernet device driver for the PCIe interface of 
> Realtek Automotive Ethernet Switch,applicable to 
> RTL9054, RTL9068, RTL9072, RTL9075, RTL9068, RTL9071.

...

>  MAINTAINERS                                   |    7 +
>  drivers/net/ethernet/realtek/Kconfig          |   17 +
>  drivers/net/ethernet/realtek/Makefile         |    1 +
>  drivers/net/ethernet/realtek/rtase/Makefile   |   10 +
>  drivers/net/ethernet/realtek/rtase/rtase.h    |  353 +++
>  .../net/ethernet/realtek/rtase/rtase_main.c   | 2542 +++++++++++++++++
>  drivers/net/ethernet/realtek/rtase/tt.c       | 2542 +++++++++++++++++
>  drivers/net/ethernet/realtek/rtase/tt.h       |  353 +++

Hi Justin,

Unless I am mistaken, by the end of this patch set tt.c is identical to
rtase_main.c, and tt.h is identical to rtase.h.

If so, why?

$ cd drivers/net/ethernet/realtek/rtase
$ sha1sum *.[ch] | sort
9762c7f0fc1acb214d1705905495fad6b902a3c8  rtase.h
9762c7f0fc1acb214d1705905495fad6b902a3c8  tt.h
ccfe889f5ae3b6ecfa0dfba91d30fd7beffd4291  rtase_main.c
ccfe889f5ae3b6ecfa0dfba91d30fd7beffd4291  tt.c
Justin Lai Nov. 21, 2023, 9:35 a.m. UTC | #2
> On Wed, Nov 15, 2023 at 09:34:01PM +0800, Justin Lai wrote:
> > This series includes adding realtek automotive ethernet driver and
> > adding rtase ethernet driver entry in MAINTAINERS file.
> >
> > This ethernet device driver for the PCIe interface of Realtek
> > Automotive Ethernet Switch,applicable to RTL9054, RTL9068, RTL9072,
> > RTL9075, RTL9068, RTL9071.
> 
> ...
> 
> >  MAINTAINERS                                   |    7 +
> >  drivers/net/ethernet/realtek/Kconfig          |   17 +
> >  drivers/net/ethernet/realtek/Makefile         |    1 +
> >  drivers/net/ethernet/realtek/rtase/Makefile   |   10 +
> >  drivers/net/ethernet/realtek/rtase/rtase.h    |  353 +++
> >  .../net/ethernet/realtek/rtase/rtase_main.c   | 2542 +++++++++++++++++
> >  drivers/net/ethernet/realtek/rtase/tt.c       | 2542 +++++++++++++++++
> >  drivers/net/ethernet/realtek/rtase/tt.h       |  353 +++
> 
> Hi Justin,
> 
> Unless I am mistaken, by the end of this patch set tt.c is identical to
> rtase_main.c, and tt.h is identical to rtase.h.
> 
> If so, why?

Sorry, tt.c and tt.h are redundant codes. This part will be corrected in the next version of the patch.
> 
> $ cd drivers/net/ethernet/realtek/rtase
> $ sha1sum *.[ch] | sort
> 9762c7f0fc1acb214d1705905495fad6b902a3c8  rtase.h
> 9762c7f0fc1acb214d1705905495fad6b902a3c8  tt.h
> ccfe889f5ae3b6ecfa0dfba91d30fd7beffd4291  rtase_main.c
> ccfe889f5ae3b6ecfa0dfba91d30fd7beffd4291  tt.c