Commit bd61848
net: devmem: Implement TX path
Augment dmabuf binding to be able to handle TX. Additional to all the RX
binding, we also create tx_vec needed for the TX path.
Provide API for sendmsg to be able to send dmabufs bound to this device:
- Provide a new dmabuf_tx_cmsg which includes the dmabuf to send from.
- MSG_ZEROCOPY with SCM_DEVMEM_DMABUF cmsg indicates send from dma-buf.
Devmem is uncopyable, so piggyback off the existing MSG_ZEROCOPY
implementation, while disabling instances where MSG_ZEROCOPY falls back
to copying.
We additionally pipe the binding down to the new
zerocopy_fill_skb_from_devmem which fills a TX skb with net_iov netmems
instead of the traditional page netmems.
We also special case skb_frag_dma_map to return the dma-address of these
dmabuf net_iovs instead of attempting to map pages.
The TX path may release the dmabuf in a context where we cannot wait.
This happens when the user unbinds a TX dmabuf while there are still
references to its netmems in the TX path. In that case, the netmems will
be put_netmem'd from a context where we can't unmap the dmabuf, Resolve
this by making __net_devmem_dmabuf_binding_free schedule_work'd.
Based on work by Stanislav Fomichev <sdf@fomichev.me>. A lot of the meat
of the implementation came from devmem TCP RFC v1[1], which included the
TX path, but Stan did all the rebasing on top of netmem/net_iov.
Cc: Stanislav Fomichev <sdf@fomichev.me>
Signed-off-by: Kaiyuan Zhang <kaiyuanz@google.com>
Signed-off-by: Mina Almasry <almasrymina@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250508004830.4100853-5-almasrymina@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>1 parent 8802087 commit bd61848
File tree
13 files changed
+340
-60
lines changed- include
- linux
- net
- io_uring
- net
- core
- ipv4
- ipv6
- vmw_vsock
13 files changed
+340
-60
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1707 | 1707 | | |
1708 | 1708 | | |
1709 | 1709 | | |
1710 | | - | |
| 1710 | + | |
1711 | 1711 | | |
1712 | 1712 | | |
1713 | 1713 | | |
| 1714 | + | |
| 1715 | + | |
1714 | 1716 | | |
1715 | 1717 | | |
1716 | | - | |
| 1718 | + | |
| 1719 | + | |
1717 | 1720 | | |
1718 | 1721 | | |
1719 | 1722 | | |
1720 | 1723 | | |
1721 | 1724 | | |
1722 | 1725 | | |
1723 | 1726 | | |
1724 | | - | |
| 1727 | + | |
| 1728 | + | |
1725 | 1729 | | |
1726 | 1730 | | |
1727 | 1731 | | |
1728 | 1732 | | |
1729 | | - | |
| 1733 | + | |
| 1734 | + | |
1730 | 1735 | | |
1731 | 1736 | | |
1732 | 1737 | | |
| |||
3697 | 3702 | | |
3698 | 3703 | | |
3699 | 3704 | | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
3700 | 3709 | | |
3701 | 3710 | | |
3702 | 3711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1851 | 1851 | | |
1852 | 1852 | | |
1853 | 1853 | | |
| 1854 | + | |
1854 | 1855 | | |
1855 | 1856 | | |
1856 | 1857 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
813 | | - | |
| 813 | + | |
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
691 | 693 | | |
692 | 694 | | |
693 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
694 | 735 | | |
695 | 736 | | |
696 | | - | |
| 737 | + | |
| 738 | + | |
697 | 739 | | |
698 | 740 | | |
699 | 741 | | |
700 | 742 | | |
701 | 743 | | |
702 | 744 | | |
703 | 745 | | |
| 746 | + | |
| 747 | + | |
704 | 748 | | |
705 | 749 | | |
706 | 750 | | |
| |||
734 | 778 | | |
735 | 779 | | |
736 | 780 | | |
737 | | - | |
| 781 | + | |
738 | 782 | | |
739 | 783 | | |
740 | 784 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | | - | |
| 56 | + | |
56 | 57 | | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| 77 | + | |
74 | 78 | | |
75 | 79 | | |
| 80 | + | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
| |||
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
120 | 132 | | |
121 | 133 | | |
122 | 134 | | |
| |||
131 | 143 | | |
132 | 144 | | |
133 | 145 | | |
134 | | - | |
135 | | - | |
136 | 146 | | |
137 | 147 | | |
138 | 148 | | |
| |||
166 | 176 | | |
167 | 177 | | |
168 | 178 | | |
169 | | - | |
170 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
171 | 182 | | |
172 | 183 | | |
173 | 184 | | |
| |||
189 | 200 | | |
190 | 201 | | |
191 | 202 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 203 | | |
200 | 204 | | |
201 | 205 | | |
| |||
206 | 210 | | |
207 | 211 | | |
208 | 212 | | |
209 | | - | |
| 213 | + | |
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
213 | | - | |
| 217 | + | |
214 | 218 | | |
215 | 219 | | |
216 | 220 | | |
217 | 221 | | |
218 | 222 | | |
219 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
220 | 234 | | |
221 | 235 | | |
222 | 236 | | |
223 | 237 | | |
224 | | - | |
225 | | - | |
| 238 | + | |
| 239 | + | |
226 | 240 | | |
227 | 241 | | |
228 | | - | |
| 242 | + | |
229 | 243 | | |
230 | 244 | | |
231 | 245 | | |
| |||
270 | 284 | | |
271 | 285 | | |
272 | 286 | | |
| 287 | + | |
| 288 | + | |
273 | 289 | | |
274 | 290 | | |
275 | 291 | | |
276 | 292 | | |
277 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
278 | 300 | | |
279 | 301 | | |
280 | 302 | | |
281 | 303 | | |
282 | 304 | | |
283 | 305 | | |
| 306 | + | |
| 307 | + | |
284 | 308 | | |
285 | 309 | | |
286 | 310 | | |
287 | 311 | | |
288 | 312 | | |
289 | | - | |
290 | | - | |
291 | 313 | | |
292 | 314 | | |
293 | 315 | | |
294 | 316 | | |
295 | 317 | | |
296 | 318 | | |
297 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
298 | 335 | | |
299 | 336 | | |
300 | 337 | | |
| |||
305 | 342 | | |
306 | 343 | | |
307 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
308 | 388 | | |
309 | 389 | | |
310 | 390 | | |
| |||
0 commit comments