Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
filter.c File Reference
#include <linux/in.h>
#include <net/ip.h>
#include "efx.h"
#include "filter.h"
#include "io.h"
#include "nic.h"
#include "regs.h"

Go to the source code of this file.

Data Structures

struct  efx_filter_table
 
struct  efx_filter_state
 

Macros

#define FILTER_CTL_SRCH_FUDGE_WILD   3
 
#define FILTER_CTL_SRCH_FUDGE_FULL   1
 
#define FILTER_CTL_SRCH_MAX   200
 
#define FILTER_CTL_SRCH_HINT_MAX   5
 
#define EFX_FILTER_MATCH_PRI_COUNT   5
 
#define EFX_FILTER_INDEX_WIDTH   13
 
#define EFX_FILTER_INDEX_MASK   ((1 << EFX_FILTER_INDEX_WIDTH) - 1)
 

Enumerations

enum  efx_filter_table_id {
  EFX_FILTER_TABLE_RX_IP = 0, EFX_FILTER_TABLE_RX_MAC, EFX_FILTER_TABLE_RX_DEF, EFX_FILTER_TABLE_TX_MAC,
  EFX_FILTER_TABLE_COUNT
}
 
enum  efx_filter_index { EFX_FILTER_INDEX_UC_DEF, EFX_FILTER_INDEX_MC_DEF, EFX_FILTER_SIZE_RX_DEF }
 

Functions

int efx_filter_set_ipv4_local (struct efx_filter_spec *spec, u8 proto, __be32 host, __be16 port)
 
int efx_filter_get_ipv4_local (const struct efx_filter_spec *spec, u8 *proto, __be32 *host, __be16 *port)
 
int efx_filter_set_ipv4_full (struct efx_filter_spec *spec, u8 proto, __be32 host, __be16 port, __be32 rhost, __be16 rport)
 
int efx_filter_get_ipv4_full (const struct efx_filter_spec *spec, u8 *proto, __be32 *host, __be16 *port, __be32 *rhost, __be16 *rport)
 
int efx_filter_set_eth_local (struct efx_filter_spec *spec, u16 vid, const u8 *addr)
 
int efx_filter_set_uc_def (struct efx_filter_spec *spec)
 
int efx_filter_set_mc_def (struct efx_filter_spec *spec)
 
int efx_filter_get_eth_local (const struct efx_filter_spec *spec, u16 *vid, u8 *addr)
 
u32 efx_filter_get_rx_id_limit (struct efx_nic *efx)
 
s32 efx_filter_insert_filter (struct efx_nic *efx, struct efx_filter_spec *spec, bool replace)
 
int efx_filter_remove_id_safe (struct efx_nic *efx, enum efx_filter_priority priority, u32 filter_id)
 
int efx_filter_get_filter_safe (struct efx_nic *efx, enum efx_filter_priority priority, u32 filter_id, struct efx_filter_spec *spec_buf)
 
void efx_filter_clear_rx (struct efx_nic *efx, enum efx_filter_priority priority)
 
u32 efx_filter_count_rx_used (struct efx_nic *efx, enum efx_filter_priority priority)
 
s32 efx_filter_get_rx_ids (struct efx_nic *efx, enum efx_filter_priority priority, u32 *buf, u32 size)
 
void efx_restore_filters (struct efx_nic *efx)
 
int efx_probe_filters (struct efx_nic *efx)
 
void efx_remove_filters (struct efx_nic *efx)
 

Macro Definition Documentation

#define EFX_FILTER_INDEX_MASK   ((1 << EFX_FILTER_INDEX_WIDTH) - 1)

Definition at line 594 of file filter.c.

#define EFX_FILTER_INDEX_WIDTH   13

Definition at line 593 of file filter.c.

#define EFX_FILTER_MATCH_PRI_COUNT   5

Definition at line 568 of file filter.c.

#define FILTER_CTL_SRCH_FUDGE_FULL   1

Definition at line 23 of file filter.c.

#define FILTER_CTL_SRCH_FUDGE_WILD   3

Definition at line 22 of file filter.c.

#define FILTER_CTL_SRCH_HINT_MAX   5

Definition at line 33 of file filter.c.

#define FILTER_CTL_SRCH_MAX   200

Definition at line 29 of file filter.c.

Enumeration Type Documentation

Enumerator:
EFX_FILTER_INDEX_UC_DEF 
EFX_FILTER_INDEX_MC_DEF 
EFX_FILTER_SIZE_RX_DEF 

Definition at line 43 of file filter.c.

Enumerator:
EFX_FILTER_TABLE_RX_IP 
EFX_FILTER_TABLE_RX_MAC 
EFX_FILTER_TABLE_RX_DEF 
EFX_FILTER_TABLE_TX_MAC 
EFX_FILTER_TABLE_COUNT 

Definition at line 35 of file filter.c.

Function Documentation

void efx_filter_clear_rx ( struct efx_nic efx,
enum efx_filter_priority  priority 
)

efx_filter_clear_rx - remove RX filters by priority : NIC from which to remove the filters : Maximum priority to remove

Definition at line 872 of file filter.c.

u32 efx_filter_count_rx_used ( struct efx_nic efx,
enum efx_filter_priority  priority 
)

Definition at line 878 of file filter.c.

int efx_filter_get_eth_local ( const struct efx_filter_spec spec,
u16 vid,
u8 addr 
)

Definition at line 419 of file filter.c.

int efx_filter_get_filter_safe ( struct efx_nic efx,
enum efx_filter_priority  priority,
u32  filter_id,
struct efx_filter_spec spec_buf 
)

efx_filter_get_filter_safe - retrieve a filter by ID, carefully : NIC from which to remove the filter : Priority of filter, as passed to : ID of filter, as returned by : Buffer in which to store filter specification

This function will range-check , so it is safe to call with a value passed from userland.

Definition at line 809 of file filter.c.

int efx_filter_get_ipv4_full ( const struct efx_filter_spec spec,
u8 proto,
__be32 host,
__be16 port,
__be32 rhost,
__be16 rport 
)

Definition at line 325 of file filter.c.

int efx_filter_get_ipv4_local ( const struct efx_filter_spec spec,
u8 proto,
__be32 host,
__be16 port 
)

Definition at line 268 of file filter.c.

u32 efx_filter_get_rx_id_limit ( struct efx_nic efx)

Definition at line 633 of file filter.c.

s32 efx_filter_get_rx_ids ( struct efx_nic efx,
enum efx_filter_priority  priority,
u32 buf,
u32  size 
)

Definition at line 905 of file filter.c.

s32 efx_filter_insert_filter ( struct efx_nic efx,
struct efx_filter_spec spec,
bool  replace 
)

efx_filter_insert_filter - add or replace a filter : NIC in which to insert the filter : Specification for the filter : Flag for whether the specified filter may replace a filter with an identical match expression and equal or lower priority

On success, return the filter ID. On failure, return a negative error code.

Definition at line 659 of file filter.c.

int efx_filter_remove_id_safe ( struct efx_nic efx,
enum efx_filter_priority  priority,
u32  filter_id 
)

efx_filter_remove_id_safe - remove a filter by ID, carefully : NIC from which to remove the filter : Priority of filter, as passed to : ID of filter, as returned by

This function will range-check , so it is safe to call with a value passed from userland.

Definition at line 758 of file filter.c.

int efx_filter_set_eth_local ( struct efx_filter_spec spec,
u16  vid,
const u8 addr 
)

efx_filter_set_eth_local - specify local Ethernet address and optional VID : Specification to initialise : VLAN ID to match, or EFX_FILTER_VID_UNSPEC : Local Ethernet MAC address

Definition at line 350 of file filter.c.

int efx_filter_set_ipv4_full ( struct efx_filter_spec spec,
u8  proto,
__be32  host,
__be16  port,
__be32  rhost,
__be16  rport 
)

efx_filter_set_ipv4_full - specify IPv4 hosts, transport protocol and ports : Specification to initialise : Transport layer protocol number : Local host address (network byte order) : Local port (network byte order) : Remote host address (network byte order) : Remote port (network byte order)

Definition at line 297 of file filter.c.

int efx_filter_set_ipv4_local ( struct efx_filter_spec spec,
u8  proto,
__be32  host,
__be16  port 
)

efx_filter_set_ipv4_local - specify IPv4 host, transport protocol and port : Specification to initialise : Transport layer protocol number : Local host address (network byte order) : Local port (network byte order)

Definition at line 225 of file filter.c.

int efx_filter_set_mc_def ( struct efx_filter_spec spec)

efx_filter_set_mc_def - specify matching otherwise-unmatched multicast : Specification to initialise

Definition at line 394 of file filter.c.

int efx_filter_set_uc_def ( struct efx_filter_spec spec)

efx_filter_set_uc_def - specify matching otherwise-unmatched unicast : Specification to initialise

Definition at line 377 of file filter.c.

int efx_probe_filters ( struct efx_nic efx)

Definition at line 972 of file filter.c.

void efx_remove_filters ( struct efx_nic efx)

Definition at line 1048 of file filter.c.

void efx_restore_filters ( struct efx_nic efx)

Definition at line 940 of file filter.c.