mbox series

[0/3] cleanup the PMD

Message ID 20230206070549.27265-1-chaoyong.he@corigine.com (mailing list archive)
Headers
Series cleanup the PMD |

Message

Chaoyong He Feb. 6, 2023, 7:05 a.m. UTC
  This patch series aims to better align the PMD with
the preferred DPDK coding style.
- Remove the usage of 'printf()'
- Remove the unneeded header file includes
- Explicitly compare pointer with NULL
- Explicitly compare integer with 0

James Hershaw (3):
  net/nfp: remove usage of print statements
  net/nfp: remove unnecessary include
  net/nfp: explicitly compare to null and 0

 drivers/net/nfp/nfp_common.c               | 25 +++---
 drivers/net/nfp/nfp_cpp_bridge.c           |  4 +-
 drivers/net/nfp/nfp_ethdev.c               |  2 +-
 drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
 drivers/net/nfp/nfp_rxtx.c                 | 14 ++--
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 88 +++++++++-------------
 drivers/net/nfp/nfpcore/nfp_cppcore.c      | 31 ++++----
 drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 23 +++---
 drivers/net/nfp/nfpcore/nfp_mip.c          | 16 ++--
 drivers/net/nfp/nfpcore/nfp_mutex.c        | 14 ++--
 drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 +--
 drivers/net/nfp/nfpcore/nfp_nsp.c          | 36 +++++----
 drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     | 10 +--
 drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 38 +++++-----
 drivers/net/nfp/nfpcore/nfp_resource.c     | 15 ++--
 drivers/net/nfp/nfpcore/nfp_rtsym.c        | 48 +++++-------
 drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
 17 files changed, 176 insertions(+), 202 deletions(-)
  

Comments

Stephen Hemminger Feb. 6, 2023, 4:28 p.m. UTC | #1
On Mon,  6 Feb 2023 15:05:46 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> This patch series aims to better align the PMD with
> the preferred DPDK coding style.
> - Remove the usage of 'printf()'
> - Remove the unneeded header file includes
> - Explicitly compare pointer with NULL
> - Explicitly compare integer with 0
> 
> James Hershaw (3):
>   net/nfp: remove usage of print statements
>   net/nfp: remove unnecessary include
>   net/nfp: explicitly compare to null and 0
> 
>  drivers/net/nfp/nfp_common.c               | 25 +++---
>  drivers/net/nfp/nfp_cpp_bridge.c           |  4 +-
>  drivers/net/nfp/nfp_ethdev.c               |  2 +-
>  drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
>  drivers/net/nfp/nfp_rxtx.c                 | 14 ++--
>  drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 88 +++++++++-------------
>  drivers/net/nfp/nfpcore/nfp_cppcore.c      | 31 ++++----
>  drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 23 +++---
>  drivers/net/nfp/nfpcore/nfp_mip.c          | 16 ++--
>  drivers/net/nfp/nfpcore/nfp_mutex.c        | 14 ++--
>  drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 +--
>  drivers/net/nfp/nfpcore/nfp_nsp.c          | 36 +++++----
>  drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     | 10 +--
>  drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 38 +++++-----
>  drivers/net/nfp/nfpcore/nfp_resource.c     | 15 ++--
>  drivers/net/nfp/nfpcore/nfp_rtsym.c        | 48 +++++-------
>  drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
>  17 files changed, 176 insertions(+), 202 deletions(-)
> 

I am working on getting rid of RTE_LOGTYPE_PMD; all driver should
be using their own log type.

Looks like this driver has a lot of places that need fixing.
$ git grep 'PMD, '
flower/nfp_flower.c:            RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
flower/nfp_flower.c:                    RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc fail\n", __func__);
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_write error\n");
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc failed\n", __func__);
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_read error\n");
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n", __func__, cmd);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: socket creation error. Service failed\n",
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: bind error (%d). Service failed\n",
nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: listen error(%d). Service failed\n",
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: accept call error (%d)\n",
nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: service failed\n", __func__);
nfp_logs.h:     RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
nfp_logs.h:     RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
nfp_rxtx.c:             RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
nfp_rxtx.c:                     RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n");
nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n");
  
Chaoyong He Feb. 7, 2023, 2:17 a.m. UTC | #2
> On Mon,  6 Feb 2023 15:05:46 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > This patch series aims to better align the PMD with the preferred DPDK
> > coding style.
> > - Remove the usage of 'printf()'
> > - Remove the unneeded header file includes
> > - Explicitly compare pointer with NULL
> > - Explicitly compare integer with 0
> >
> > James Hershaw (3):
> >   net/nfp: remove usage of print statements
> >   net/nfp: remove unnecessary include
> >   net/nfp: explicitly compare to null and 0
> >
> >  drivers/net/nfp/nfp_common.c               | 25 +++---
> >  drivers/net/nfp/nfp_cpp_bridge.c           |  4 +-
> >  drivers/net/nfp/nfp_ethdev.c               |  2 +-
> >  drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
> >  drivers/net/nfp/nfp_rxtx.c                 | 14 ++--
> >  drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 88 +++++++++-------------
> >  drivers/net/nfp/nfpcore/nfp_cppcore.c      | 31 ++++----
> >  drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 23 +++---
> >  drivers/net/nfp/nfpcore/nfp_mip.c          | 16 ++--
> >  drivers/net/nfp/nfpcore/nfp_mutex.c        | 14 ++--
> >  drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 +--
> >  drivers/net/nfp/nfpcore/nfp_nsp.c          | 36 +++++----
> >  drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     | 10 +--
> >  drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 38 +++++-----
> >  drivers/net/nfp/nfpcore/nfp_resource.c     | 15 ++--
> >  drivers/net/nfp/nfpcore/nfp_rtsym.c        | 48 +++++-------
> >  drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
> >  17 files changed, 176 insertions(+), 202 deletions(-)
> >
> 
> I am working on getting rid of RTE_LOGTYPE_PMD; all driver should be using
> their own log type.
> 
> Looks like this driver has a lot of places that need fixing.
> $ git grep 'PMD, '
> flower/nfp_flower.c:            RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
> flower/nfp_flower.c:                    RTE_LOG_DP(ERR, PMD, "rxb does not
> exist!\n");
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc fail\n",
> __func__);
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
> nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_write
> error\n");
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc failed\n",
> __func__);
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
> nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_read
> error\n");
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from
> socket\n", __func__);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n",
> __func__, cmd);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from
> socket\n", __func__);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n",
> __func__);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n",
> __func__);
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: socket creation error.
> Service failed\n",
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: bind error (%d). Service
> failed\n",
> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: listen error(%d). Service
> failed\n",
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: accept call error
> (%d)\n",
> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: service failed\n",
> __func__);
> nfp_logs.h:     RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
> nfp_logs.h:     RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
> nfp_rxtx.c:             RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
> nfp_rxtx.c:                     RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
> nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for
> secondary process failed\n");
> nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for
> secondary process failed\n");

Thanks for your review!
This patch series just the first step to make things right, and we will send out another patch series 
to refactor the log system of nfp PMD, which will solve the problem you point out.
Do you think it's okay?
  
Ferruh Yigit Feb. 8, 2023, 1:55 a.m. UTC | #3
On 2/6/2023 7:05 AM, Chaoyong He wrote:
> This patch series aims to better align the PMD with
> the preferred DPDK coding style.
> - Remove the usage of 'printf()'
> - Remove the unneeded header file includes
> - Explicitly compare pointer with NULL
> - Explicitly compare integer with 0
> 
> James Hershaw (3):
>   net/nfp: remove usage of print statements
>   net/nfp: remove unnecessary include

Series applied to dpdk-next-net/main, thanks.
  
Ferruh Yigit Feb. 8, 2023, 1:56 a.m. UTC | #4
On 2/7/2023 2:17 AM, Chaoyong He wrote:
>> On Mon,  6 Feb 2023 15:05:46 +0800
>> Chaoyong He <chaoyong.he@corigine.com> wrote:
>>
>>> This patch series aims to better align the PMD with the preferred DPDK
>>> coding style.
>>> - Remove the usage of 'printf()'
>>> - Remove the unneeded header file includes
>>> - Explicitly compare pointer with NULL
>>> - Explicitly compare integer with 0
>>>
>>> James Hershaw (3):
>>>   net/nfp: remove usage of print statements
>>>   net/nfp: remove unnecessary include
>>>   net/nfp: explicitly compare to null and 0
>>>
>>>  drivers/net/nfp/nfp_common.c               | 25 +++---
>>>  drivers/net/nfp/nfp_cpp_bridge.c           |  4 +-
>>>  drivers/net/nfp/nfp_ethdev.c               |  2 +-
>>>  drivers/net/nfp/nfp_ethdev_vf.c            |  2 +-
>>>  drivers/net/nfp/nfp_rxtx.c                 | 14 ++--
>>>  drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 88 +++++++++-------------
>>>  drivers/net/nfp/nfpcore/nfp_cppcore.c      | 31 ++++----
>>>  drivers/net/nfp/nfpcore/nfp_hwinfo.c       | 23 +++---
>>>  drivers/net/nfp/nfpcore/nfp_mip.c          | 16 ++--
>>>  drivers/net/nfp/nfpcore/nfp_mutex.c        | 14 ++--
>>>  drivers/net/nfp/nfpcore/nfp_nffw.c         | 10 +--
>>>  drivers/net/nfp/nfpcore/nfp_nsp.c          | 36 +++++----
>>>  drivers/net/nfp/nfpcore/nfp_nsp_cmds.c     | 10 +--
>>>  drivers/net/nfp/nfpcore/nfp_nsp_eth.c      | 38 +++++-----
>>>  drivers/net/nfp/nfpcore/nfp_resource.c     | 15 ++--
>>>  drivers/net/nfp/nfpcore/nfp_rtsym.c        | 48 +++++-------
>>>  drivers/net/nfp/nfpcore/nfp_target.h       |  2 +-
>>>  17 files changed, 176 insertions(+), 202 deletions(-)
>>>
>>
>> I am working on getting rid of RTE_LOGTYPE_PMD; all driver should be using
>> their own log type.
>>
>> Looks like this driver has a lot of places that need fixing.
>> $ git grep 'PMD, '
>> flower/nfp_flower.c:            RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
>> flower/nfp_flower.c:                    RTE_LOG_DP(ERR, PMD, "rxb does not
>> exist!\n");
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc fail\n",
>> __func__);
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
>> nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_write
>> error\n");
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: area alloc failed\n",
>> __func__);
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "area acquire failed\n");
>> nfp_cpp_bridge.c:                               RTE_LOG(ERR, PMD, "nfp_cpp_area_read
>> error\n");
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from
>> socket\n", __func__);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n",
>> __func__, cmd);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: read error from
>> socket\n", __func__);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n",
>> __func__);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: error writing to socket\n",
>> __func__);
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: socket creation error.
>> Service failed\n",
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: bind error (%d). Service
>> failed\n",
>> nfp_cpp_bridge.c:               RTE_LOG(ERR, PMD, "%s: listen error(%d). Service
>> failed\n",
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: accept call error
>> (%d)\n",
>> nfp_cpp_bridge.c:                       RTE_LOG(ERR, PMD, "%s: service failed\n",
>> __func__);
>> nfp_logs.h:     RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
>> nfp_logs.h:     RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
>> nfp_rxtx.c:             RTE_LOG_DP(ERR, PMD, "RX Bad queue\n");
>> nfp_rxtx.c:                     RTE_LOG_DP(ERR, PMD, "rxb does not exist!\n");
>> nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for
>> secondary process failed\n");
>> nfpcore/nfp_cpp_pcie_ops.c:             RTE_LOG(ERR, PMD, "NFP lock for
>> secondary process failed\n");
> 
> Thanks for your review!
> This patch series just the first step to make things right, and we will send out another patch series 
> to refactor the log system of nfp PMD, which will solve the problem you point out.
> Do you think it's okay? 

Thanks Chaoyong,

I am merging this set as it is, remaining cleanups can be merged as they
received.