From: Hemant Kumar <redacted>
Introduce mhi_get_free_desc_count() API to return number
of TREs available to queue buffer. MHI clients can use this
API to know before hand if ring is full without calling queue
API.
Signed-off-by: Hemant Kumar <redacted>
Reviewed-by: Jeffrey Hugo <redacted>
Reviewed-by: Manivannan Sadhasivam <redacted>
---
drivers/bus/mhi/core/main.c | 12 ++++++++++++
include/linux/mhi.h | 9 +++++++++
2 files changed, 21 insertions(+)
The RX queue size can be determined at runtime by retrieving the
number of available transfer descriptors.
Signed-off-by: Loic Poulain <redacted>
---
drivers/net/mhi_net.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -257,9 +257,6 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,mhi_netdev->mdev=mhi_dev;SET_NETDEV_DEV(ndev,&mhi_dev->dev);-/* All MHI net channels have 128 ring elements (at least for now) */-mhi_netdev->rx_queue_sz=128;-INIT_DELAYED_WORK(&mhi_netdev->rx_refill,mhi_net_rx_refill_work);u64_stats_init(&mhi_netdev->stats.rx_syncp);u64_stats_init(&mhi_netdev->stats.tx_syncp);
@@ -269,6 +266,9 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,if(err)gotoout_err;+/* Number of transfer descriptors determines size of the queue */+mhi_netdev->rx_queue_sz=mhi_get_free_desc_count(mhi_dev,DMA_FROM_DEVICE);+err=register_netdev(ndev);if(err)gotoout_err;
Use the new mhi_get_free_desc_count helper to track queue usage
instead of relying on the locally maintained rx_queued count.
Signed-off-by: Loic Poulain <redacted>
---
drivers/net/mhi_net.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
@@ -224,8 +223,6 @@ static void mhi_net_rx_refill_work(struct work_struct *work)break;}-atomic_inc(&mhi_netdev->stats.rx_queued);-/* Do not hog the CPU if rx buffers are consumed faster than*queued(unlikely).*/
@@ -233,7 +230,7 @@ static void mhi_net_rx_refill_work(struct work_struct *work)}/* If we're still starved of rx buffers, reschedule later */-if(unlikely(!atomic_read(&mhi_netdev->stats.rx_queued)))+if(mhi_get_free_desc_count(mdev,DMA_FROM_DEVICE)==mhi_netdev->rx_queue_sz)schedule_delayed_work(&mhi_netdev->rx_refill,HZ/2);}
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-14 03:33:45
On Mon, 11 Jan 2021 19:07:40 +0100 Loic Poulain wrote:
From: Hemant Kumar <redacted>
Introduce mhi_get_free_desc_count() API to return number
of TREs available to queue buffer. MHI clients can use this
API to know before hand if ring is full without calling queue
API.
Signed-off-by: Hemant Kumar <redacted>
Reviewed-by: Jeffrey Hugo <redacted>
Reviewed-by: Manivannan Sadhasivam <redacted>
Can we apply these to net-next or does it need to be on a stable branch
that will also get pulled into mhi-next?
On Wed, Jan 13, 2021 at 07:33:01PM -0800, Jakub Kicinski wrote:
On Mon, 11 Jan 2021 19:07:40 +0100 Loic Poulain wrote:
quoted
From: Hemant Kumar <redacted>
Introduce mhi_get_free_desc_count() API to return number
of TREs available to queue buffer. MHI clients can use this
API to know before hand if ring is full without calling queue
API.
Signed-off-by: Hemant Kumar <redacted>
Reviewed-by: Jeffrey Hugo <redacted>
Reviewed-by: Manivannan Sadhasivam <redacted>
Can we apply these to net-next or does it need to be on a stable branch
that will also get pulled into mhi-next?
We should use the immutable branch for this so that I can pull into
mhi-next.
Thanks,
Mani
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-14 04:03:31
On Thu, 14 Jan 2021 09:27:49 +0530 Manivannan Sadhasivam wrote:
On Wed, Jan 13, 2021 at 07:33:01PM -0800, Jakub Kicinski wrote:
quoted
On Mon, 11 Jan 2021 19:07:40 +0100 Loic Poulain wrote:
quoted
From: Hemant Kumar <redacted>
Introduce mhi_get_free_desc_count() API to return number
of TREs available to queue buffer. MHI clients can use this
API to know before hand if ring is full without calling queue
API.
Signed-off-by: Hemant Kumar <redacted>
Reviewed-by: Jeffrey Hugo <redacted>
Reviewed-by: Manivannan Sadhasivam <redacted>
Can we apply these to net-next or does it need to be on a stable branch
that will also get pulled into mhi-next?
We should use the immutable branch for this so that I can pull into
mhi-next.
Thanks for a quire reply!
Loic, FWIW git merge-base is your friend.
On Wed, Jan 13, 2021 at 08:02:46PM -0800, Jakub Kicinski wrote:
On Thu, 14 Jan 2021 09:27:49 +0530 Manivannan Sadhasivam wrote:
quoted
On Wed, Jan 13, 2021 at 07:33:01PM -0800, Jakub Kicinski wrote:
quoted
On Mon, 11 Jan 2021 19:07:40 +0100 Loic Poulain wrote:
quoted
From: Hemant Kumar <redacted>
Introduce mhi_get_free_desc_count() API to return number
of TREs available to queue buffer. MHI clients can use this
API to know before hand if ring is full without calling queue
API.
Signed-off-by: Hemant Kumar <redacted>
Reviewed-by: Jeffrey Hugo <redacted>
Reviewed-by: Manivannan Sadhasivam <redacted>
Can we apply these to net-next or does it need to be on a stable branch
that will also get pulled into mhi-next?
We should use the immutable branch for this so that I can pull into
mhi-next.
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-27 21:05:59
On Wed, 27 Jan 2021 16:53:17 +0530 Manivannan Sadhasivam wrote:
On Wed, Jan 13, 2021 at 08:02:46PM -0800, Jakub Kicinski wrote:
quoted
On Thu, 14 Jan 2021 09:27:49 +0530 Manivannan Sadhasivam wrote:
quoted
On Wed, Jan 13, 2021 at 07:33:01PM -0800, Jakub Kicinski wrote:
quoted
On Mon, 11 Jan 2021 19:07:40 +0100 Loic Poulain wrote:
quoted
From: Hemant Kumar <redacted>
Introduce mhi_get_free_desc_count() API to return number
of TREs available to queue buffer. MHI clients can use this
API to know before hand if ring is full without calling queue
API.
Signed-off-by: Hemant Kumar <redacted>
Reviewed-by: Jeffrey Hugo <redacted>
Reviewed-by: Manivannan Sadhasivam <redacted>
Can we apply these to net-next or does it need to be on a stable branch
that will also get pulled into mhi-next?
We should use the immutable branch for this so that I can pull into
mhi-next.