Re: [PATCH net-next v13 4/5] net: ti: prueth: Adds link detection, RX and TX support.

From: Parvathi Pudi
Date: Mon Aug 18 2025 - 09:17:00 EST


Hi,

> On Tue, 12 Aug 2025 19:04:19 +0530 Parvathi Pudi wrote:
>> +static irqreturn_t icssm_emac_rx_packets(struct prueth_emac *emac, int quota)
>
> Please stick to calling the budget budget rather than synonym terms
> like "quota". Makes it harder to review the code.
>

We will address this in the next version.

>> + /* search host queues for packets */
>> + for (i = start_queue; i <= end_queue; i++) {
>> + queue_desc = emac->rx_queue_descs + i;
>> + rxqueue = &queue_infos[PRUETH_PORT_HOST][i];
>
> budget can be 0, in which case the driver is not supposed to process
> Rx, just Tx (if the NAPI instance is used to serve completions).
>

We will add the following check to handle the case when NAPI
calls with a zero budget.

@@ -766,6 +766,10 @@ static irqreturn_t icssm_emac_rx_packets(struct prueth_emac *emac, int budget)
start_queue = emac->rx_queue_start;
end_queue = emac->rx_queue_end;

+ /* skip Rx if budget is 0 */
+ if (!budget)
+ return 0;
+
/* search host queues for packets */
for (i = start_queue; i <= end_queue; i++) {
queue_desc = emac->rx_queue_descs + i;

We will address this in the next version.

>> + num_rx_packets = icssm_emac_rx_packets(emac, budget);
>> + if (num_rx_packets < budget) {
>> + napi_complete_done(napi, num_rx_packets);
>
> don't ignore the return value of napi_complete_done()
> --

We will update the code to check the return value of napi_complete_done()
as shown below.

@@ -840,10 +844,9 @@ static int icssm_emac_napi_poll(struct napi_struct *napi, int budget)
int num_rx_packets;

num_rx_packets = icssm_emac_rx_packets(emac, budget);
- if (num_rx_packets < budget) {
- napi_complete_done(napi, num_rx_packets);
+
+ if (num_rx_packets < budget && napi_complete_done(napi, num_rx_packets))
enable_irq(emac->rx_irq);
- }

return num_rx_packets;
}

We will address this in the next version.


Thanks and Regards,
Parvathi.