nvme-tcp: question on poll return value

Hannes Reinecke hare at suse.de
Wed Jan 24 07:46:59 PST 2024


On 1/24/24 16:31, Daniel Wagner wrote:
> Hi Sagi,
> 
> I am stubled across nr_cqe while debugging something else and I am not
> sure if the poll function is doing the right thing with it. IIUC, the
> blk_mq_ops poll callback is supposed to return > 0 value when it
> processed at least one element. If this is the case, than I think we
> would need to first copy the current value in nr_cqe before calling
> nvme_tcp_try_recv. The function will reset queue->nr_cqe to 0, thus
> nvme_tcp_poll will always return 0.
> 
> Does this make any sense?
> 
Sadly, not.
nr_cqe is set to zero at the start in nvme_tcp_try_recv(), and
incremented for every request received.
So we need to use the _current_ value of nr_cqe after calling
nvme_tcp_try_recv() to figure out how many requests have been
received, not the saved one (which will actually be the value
of the _previous_ iteration of nvme_trp_try_recv()...).

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare at suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Ivo Totev, Andrew McDonald,
Werner Knoblich




More information about the Linux-nvme mailing list