On Tuesday 28 December 2004 06:10 pm, Marc Singer wrote: > I'm implementing a new network driver. In reading other drivers and > the documentation, I'm finding that there is a new (-er) interface > that is recommended. > > The target is an embedded MAC of an ARM7 CPU with an integrated DMA > controller. > > 1) Is there any reason not mentioned in the HOWTO for not > implementing NAPI? NAPI is based on a timer. So there is a trade off between interrupt servicing and slightly delayed packet servicing (plus the extra CPU load for the timer). If you have a realtime system, then I would think that NAPI isn't the best thing for it. > 2) I've read that it is a bad idea to hang-on to SKBs. With DMA > this CPU can eliminate the packet copying, but that means that > the receive queue will have SKBs laying around. Is this > acceptable? I don't know why it would be bad to hang on to SKBs. Most drivers keep them around if they are less than their rx_copybreak def. > 3) In the prerequisites (from the HOWTO) > > B) Ability to turn off interrupts or maybe events that send > packets up the stack. > > What does this sentence mean? Most/All adapters have the ability to disable interrupts (or conversely to enable interrupts). This is need for NAPI to be used, the ability to disable interrupts and have the NAPI timer handle all incoming (and outgoing) packets. > > 4) I'm presently DMAing into an SKB. While there are other > problems that challeng the driver, it looks like buffers are > not being properly received by netif. > > Here's what I'm doing when a packet comes in: > > struct sk_buff* skb = emac->rg_rx_skb[emac->head_rx]; > size_t packet_len = emac->rg_rx_descriptor[emac->head_rx *2+1] & 0x7ff; > net_d->last_rx = jiffies; > skb->protocol = eth_type_trans (skb, net_d); > skb_put (skb, packet_len); > PRINT_PKT (skb->data, packet_len > 64 ? 64 : packet_len); > netif_rx (skb); I don't see any unmapping of the DMA address. > I've not found a good example. Is this right using the old interface? There are plenty of good examples out there. Look at any of the newer ethernet device drivers. > Cheers. > - > : send the line "unsubscribe linux-net" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- Jon Mason jdmason@xxxxxxxxxx - : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html