Is there any information in the struct skbuff to distinguish between the forwarding traffic (bridge forwarding and ip forwarding) and locally originated traffic? We want to treat these two kinds of traffic differently in the network driver because the forwarding traffic do not require cache invalidation on the whole packet size.
Any suggestions are appreciated. Thank you very much!
Yes it’s possible, you can try to follow the life cycle of a receiving packet by looking at all calls from this function
ip_rcv_finish(http://lxr.free-electrons.com/source/net/ipv4/ip_input.c?v=3.3#L317).The struct
struct sk_buffcontain a pointer to the destination entry :which contain a function pointer :
to call for the input packet, in the case of local packet the kernel call
ip_local_deliverfunction and for the forwarding packet it callsip_forwardfunction.I think that you can, check like this for local and forwarded packets:
– Local :
– Forward :