src/dpdk/drivers/net/e1000/igb_ethdev.c
static inline void
igb_inject_2uple_filter(struct rte_eth_dev *dev,
			   struct e1000_2tuple_filter *filter)
{
	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
	uint32_t ttqf = E1000_TTQF_DISABLE_MASK;
	uint32_t imir, imir_ext = E1000_IMIREXT_SIZE_BP;
	int i;

	i = filter->index;
	imir = (uint32_t)(filter->filter_info.dst_port & E1000_IMIR_DSTPORT);
	if (filter->filter_info.dst_port_mask == 1) /* 1b means not compare. */
		imir |= E1000_IMIR_PORT_BP;
	else
		imir &= ~E1000_IMIR_PORT_BP;

	imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;

	ttqf |= E1000_TTQF_QUEUE_ENABLE;
	ttqf |= (uint32_t)(filter->queue << E1000_TTQF_QUEUE_SHIFT);
	ttqf |= (uint32_t)(filter->filter_info.proto &
						E1000_TTQF_PROTOCOL_MASK);
	if (filter->filter_info.proto_mask == 0)
		ttqf &= ~E1000_TTQF_MASK_ENABLE;

	/* tcp flags bits setting. */
	if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
		if (filter->filter_info.tcp_flags & RTE_TCP_URG_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_URG;
		if (filter->filter_info.tcp_flags & RTE_TCP_ACK_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_ACK;
		if (filter->filter_info.tcp_flags & RTE_TCP_PSH_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_PSH;
		if (filter->filter_info.tcp_flags & RTE_TCP_RST_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_RST;
		if (filter->filter_info.tcp_flags & RTE_TCP_SYN_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_SYN;
		if (filter->filter_info.tcp_flags & RTE_TCP_FIN_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_FIN;
	} else {
		imir_ext |= E1000_IMIREXT_CTRL_BP;
	}
	E1000_WRITE_REG(hw, E1000_IMIR(i), imir);
	E1000_WRITE_REG(hw, E1000_TTQF(i), ttqf);
	E1000_WRITE_REG(hw, E1000_IMIREXT(i), imir_ext);
}
/* inject a igb 2tuple filter to HW */
inject a igb 2tuple filter to HW
inject a igb 2tuple filter to HW
static inline void
igb_inject_2uple_filter(struct rte_eth_dev *dev,
			   struct e1000_2tuple_filter *filter)
{
	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
	uint32_t ttqf = E1000_TTQF_DISABLE_MASK;
	uint32_t imir, imir_ext = E1000_IMIREXT_SIZE_BP;
	int i;
	i = filter->index;
	imir = (uint32_t)(filter->filter_info.dst_port & E1000_IMIR_DSTPORT);
	if (filter->filter_info.dst_port_mask == 1) 
		imir |= E1000_IMIR_PORT_BP;
	else
		imir &= ~E1000_IMIR_PORT_BP;
	imir |= filter->filter_info.priority << E1000_IMIR_PRIORITY_SHIFT;
	ttqf |= E1000_TTQF_QUEUE_ENABLE;
	ttqf |= (uint32_t)(filter->queue << E1000_TTQF_QUEUE_SHIFT);
	ttqf |= (uint32_t)(filter->filter_info.proto &
						E1000_TTQF_PROTOCOL_MASK);
	if (filter->filter_info.proto_mask == 0)
		ttqf &= ~E1000_TTQF_MASK_ENABLE;
	if (filter->filter_info.tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK) {
		if (filter->filter_info.tcp_flags & RTE_TCP_URG_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_URG;
		if (filter->filter_info.tcp_flags & RTE_TCP_ACK_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_ACK;
		if (filter->filter_info.tcp_flags & RTE_TCP_PSH_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_PSH;
		if (filter->filter_info.tcp_flags & RTE_TCP_RST_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_RST;
		if (filter->filter_info.tcp_flags & RTE_TCP_SYN_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_SYN;
		if (filter->filter_info.tcp_flags & RTE_TCP_FIN_FLAG)
			imir_ext |= E1000_IMIREXT_CTRL_FIN;
	} else {
		imir_ext |= E1000_IMIREXT_CTRL_BP;
	}
	E1000_WRITE_REG(hw, E1000_IMIR(i), imir);
	E1000_WRITE_REG(hw, E1000_TTQF(i), ttqf);
	E1000_WRITE_REG(hw, E1000_IMIREXT(i), imir_ext);
}
static inline void igb_inject_2uple_filter ( struct rte_eth_dev * dev , struct e1000_2tuple_filter * filter ) { struct e1000_hw * hw = E1000_DEV_PRIVATE_TO_HW ( dev -> data -> dev_private ) ; uint32_t ttqf = E1000_TTQF_DISABLE_MASK ; uint32_t imir , imir_ext = E1000_IMIREXT_SIZE_BP ; int i ; i = filter -> index ; imir = ( uint32_t ) ( filter -> filter_info . dst_port & E1000_IMIR_DSTPORT ) ; if ( filter -> filter_info . dst_port_mask == 1 ) imir |= E1000_IMIR_PORT_BP ; else imir &= ~ E1000_IMIR_PORT_BP ; imir |= filter -> filter_info . priority << E1000_IMIR_PRIORITY_SHIFT ; ttqf |= E1000_TTQF_QUEUE_ENABLE ; ttqf |= ( uint32_t ) ( filter -> queue << E1000_TTQF_QUEUE_SHIFT ) ; ttqf |= ( uint32_t ) ( filter -> filter_info . proto & E1000_TTQF_PROTOCOL_MASK ) ; if ( filter -> filter_info . proto_mask == 0 ) ttqf &= ~ E1000_TTQF_MASK_ENABLE ; if ( filter -> filter_info . tcp_flags & RTE_NTUPLE_TCP_FLAGS_MASK ) { if ( filter -> filter_info . tcp_flags & RTE_TCP_URG_FLAG ) imir_ext |= E1000_IMIREXT_CTRL_URG ; if ( filter -> filter_info . tcp_flags & RTE_TCP_ACK_FLAG ) imir_ext |= E1000_IMIREXT_CTRL_ACK ; if ( filter -> filter_info . tcp_flags & RTE_TCP_PSH_FLAG ) imir_ext |= E1000_IMIREXT_CTRL_PSH ; if ( filter -> filter_info . tcp_flags & RTE_TCP_RST_FLAG ) imir_ext |= E1000_IMIREXT_CTRL_RST ; if ( filter -> filter_info . tcp_flags & RTE_TCP_SYN_FLAG ) imir_ext |= E1000_IMIREXT_CTRL_SYN ; if ( filter -> filter_info . tcp_flags & RTE_TCP_FIN_FLAG ) imir_ext |= E1000_IMIREXT_CTRL_FIN ; } else { imir_ext |= E1000_IMIREXT_CTRL_BP ; } E1000_WRITE_REG ( hw , E1000_IMIR ( i ) , imir ) ; E1000_WRITE_REG ( hw , E1000_TTQF ( i ) , ttqf ) ; E1000_WRITE_REG ( hw , E1000_IMIREXT ( i ) , imir_ext ) ; }
inject a igb 2tuple filter to HW
inject a igb 2tuple filter to HW
/* 1b means not compare. */ /* tcp flags bits setting. */