linux/drivers/net/ethernet/intel/ice/ice_fdir.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2018-2020, Intel Corporation. */

#include "ice_common.h"

/* These are training packet headers used to program flow director filters. */
static const u8 ice_fdir_eth_pkt[22];

static const u8 ice_fdir_tcpv4_pkt[] =;

static const u8 ice_fdir_udpv4_pkt[] =;

static const u8 ice_fdir_sctpv4_pkt[] =;

static const u8 ice_fdir_ipv4_pkt[] =;

static const u8 ice_fdir_udp4_gtpu4_pkt[] =;

static const u8 ice_fdir_tcp4_gtpu4_pkt[] =;

static const u8 ice_fdir_icmp4_gtpu4_pkt[] =;

static const u8 ice_fdir_ipv4_gtpu4_pkt[] =;

static const u8 ice_fdir_ipv4_l2tpv3_pkt[] =;

static const u8 ice_fdir_ipv6_l2tpv3_pkt[] =;

static const u8 ice_fdir_ipv4_esp_pkt[] =;

static const u8 ice_fdir_ipv6_esp_pkt[] =;

static const u8 ice_fdir_ipv4_ah_pkt[] =;

static const u8 ice_fdir_ipv6_ah_pkt[] =;

static const u8 ice_fdir_ipv4_nat_t_esp_pkt[] =;

static const u8 ice_fdir_ipv6_nat_t_esp_pkt[] =;

static const u8 ice_fdir_ipv4_pfcp_node_pkt[] =;

static const u8 ice_fdir_ipv4_pfcp_session_pkt[] =;

static const u8 ice_fdir_ipv6_pfcp_node_pkt[] =;

static const u8 ice_fdir_ipv6_pfcp_session_pkt[] =;

static const u8 ice_fdir_non_ip_l2_pkt[] =;

static const u8 ice_fdir_tcpv6_pkt[] =;

static const u8 ice_fdir_udpv6_pkt[] =;

static const u8 ice_fdir_sctpv6_pkt[] =;

static const u8 ice_fdir_ipv6_pkt[] =;

static const u8 ice_fdir_tcp4_tun_pkt[] =;

static const u8 ice_fdir_udp4_tun_pkt[] =;

static const u8 ice_fdir_sctp4_tun_pkt[] =;

static const u8 ice_fdir_ip4_tun_pkt[] =;

static const u8 ice_fdir_tcp6_tun_pkt[] =;

static const u8 ice_fdir_udp6_tun_pkt[] =;

static const u8 ice_fdir_sctp6_tun_pkt[] =;

static const u8 ice_fdir_ip6_tun_pkt[] =;

/* Flow Director no-op training packet table */
static const struct ice_fdir_base_pkt ice_fdir_pkt[] =;

#define ICE_FDIR_NUM_PKT

/**
 * ice_set_dflt_val_fd_desc
 * @fd_fltr_ctx: pointer to fd filter descriptor
 */
static void ice_set_dflt_val_fd_desc(struct ice_fd_fltr_desc_ctx *fd_fltr_ctx)
{}

/**
 * ice_set_fd_desc_val
 * @ctx: pointer to fd filter descriptor context
 * @fdir_desc: populated with fd filter descriptor values
 */
static void
ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *ctx,
		    struct ice_fltr_desc *fdir_desc)
{}

/**
 * ice_fdir_get_prgm_desc - set a fdir descriptor from a fdir filter struct
 * @hw: pointer to the hardware structure
 * @input: filter
 * @fdesc: filter descriptor
 * @add: if add is true, this is an add operation, false implies delete
 */
void
ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
		       struct ice_fltr_desc *fdesc, bool add)
{}

/**
 * ice_alloc_fd_res_cntr - obtain counter resource for FD type
 * @hw: pointer to the hardware structure
 * @cntr_id: returns counter index
 */
int ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id)
{}

/**
 * ice_free_fd_res_cntr - Free counter resource for FD type
 * @hw: pointer to the hardware structure
 * @cntr_id: counter index to be freed
 */
int ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id)
{}

/**
 * ice_alloc_fd_guar_item - allocate resource for FD guaranteed entries
 * @hw: pointer to the hardware structure
 * @cntr_id: returns counter index
 * @num_fltr: number of filter entries to be allocated
 */
int ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
{}

/**
 * ice_alloc_fd_shrd_item - allocate resource for flow director shared entries
 * @hw: pointer to the hardware structure
 * @cntr_id: returns counter index
 * @num_fltr: number of filter entries to be allocated
 */
int ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
{}

/**
 * ice_get_fdir_cnt_all - get the number of Flow Director filters
 * @hw: hardware data structure
 *
 * Returns the number of filters available on device
 */
int ice_get_fdir_cnt_all(struct ice_hw *hw)
{}

/**
 * ice_pkt_insert_ipv6_addr - insert a be32 IPv6 address into a memory buffer
 * @pkt: packet buffer
 * @offset: offset into buffer
 * @addr: IPv6 address to convert and insert into pkt at offset
 */
static void ice_pkt_insert_ipv6_addr(u8 *pkt, int offset, __be32 *addr)
{}

/**
 * ice_pkt_insert_u6_qfi - insert a u6 value QFI into a memory buffer for GTPU
 * @pkt: packet buffer
 * @offset: offset into buffer
 * @data: 8 bit value to convert and insert into pkt at offset
 *
 * This function is designed for inserting QFI (6 bits) for GTPU.
 */
static void ice_pkt_insert_u6_qfi(u8 *pkt, int offset, u8 data)
{}

/**
 * ice_pkt_insert_u8 - insert a u8 value into a memory buffer.
 * @pkt: packet buffer
 * @offset: offset into buffer
 * @data: 8 bit value to convert and insert into pkt at offset
 */
static void ice_pkt_insert_u8(u8 *pkt, int offset, u8 data)
{}

/**
 * ice_pkt_insert_u8_tc - insert a u8 value into a memory buffer for TC ipv6.
 * @pkt: packet buffer
 * @offset: offset into buffer
 * @data: 8 bit value to convert and insert into pkt at offset
 *
 * This function is designed for inserting Traffic Class (TC) for IPv6,
 * since that TC is not aligned in number of bytes. Here we split it out
 * into two part and fill each byte with data copy from pkt, then insert
 * the two bytes data one by one.
 */
static void ice_pkt_insert_u8_tc(u8 *pkt, int offset, u8 data)
{}

/**
 * ice_pkt_insert_u16 - insert a be16 value into a memory buffer
 * @pkt: packet buffer
 * @offset: offset into buffer
 * @data: 16 bit value to convert and insert into pkt at offset
 */
static void ice_pkt_insert_u16(u8 *pkt, int offset, __be16 data)
{}

/**
 * ice_pkt_insert_u32 - insert a be32 value into a memory buffer
 * @pkt: packet buffer
 * @offset: offset into buffer
 * @data: 32 bit value to convert and insert into pkt at offset
 */
static void ice_pkt_insert_u32(u8 *pkt, int offset, __be32 data)
{}

/**
 * ice_pkt_insert_mac_addr - insert a MAC addr into a memory buffer.
 * @pkt: packet buffer
 * @addr: MAC address to convert and insert into pkt at offset
 */
static void ice_pkt_insert_mac_addr(u8 *pkt, u8 *addr)
{}

/**
 * ice_fdir_get_gen_prgm_pkt - generate a training packet
 * @hw: pointer to the hardware structure
 * @input: flow director filter data structure
 * @pkt: pointer to return filter packet
 * @frag: generate a fragment packet
 * @tun: true implies generate a tunnel packet
 */
int
ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
			  u8 *pkt, bool frag, bool tun)
{}

/**
 * ice_fdir_has_frag - does flow type have 2 ptypes
 * @flow: flow ptype
 *
 * returns true is there is a fragment packet for this ptype
 */
bool ice_fdir_has_frag(enum ice_fltr_ptype flow)
{}

/**
 * ice_fdir_find_fltr_by_idx - find filter with idx
 * @hw: pointer to hardware structure
 * @fltr_idx: index to find.
 *
 * Returns pointer to filter if found or null
 */
struct ice_fdir_fltr *
ice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx)
{}

/**
 * ice_fdir_list_add_fltr - add a new node to the flow director filter list
 * @hw: hardware structure
 * @fltr: filter node to add to structure
 */
void ice_fdir_list_add_fltr(struct ice_hw *hw, struct ice_fdir_fltr *fltr)
{}

/**
 * ice_fdir_update_cntrs - increment / decrement filter counter
 * @hw: pointer to hardware structure
 * @flow: filter flow type
 * @add: true implies filters added
 */
void
ice_fdir_update_cntrs(struct ice_hw *hw, enum ice_fltr_ptype flow, bool add)
{}

/**
 * ice_cmp_ipv6_addr - compare 2 IP v6 addresses
 * @a: IP v6 address
 * @b: IP v6 address
 *
 * Returns 0 on equal, returns non-0 if different
 */
static int ice_cmp_ipv6_addr(__be32 *a, __be32 *b)
{}

/**
 * ice_fdir_comp_rules - compare 2 filters
 * @a: a Flow Director filter data structure
 * @b: a Flow Director filter data structure
 *
 * Returns true if the filters match
 */
static bool
ice_fdir_comp_rules(struct ice_fdir_fltr *a,  struct ice_fdir_fltr *b)
{}

/**
 * ice_fdir_is_dup_fltr - test if filter is already in list for PF
 * @hw: hardware data structure
 * @input: Flow Director filter data structure
 *
 * Returns true if the filter is found in the list
 */
bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input)
{}