On 4/27/17 10:06 PM, John Fastabend wrote:
That is more or less what I was thinking as well. The other question I have though is should we have a bpf_redirect() call for the simple case where I use the ifindex directly. This will be helpful for taking existing programs from tc_cls into xdp. I think it makes sense to have both bpf_tx_allports(), bpf_tx_port(), and bpf_redirect().
I think so too. Once netdevice is stored into netdev_array map the netdevice is pinned and we need to figure out what to do if somebody tries to delete it. Should we add a new netlink notifier that this netdev's refcnt is almost zero and it's only in netdev_array(s) ? or should it be deleted from the array(s) automatically and then user space will be notified post-deletion? Both approaches have their pros and cons. Whereas raw ifindex approach (via bpf_redirect) doesn't have these caveats. It's clear to both bpf prog and user space that ifindex can be stale and user space needs to monitor netdevs and update programs/maps.