[RFC] gro: Is it ok to share a single napi from several devs ?

Eric Dumazet
2010-08-28T10:54:12Z

In commit f2bde7328633269ee935d9ed96535ade15cc348f
Author: Stephen Hemminger <shemminger@vyatta.com>

net: allow multiple dev per napi with GRO

GRO assumes that there is a one-to-one relationship between NAPI
structure and network device. Some devices like sky2 share multiple
devices on a single interrupt so only have one NAPI handler. Rather than
split GRO from NAPI, just have GRO assume if device changes that
it is a different flow.

It was assumed a napi could be shared by several devs, but I dont really
understand, since we have an unique ->dev pointer inside "napi_struct",
this one is set once, and never change.

This pointer is currently used from napi_get_frags() [but that could be
avoided], and from netpoll_poll_lock().

The netpoll_poll_lock() case is problematic.

static inline void *netpoll_poll_lock(struct napi_struct *napi)
{
struct net_device *dev = napi->_dev;

if (dev && dev->npinfo) {
spin_lock(&napi->poll_lock);

Maybe we should remove 'dev' field from napi_struct and replace it by a
npinfo pointer ?