The syntax for netif_napi_add is:
netif_napi_add(struct net_device *dev, struct napi_struct *napi,int (*poll)(struct napi_struct *, int), int weight)
It is used for initializing the napi structure. The problem is, when I use the function as:
netif_napi_add(wdev,rnapi,rrpoll(rnapi,20),16);
It’s giving me a compilation warning:
warning: passing argument 3 of ‘netif_napi_add’ makes pointer from integer without a cast
/usr/src/linux-2.6.34.10-0.6/include/linux/netdevice.h:1089:6: note: expected ‘int (*)(struct napi_struct *, int)’ but argument is of type ‘int’
How do I fix it?
The third argument to
netif_napi_add,int (*poll)(struct napi_struct *, int), is a function pointer namedpollthat points to a function that takes astruct napi_struct *and anintand returns anint. You’re callingrrpolldirectly and passing its return value (anint) tonetif_napi_add, instead of a function pointer. You probably want to just passrrpollto the function directly: