diff --git a/include/osi_common.h b/include/osi_common.h index d1fab0d..301eb48 100644 --- a/include/osi_common.h +++ b/include/osi_common.h @@ -39,6 +39,7 @@ #define OSI_ONE_MEGA_HZ 1000000U #define OSI_MAX_RX_COALESCE_USEC 1020U #define OSI_MIN_RX_COALESCE_USEC 3U +#define OSI_MIN_RX_COALESCE_FRAMES 1U #define OSI_PAUSE_FRAMES_ENABLE 0U #define OSI_PAUSE_FRAMES_DISABLE 1U diff --git a/include/osi_dma.h b/include/osi_dma.h index 74144e7..40db561 100644 --- a/include/osi_dma.h +++ b/include/osi_dma.h @@ -365,6 +365,10 @@ struct osi_dma_priv_data { unsigned int rx_riwt; /** Flag which decides riwt is enabled(1) or disabled(0) */ unsigned int use_riwt; + /** Max no of pkts to be received before triggering Rx interrupt */ + unsigned int rx_frames; + /** Flag which decides rx_frames is enabled(1) or disabled(0) */ + unsigned int use_rx_frames; /** Functional safety config to do periodic read-verify of * certain safety critical dma registers */ void *safety_config; @@ -664,6 +668,8 @@ int osi_process_rx_completions(struct osi_dma_priv_data *osi, * channels * 12) osi_dma->use_riwt ==> OSI_DISABLE/OSI_ENABLE * 13) osi_dma->rx_riwt ===> Actual value read from DT + * 14) osi_dma->use_rx_frames ==> OSI_DISABLE/OSI_ENABLE + * 15) osi_dma->rx_frames ===> Actual value read from DT * * @retval 0 on success * @retval -1 on failure. diff --git a/osi/dma/osi_dma.c b/osi/dma/osi_dma.c index 5dfa797..5583777 100644 --- a/osi/dma/osi_dma.c +++ b/osi/dma/osi_dma.c @@ -237,6 +237,15 @@ int osi_rx_dma_desc_init(struct osi_dma_priv_data *osi_dma, /* reset IOC bit if RWIT is enabled */ if (osi_dma->use_riwt == OSI_ENABLE) { rx_desc->rdes3 &= ~RDES3_IOC; + /* update IOC bit if rx_frames is enabled. Rx_frames + * can be enabled only along with RWIT. + */ + if (osi_dma->use_rx_frames == OSI_ENABLE) { + if ((rx_ring->refill_idx % + osi_dma->rx_frames) == OSI_NONE) { + rx_desc->rdes3 |= RDES3_IOC; + } + } } INCR_RX_DESC_INDEX(rx_ring->refill_idx, 1U); diff --git a/osi/dma/osi_dma_txrx.c b/osi/dma/osi_dma_txrx.c index 4a0f222..2b1cb0f 100644 --- a/osi/dma/osi_dma_txrx.c +++ b/osi/dma/osi_dma_txrx.c @@ -773,6 +773,13 @@ static int rx_dma_desc_initialization(struct osi_dma_priv_data *osi, /* reconfigure INTE bit if RX watchdog timer is enabled */ if (osi->use_riwt == OSI_ENABLE) { rx_desc->rdes3 &= ~RDES3_IOC; + /* update IOC bit if rx_frames is enabled. Rx_frames + * can be enabled only along with RWIT. + */ + if (osi->use_rx_frames == OSI_ENABLE) { + if ((i % osi->rx_frames) == OSI_NONE) + rx_desc->rdes3 |= RDES3_IOC; + } } rx_swcx->flags = 0;