Re: About IFLIB compliant network device driver development

From: Vincenzo Maffione <v.maffione_at_gmail.com>
Date: Thu, 31 Aug 2023 19:51:42 UTC
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