• Pablo Neira Ayuso's avatar
    net: flow_offload: consolidate indirect flow_block infrastructure · 1fac52da
    Pablo Neira Ayuso authored
    Tunnel devices provide no dev->netdev_ops->ndo_setup_tc(...) interface.
    The tunnel device and route control plane does not provide an obvious
    way to relate tunnel and physical devices.
    
    This patch allows drivers to register a tunnel device offload handler
    for the tc and netfilter frontends through flow_indr_dev_register() and
    flow_indr_dev_unregister().
    
    The frontend calls flow_indr_dev_setup_offload() that iterates over the
    list of drivers that are offering tunnel device hardware offload
    support and it sets up the flow block for this tunnel device.
    
    If the driver module is removed, the indirect flow_block ends up with a
    stale callback reference. The module removal path triggers the
    dev_shutdown() path to remove the qdisc and the flow_blocks for the
    physical devices. However, this is not useful for tunnel devices, where
    relation between the physical and the tunnel device is not explicit.
    
    This patch introduces a cleanup callback that is invoked when the driver
    module is removed to clean up the tunnel device flow_block. This patch
    defines struct flow_block_indr and it uses it from flow_block_cb to
    store the information that front-end requires to perform the
    flow_block_cb cleanup on module removal.
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1fac52da
flow_offload.h 15.3 KB