mirror of
git://nv-tegra.nvidia.com/kernel/nvethernetrm.git
synced 2025-12-24 10:34:24 +03:00
nvethernetrm: Indicate more Rx frames pending
Issue: The function osi_process_rx_completions does
not provide indication whether there are more
Rx frames in the HW ring to be processed by SW.
This indication is needed in OSD layers like
AUTOSAR MCAL driver as per the spec.
Fix: Check the next descriptor in the ring and indicate
if it has a valid new Rx packet that is pending
to be processed.
Bug 3019362
Change-Id: I4b4b8ac7b741dedbe979156e44f442cbb0e67590
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2361176
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Mahesh Patil <maheshp@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Bhadram Varka
parent
576528a3ad
commit
a89ce48ab2
@@ -750,6 +750,8 @@ int osi_process_tx_completions(struct osi_dma_priv_data *osi,
|
||||
* @param[in] osi: OSI private data structure.
|
||||
* @param[in] chan: Rx DMA channel number
|
||||
* @param[in] budget: Threshould for reading the packets at a time.
|
||||
* @param[in] more_data_avail: Pointer to more data available flag. OSI fills
|
||||
* this flag if more rx packets available to read(1) or not(0).
|
||||
*
|
||||
* @note
|
||||
* 1) MAC needs to be out of reset and proper clocks need to be configured.
|
||||
@@ -759,7 +761,8 @@ int osi_process_tx_completions(struct osi_dma_priv_data *osi,
|
||||
* @returns Number of decriptors (buffers) proccessed.
|
||||
*/
|
||||
int osi_process_rx_completions(struct osi_dma_priv_data *osi,
|
||||
unsigned int chan, int budget);
|
||||
unsigned int chan, int budget,
|
||||
unsigned int *more_data_avail);
|
||||
|
||||
/**
|
||||
* @brief osi_hw_dma_init - Initialize DMA
|
||||
|
||||
@@ -234,7 +234,8 @@ static inline void get_rx_err_stats(struct osi_rx_desc *rx_desc,
|
||||
}
|
||||
|
||||
int osi_process_rx_completions(struct osi_dma_priv_data *osi,
|
||||
unsigned int chan, int budget)
|
||||
unsigned int chan, int budget,
|
||||
unsigned int *more_data_avail)
|
||||
{
|
||||
struct osi_rx_ring *rx_ring = osi->rx_ring[chan];
|
||||
struct osi_rx_pkt_cx *rx_pkt_cx = &rx_ring->rx_pkt_cx;
|
||||
@@ -245,10 +246,13 @@ int osi_process_rx_completions(struct osi_dma_priv_data *osi,
|
||||
int received = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (rx_ring->cur_rx_idx >= RX_DESC_CNT) {
|
||||
if (rx_ring->cur_rx_idx >= RX_DESC_CNT || more_data_avail == OSI_NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Reset flag to indicate if more Rx frames available to OSD layer */
|
||||
*more_data_avail = OSI_NONE;
|
||||
|
||||
while (received < budget) {
|
||||
osi_memset(rx_pkt_cx, 0U, sizeof(*rx_pkt_cx));
|
||||
rx_desc = rx_ring->rx_desc + rx_ring->cur_rx_idx;
|
||||
@@ -332,6 +336,23 @@ int osi_process_rx_completions(struct osi_dma_priv_data *osi,
|
||||
osi->dstats.rx_pkt_n =
|
||||
osi_update_stats_counter(osi->dstats.rx_pkt_n, 1UL);
|
||||
received++;
|
||||
|
||||
/* If budget is done, check if HW ring still has unprocessed
|
||||
* Rx packets, so that the OSD layer can decide to schedule
|
||||
* this function again.
|
||||
*/
|
||||
if (received == budget) {
|
||||
rx_desc = rx_ring->rx_desc + rx_ring->cur_rx_idx;
|
||||
rx_swcx = rx_ring->rx_swcx + rx_ring->cur_rx_idx;
|
||||
if (((rx_swcx->flags & OSI_RX_SWCX_PROCESSED) !=
|
||||
OSI_RX_SWCX_PROCESSED) &&
|
||||
((rx_desc->rdes3 & RDES3_OWN) != RDES3_OWN)) {
|
||||
/* Next desciptor has owned by SW
|
||||
* So set more data avail flag here.
|
||||
*/
|
||||
*more_data_avail = OSI_ENABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return received;
|
||||
|
||||
Reference in New Issue
Block a user