aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2011-03-11 22:14:39 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-16 15:53:54 -0400
commit8a4eb5734e8d1dc60a8c28576bbbdfdcc643626d (patch)
treeed4cd2f9a2a04a30994a8f8964a81834c895c0c9 /include/linux
parent2d7011ca79f1a8792e04d131b8ea21db179ab917 (diff)
net: introduce rx_handler results and logic around that
This patch allows rx_handlers to better signalize what to do next to it's caller. That makes skb->deliver_no_wcard no longer needed. kernel-doc for rx_handler_result is taken from Nicolas' patch. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h50
-rw-r--r--include/linux/skbuff.h5
2 files changed, 50 insertions, 5 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 604dbf5051d3..5eeb2cd3631c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -390,7 +390,55 @@ enum gro_result {
390}; 390};
391typedef enum gro_result gro_result_t; 391typedef enum gro_result gro_result_t;
392 392
393typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb); 393/*
394 * enum rx_handler_result - Possible return values for rx_handlers.
395 * @RX_HANDLER_CONSUMED: skb was consumed by rx_handler, do not process it
396 * further.
397 * @RX_HANDLER_ANOTHER: Do another round in receive path. This is indicated in
398 * case skb->dev was changed by rx_handler.
399 * @RX_HANDLER_EXACT: Force exact delivery, no wildcard.
400 * @RX_HANDLER_PASS: Do nothing, passe the skb as if no rx_handler was called.
401 *
402 * rx_handlers are functions called from inside __netif_receive_skb(), to do
403 * special processing of the skb, prior to delivery to protocol handlers.
404 *
405 * Currently, a net_device can only have a single rx_handler registered. Trying
406 * to register a second rx_handler will return -EBUSY.
407 *
408 * To register a rx_handler on a net_device, use netdev_rx_handler_register().
409 * To unregister a rx_handler on a net_device, use
410 * netdev_rx_handler_unregister().
411 *
412 * Upon return, rx_handler is expected to tell __netif_receive_skb() what to
413 * do with the skb.
414 *
415 * If the rx_handler consumed to skb in some way, it should return
416 * RX_HANDLER_CONSUMED. This is appropriate when the rx_handler arranged for
417 * the skb to be delivered in some other ways.
418 *
419 * If the rx_handler changed skb->dev, to divert the skb to another
420 * net_device, it should return RX_HANDLER_ANOTHER. The rx_handler for the
421 * new device will be called if it exists.
422 *
423 * If the rx_handler consider the skb should be ignored, it should return
424 * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that
425 * are registred on exact device (ptype->dev == skb->dev).
426 *
427 * If the rx_handler didn't changed skb->dev, but want the skb to be normally
428 * delivered, it should return RX_HANDLER_PASS.
429 *
430 * A device without a registered rx_handler will behave as if rx_handler
431 * returned RX_HANDLER_PASS.
432 */
433
434enum rx_handler_result {
435 RX_HANDLER_CONSUMED,
436 RX_HANDLER_ANOTHER,
437 RX_HANDLER_EXACT,
438 RX_HANDLER_PASS,
439};
440typedef enum rx_handler_result rx_handler_result_t;
441typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
394 442
395extern void __napi_schedule(struct napi_struct *n); 443extern void __napi_schedule(struct napi_struct *n);
396 444
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 31f02d0b46a7..24cfa626931e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -388,10 +388,7 @@ struct sk_buff {
388 kmemcheck_bitfield_begin(flags2); 388 kmemcheck_bitfield_begin(flags2);
389 __u16 queue_mapping:16; 389 __u16 queue_mapping:16;
390#ifdef CONFIG_IPV6_NDISC_NODETYPE 390#ifdef CONFIG_IPV6_NDISC_NODETYPE
391 __u8 ndisc_nodetype:2, 391 __u8 ndisc_nodetype:2;
392 deliver_no_wcard:1;
393#else
394 __u8 deliver_no_wcard:1;
395#endif 392#endif
396 __u8 ooo_okay:1; 393 __u8 ooo_okay:1;
397 kmemcheck_bitfield_end(flags2); 394 kmemcheck_bitfield_end(flags2);