I ran this driver through the evaluation copy of PVS studio and it reported
many warnings you should address.
Not all of them are valid, the tool seems to have a lot of false positives.
MESSAGES
LocationCodeMessage
Fails/Info
rnp_mac.c (258)
V610 Undefined behavior.
Check the shift operator '>>'. The right operand ('....' =
[0x0..0xFFFFFFFFFFFFFFFF]) is greater than or equal to the length in bits
of the promoted left operand.
rnp_mac.c (81)
V1037 Two or more
case-branches perform the same actions. Check lines: 81, 84
rnp_mac.c (205)
V525 The code contains the
collection of similar blocks. Check items 'flt_reg', 'vlan_reg', 'vlan_reg'
in lines 205, 206, 207.
rnp_mac.c (209)
V525 The code contains the
collection of similar blocks. Check items 'flt_reg', 'vlan_reg', 'vlan_reg'
in lines 209, 210, 211.
rnp_mbx.c (398)
V547 Expression '!ret_val'
is always true.
rnp_mbx_fw.c (259)
V530 The return value of
function 'rte_fls_u32' is required to be utilized.
rnp_mbx_fw.c (256)
V519 The 'is_sgmii_bits'
variable is assigned values twice successively. Perhaps this is a mistake.
Check lines: 255, 256.
rnp_mbx_fw.c (177)
V1086 A call of the
'memcpy' function will lead to underflow of the buffer 'cookie->priv'.
rnp_mbx_fw.c (332)
V1086 A call of the
'memcpy' function will lead to underflow of the buffer
'mac->addrs[nr_lane].mac'.
rnp_mbx_fw.c (271)
V576 Incorrect format.
Consider checking the 15th actual argument of the 'rte_log' function. The
SIGNED integer type argument is expected.
rnp_mbx_fw.c (389)
V1048 The
'phy_meta->link_autoneg' variable was assigned the same value.
rnp_osdep.h (126)
V576 Incorrect format.
Consider checking the fourth actual argument of the 'snprintf' function.
The memsize type argument is expected.
rnp_osdep.h (32)
V677 Custom declaration of
a standard 'dma_addr_t' type. The declaration from system header files
should be used instead.
rnp_ethdev.c (750)
V530 The return value of
function 'rte_fls_u32' is required to be utilized.
rnp_ethdev.c (1386)
V519 The 'reg' variable is
assigned values twice successively. Perhaps this is a mistake. Check lines:
1381, 1386.
rnp_ethdev.c (1003)
V547 Expression 'frame_size
< 64' is always false.
rnp_ethdev.c (1003)
V649 There are two 'if'
statements with identical conditional expressions. The first 'if' statement
contains function return. This means that the second 'if' statement is
senseless. Check lines: 988, 1003.
rnp_ethdev.c (583)
V684 A value of the
variable 'cvlan_ctrl' is not modified. Consider inspecting the expression.
It is possible that '1' should be present instead of '0'.
rnp_ethdev.c (598)
V684 A value of the
variable 'svlan_ctrl' is not modified. Consider inspecting the expression.
It is possible that '1' should be present instead of '0'.
rnp_ethdev.c (618)
V684 A value of the
variable 'ctrl' is not modified. Consider inspecting the expression. It is
possible that '1' should be present instead of '0'.
rnp_ethdev.c (106)
V1032 The pointer 'msgbuf'
is cast to a more strictly aligned pointer type.
rnp_ethdev.c (254)
V1051 Consider checking
for misprints. It's possible that the 'dma_ctrl' should be checked here.
rnp_ethdev.c (1348)
V525 The code contains the
collection of similar blocks. Check items 'mac_stats', 'mac_stats',
'eth_stats' in lines 1348, 1354, 1360.
rnp_ethdev.c (1444)
V576 Incorrect format.
Consider checking the fifth actual argument of the 'rte_log' function. The
SIGNED integer type argument is expected.
rnp_ethdev.c (1458)
V576 Incorrect format.
Consider checking the fifth actual argument of the 'rte_log' function. The
SIGNED integer type argument is expected.
rnp_ethdev.c (110)
V641 The size of the
'msgbuf' buffer is not a multiple of the element size of the type 'struct
rnp_mbx_fw_cmd_reply'.
rnp_ethdev.c (113)
V641 The size of the
'msgbuf' buffer is not a multiple of the element size of the type 'struct
rnp_mbx_fw_cmd_req'.
rnp_ethdev.c (718)
V1027 Pointer to an object
of the 'rte_device' class is cast to unrelated 'rte_pci_device' class.
rnp_ethdev.c (1637)
V1027 Pointer to an object
of the 'rte_device' class is cast to unrelated 'rte_pci_device' class.
rnp_ethdev.c (1766)
V1027 Pointer to an object
of the 'rte_device' class is cast to unrelated 'rte_pci_device' class.
rnp_link.c (192)
V519 The
'link.link_autoneg' variable is assigned values twice successively. Perhaps
this is a mistake. Check lines: 186, 192.
rnp_link.c (359)
V547 Expression
'!port->attr.link_ready' is always true.
rnp_link.c (113)
V1048 The 'lane' variable
was assigned the same value.
rnp_rss.c (218)
V547 Expression
'rss_hash_level == (2UL << 50)' is always false.
rnp_rxtx.c (1409)
V684 A value of the
variable 'txbd->d.cmd' is not modified. Consider inspecting the expression.
It is possible that '1' should be present instead of '0'.
rnp_rxtx.c (253)
V576 Incorrect format.
Consider checking the tenth actual argument of the 'rte_log' function. The
SIGNED integer type argument is expected.
rnp_rxtx.c (461)
V576 Incorrect format.
Consider checking the tenth actual argument of the 'rte_log' function. The
SIGNED integer type argument is expected.
rnp_rxtx.c (1224)
V1027 Pointer to an object
of the 'rte_ether_hdr' class is cast to unrelated 'rte_vlan_hdr' class.
On Wed, Feb 12, 2025 at 7:34 AM Wenbo Cao wrote:
> For This patchset just to support the basic chip init work
> and user can just found the eth_dev, but can't control more.
> For Now just support 2*10g nic,the chip can support
> 2*10g,4*10g,4*1g,8*1g,8*10g.
> The Feature rx side can support rx-cksum-offload,rss,vlan-filter
> flow_clow,uncast_filter,mcast_filter,1588,Jumbo-frame
> The Feature tx side can support tx-cksum-offload,tso,vxlan-tso
> flow director base on ntuple pattern of tcp/udp/ip/ eth_hdr->type
> for sriov is also support.
>
> Because of the chip design defect, for multiple-port mode
> one pci-bdf will have multiple-port (max can have four ports)
> so this code must be care of one bdf init multiple-port.
> v12:
> * fixed __rte_packed __deprecated__ compile issue.
>
> v11:
> * fixed array-bounds issue when used rte_memcpy src addr is
> * not enough to hold align dst.
> * improve efficient_code advised by Stephen
>
> v10:
> * fixed mingw windows meson issue
> * rnp not support windows for now.
>
> v9:
> * fixed commit log format check by devtools.
> * fixed code compile issue.
>
> v8:
> * fixed codespell issue.
> * fixed MAINTAINERS file
>
> v7:
> * add support nic basic feature such as rss vlan strip/filter,
> * mtu-change recv/send scater-recv/mutltiple-send.
> * fixed code rationality, advised by Ferruh Yigit.
> v6:
> * fixed the doc(rst) format problem advise by Thomas Monjalon
>
> v5:
> * fixed the symbol name require by the style documentation
>
> v4:
> * one patch has been forgot to upload :(
>
> v3:
> * fixed http://dpdk.org/patch/129830 FreeBSD 13 compile Issue
> * change iobar type to void suggest by Stephen Hemminger
> * add KMOD_DEP support for vfio-pci
> * change run-cmd argument parse check for invalid extra_args
>
> v2:
> * fixed MAINTAIN maillist fullname format
> * fixed driver/net/meson the order issue of new driver to driver list
> * improve virtual point function usage suggest by Stephen Hemminger
>
> Wenbo Cao (28):
> net/rnp: add skeleton
> net/rnp: add ethdev probe and remove
> net/rnp: add log
> net/rnp: support mailbox basic operate
> net/rnp: add device init and uninit
> net/rnp: add get device information operation
> net/rnp: add support MAC promisc mode
> net/rnp: add queue setup and release operations
> net/rnp: add queue stop and start operations
> net/rnp: add support device start stop operations
> net/rnp: add RSS support operations
> net/rnp: add support link update operations
> net/rnp: add support link setup operations
> net/rnp: add Rx burst simple support
> net/rnp: add Tx burst simple support
> net/rnp: add MTU set operation
> net/rnp: add Rx scatter segment version
> net/rnp: add Tx multiple segment version
> net/rnp: add support basic stats operation
> net/rnp: add support xstats operation
> net/rnp: add unicast MAC filter operation
> net/rnp: add supported packet types
> net/rnp: add support Rx checksum offload
> net/rnp: add support Tx TSO offload
> net/rnp: support VLAN offloads
> net/rnp: add support VLAN filters operations
> net/rnp: add queue info operation
> net/rnp: support Rx/Tx burst mode info
>
> .mailmap | 1 +
> MAINTAINERS | 6 +
> doc/guides/nics/features/rnp.ini | 33 +
> doc/guides/nics/index.rst | 1 +
> doc/guides/nics/rnp.rst | 101 ++
> drivers/net/meson.build | 1 +
> drivers/net/rnp/base/meson.build | 17 +
> drivers/net/rnp/base/rnp_bdq_if.c | 398 ++++++
> drivers/net/rnp/base/rnp_bdq_if.h | 154 +++
> drivers/net/rnp/base/rnp_bitrev.h | 64 +
> drivers/net/rnp/base/rnp_common.c | 103 ++
> drivers/net/rnp/base/rnp_common.h | 17 +
> drivers/net/rnp/base/rnp_crc32.c | 37 +
> drivers/net/rnp/base/rnp_crc32.h | 10 +
> drivers/net/rnp/base/rnp_dma_regs.h | 68 +
> drivers/net/rnp/base/rnp_eth_regs.h | 90 ++
> drivers/net/rnp/base/rnp_fw_cmd.c | 162 +++
> drivers/net/rnp/base/rnp_fw_cmd.h | 357 ++++++
> drivers/net/rnp/base/rnp_hw.h | 136 ++
> drivers/net/rnp/base/rnp_mac.c | 366 ++++++
> drivers/net/rnp/base/rnp_mac.h | 34 +
> drivers/net/rnp/base/rnp_mac_regs.h | 207 +++
> drivers/net/rnp/base/rnp_mbx.c | 512 ++++++++
> drivers/net/rnp/base/rnp_mbx.h | 58 +
> drivers/net/rnp/base/rnp_mbx_fw.c | 499 ++++++++
> drivers/net/rnp/base/rnp_mbx_fw.h | 24 +
> drivers/net/rnp/base/rnp_osdep.h | 169 +++
> drivers/net/rnp/meson.build | 27 +
> drivers/net/rnp/rnp.h | 258 ++++
> drivers/net/rnp/rnp_ethdev.c | 1841 +++++++++++++++++++++++++++
> drivers/net/rnp/rnp_link.c | 439 +++++++
> drivers/net/rnp/rnp_link.h | 38 +
> drivers/net/rnp/rnp_logs.h | 36 +
> drivers/net/rnp/rnp_rss.c | 367 ++++++
> drivers/net/rnp/rnp_rss.h | 43 +
> drivers/net/rnp/rnp_rxtx.c | 1815 ++++++++++++++++++++++++++
> drivers/net/rnp/rnp_rxtx.h | 162 +++
> 37 files changed, 8651 insertions(+)
> create mode 100644 doc/guides/nics/features/rnp.ini
> create mode 100644 doc/guides/nics/rnp.rst
> create mode 100644 drivers/net/rnp/base/meson.build
> create mode 100644 drivers/net/rnp/base/rnp_bdq_if.c
> create mode 100644 drivers/net/rnp/base/rnp_bdq_if.h
> create mode 100644 drivers/net/rnp/base/rnp_bitrev.h
> create mode 100644 drivers/net/rnp/base/rnp_common.c
> create mode 100644 drivers/net/rnp/base/rnp_common.h
> create mode 100644 drivers/net/rnp/base/rnp_crc32.c
> create mode 100644 drivers/net/rnp/base/rnp_crc32.h
> create mode 100644 drivers/net/rnp/base/rnp_dma_regs.h
> create mode 100644 drivers/net/rnp/base/rnp_eth_regs.h
> create mode 100644 drivers/net/rnp/base/rnp_fw_cmd.c
> create mode 100644 drivers/net/rnp/base/rnp_fw_cmd.h
> create mode 100644 drivers/net/rnp/base/rnp_hw.h
> create mode 100644 drivers/net/rnp/base/rnp_mac.c
> create mode 100644 drivers/net/rnp/base/rnp_mac.h
> create mode 100644 drivers/net/rnp/base/rnp_mac_regs.h
> create mode 100644 drivers/net/rnp/base/rnp_mbx.c
> create mode 100644 drivers/net/rnp/base/rnp_mbx.h
> create mode 100644 drivers/net/rnp/base/rnp_mbx_fw.c
> create mode 100644 drivers/net/rnp/base/rnp_mbx_fw.h
> create mode 100644 drivers/net/rnp/base/rnp_osdep.h
> create mode 100644 drivers/net/rnp/meson.build
> create mode 100644 drivers/net/rnp/rnp.h
> create mode 100644 drivers/net/rnp/rnp_ethdev.c
> create mode 100644 drivers/net/rnp/rnp_link.c
> create mode 100644 drivers/net/rnp/rnp_link.h
> create mode 100644 drivers/net/rnp/rnp_logs.h
> create mode 100644 drivers/net/rnp/rnp_rss.c
> create mode 100644 drivers/net/rnp/rnp_rss.h
> create mode 100644 drivers/net/rnp/rnp_rxtx.c
> create mode 100644 drivers/net/rnp/rnp_rxtx.h
>
> --
> 2.48.1
>
>