Date: Thu, 31 Aug 2023 21:51:42 +0200 From: Vincenzo Maffione <v.maffione@gmail.com> To: PAVEL POPA <pavel.popa@edu.unife.it> Cc: freebsd-net@freebsd.org Subject: Re: About IFLIB compliant network device driver development Message-ID: <CA%2B_eA9iOHas3yJFobkKn4DY4eoqf%2BTXmfmcAz6Uf4eJ52sBhVA@mail.gmail.com> In-Reply-To: <CAMeLQE%2B7E1g1Yi58qv=_of1bbABosFa_ZzOMdmA_A5uBGiG%2Bjg@mail.gmail.com> References: <CAMeLQE%2B7E1g1Yi58qv=_of1bbABosFa_ZzOMdmA_A5uBGiG%2Bjg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Hi, I think it's pretty common nowadays to have NICs with completion rings/queues. It is definitely appropriate to implement such drivers with iflib, and indeed iflib provides separate callbacks for updating the TX/RX "submission" and "completion" queues: - ift_txd_encap: submit a packet to a TX ring (or submission queue) - ift_txd_flush: flush submitted TX descriptors to the hardware. - ift_txd_credits_update: check the completion queue (or reclaim completed descriptor from the TX ring). - ift_rxd_refill: submit RX descriptors to a RX ring (or submission queue) - ift_rxd_flush: flush submitted RX descriptors to the NIC hardware. - ift_rxd_pkt_get: get a received packet from the completion queue (or reclaim completed descriptor from the RX ring) - ... If you want to look at an example of iflib driver using completion queues, you can check out sys/dev/vmware/vmxnet3/. It's actually a pretty complex example because vmxnet3 is a complex paravirtualized device with multiple versions etc.. However, the complexity does not come from the completion rings... Cheers, Vincenzo Il giorno mer 30 ago 2023 alle ore 15:58 PAVEL POPA <pavel.popa@edu.unife.it> ha scritto: > I have a NIC (a SmartNIC actually) for which I have to implement a > driver, which in addition to RX and TX rings exposes also completion > CMPT rings. Due to this additional complication (the CMPT rings), I'm > not sure how appropriate it is to implement such a driver via the > IFLIB framework. Does anyone have any similar experience that can > share? Any suggestions at all, ideas, feedbacks? > > Thanks in advance, > Pavel > > -- Vincenzo [-- Attachment #2 --] <div dir="ltr"><div>Hi,</div><div> I think it's pretty common nowadays to have NICs with completion rings/queues. It is definitely appropriate to implement such drivers with iflib, and indeed iflib provides separate callbacks for updating the TX/RX "submission" and "completion" queues:</div><div><ul><li>ift_txd_encap: submit a packet to a TX ring (or submission queue)<br></li><li>ift_txd_flush: flush submitted TX descriptors to the hardware.</li><li>ift_txd_credits_update: check the completion queue (or reclaim completed descriptor from the TX ring).</li><li>ift_rxd_refill: submit RX descriptors to a RX ring (or submission queue)</li><li>ift_rxd_flush: flush submitted RX descriptors to the NIC hardware.<br></li><li>ift_rxd_pkt_get: get a received packet from the completion queue (or reclaim completed descriptor from the RX ring)</li><li>...</li></ul><div>If you want to look at an example of iflib driver using completion queues, you can check out sys/dev/vmware/vmxnet3/.</div><div><br></div><div>It's actually a pretty complex example because vmxnet3 is a complex paravirtualized device with multiple versions etc..</div><div>However, the complexity does not come from the completion rings...</div><div><br></div><div>Cheers,</div><div> Vincenzo<br></div><div><br></div></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mer 30 ago 2023 alle ore 15:58 PAVEL POPA <<a href="mailto:pavel.popa@edu.unife.it">pavel.popa@edu.unife.it</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I have a NIC (a SmartNIC actually) for which I have to implement a<br> driver, which in addition to RX and TX rings exposes also completion<br> CMPT rings. Due to this additional complication (the CMPT rings), I'm<br> not sure how appropriate it is to implement such a driver via the<br> IFLIB framework. Does anyone have any similar experience that can<br> share? Any suggestions at all, ideas, feedbacks?<br> <br> Thanks in advance,<br> Pavel<br> <br> </blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Vincenzo<br></div></div></div>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B_eA9iOHas3yJFobkKn4DY4eoqf%2BTXmfmcAz6Uf4eJ52sBhVA>
