nvethernet: fix top-25 issues

Fixed below issues

-FORWARD_NULL
-CERT STR07-C
-CERT INT32-C
-CERT INT30-C
-CERT INT08-C
-CERT EXP39-C
-CERT EXP34-C

JIRA NET-2044

Change-Id: I839bd5aedff30c7e9679f513a2cf7a1fbe3b2b8a
Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3258684
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: Mohan Thadikamalla <mohant@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Sanath Kumar Gampa
2024-11-28 05:20:12 +00:00
committed by Jon Hunter
parent b2a59883b3
commit 247613d6ce
8 changed files with 256 additions and 76 deletions

View File

@@ -95,6 +95,16 @@
*/
#define ETH_MAC_STR_LEN 20
/**
* @addtogroup Maximum number of child nodes
*/
#define MAX_CHILD_NODES 0xFFFFU
/**
* @addtogroup Helper for INT_32 MAX
*/
#define OSD_INT_MAX 0x7FFFFFFF
/**
* @addtogroup Ethernet Transmit Queue Priority
*
@@ -308,8 +318,14 @@ static inline bool valid_tx_len(unsigned int length)
static inline int ether_avail_txdesc_cnt(struct osi_dma_priv_data *osi_dma,
struct osi_tx_ring *tx_ring)
{
return ((tx_ring->clean_idx - tx_ring->cur_tx_idx - 1) &
(osi_dma->tx_ring_sz - 1));
int ret = -EINVAL;
if ((osi_dma->tx_ring_sz == 0U) || (tx_ring->cur_tx_idx == 0U) ||
(tx_ring->clean_idx < (tx_ring->cur_tx_idx - 1U))) {
return ret;
}
return ((tx_ring->clean_idx - tx_ring->cur_tx_idx - 1U) &
(osi_dma->tx_ring_sz - 1U));
}
/**