Thread (42 messages) flat view 42 messages, 8 authors, 2020-09-09

Re: [PATCH v2 net-next 3/9] net: mvneta: update mb bit before passing the xdp buffer to eBPF layer

From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: 2020-09-06 09:06:05
Also in: bpf

[...]
quoted
 				rx_desc->buf_phys_addr,
 				len, dma_dir);
-	if (data_len > 0 && sinfo->nr_frags < MAX_SKB_FRAGS) {
-		skb_frag_t *frag = &sinfo->frags[sinfo->nr_frags];
+	if (data_len > 0 && *nfrags < MAX_SKB_FRAGS) {
+		skb_frag_t *frag = &sinfo->frags[*nfrags];
 		skb_frag_off_set(frag, pp->rx_offset_correction);
 		skb_frag_size_set(frag, data_len);
 		__skb_frag_set_page(frag, page);
-		sinfo->nr_frags++;
+		*nfrags = *nfrags + 1;
nit, why do you use nfrags variable instead of sinfo->nr_frags (as it was
before this patch) ?
               You doesn't seem to use the nfrags variable in the
caller function and you update nr_frags as well.
               If it's used in a different patch (haven't
reviewed it all yet), maybe move it to that patch                ? (sorry in
advance if I missed the logic here)
nfrags pointer is used to avoid the sinfo->nr_frags initialization in
mvneta_swbm_rx_frame() since skb_shared_info is not in the cache usually.
AFAIK the hw does not provide the info "this is the second descriptor" but
just "this the frist/last descriptor".

Regards,
Lorenzo
quoted
+
+		if (rx_desc->status & MVNETA_RXD_LAST_DESC) {
+			sinfo->nr_frags = *nfrags;
+			xdp->mb = true;
+		}
 		rx_desc->buf_phys_addr = 0;
              ...

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help