src/dpdk/drivers/net/e1000/igb_ethdev.c
static inline void
igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
			   struct e1000_5tuple_filter *filter)
{
	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
	uint32_t ftqf = E1000_FTQF_VF_BP | E1000_FTQF_MASK;
	uint32_t spqf, imir, imir_ext = E1000_IMIREXT_SIZE_BP;
	uint8_t i;

	i = filter->index;
	ftqf |= filter->filter_info.proto & E1000_FTQF_PROTOCOL_MASK;
	if (filter->filter_info.src_ip_mask == 0) /* 0b means compare. */
		ftqf &= ~E1000_FTQF_MASK_SOURCE_ADDR_BP;
	if (filter->filter_info.dst_ip_mask == 0)
		ftqf &= ~E1000_FTQF_MASK_DEST_ADDR_BP;
	if (filter->filter_info.src_port_mask == 0)
		ftqf &= ~E1000_FTQF_MASK_SOURCE_PORT_BP;
	if (filter->filter_info.proto_mask == 0)
		ftqf &= ~E1000_FTQF_MASK_PROTO_BP;
	ftqf |= (filter->queue << E1000_FTQF_QUEUE_SHIFT) &
		E1000_FTQF_QUEUE_MASK;
	ftqf |= E1000_FTQF_QUEUE_ENABLE;
	E1000_WRITE_REG(hw, E1000_FTQF(i), ftqf);
	E1000_WRITE_REG(hw, E1000_DAQF(i), filter->filter_info.dst_ip);
	E1000_WRITE_REG(hw, E1000_SAQF(i), filter->filter_info.src_ip);

	spqf = filter->filter_info.src_port & E1000_SPQF_SRCPORT;
	E1000_WRITE_REG(hw, E1000_SPQF(i), spqf);

	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;

	/* 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_IMIREXT(i), imir_ext);
}
/* inject a igb 5-tuple filter to HW */
inject a igb 5-tuple filter to HW
inject a igb 5 - tuple filter to HW
static inline void
igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev,
			   struct e1000_5tuple_filter *filter)
{
	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
	uint32_t ftqf = E1000_FTQF_VF_BP | E1000_FTQF_MASK;
	uint32_t spqf, imir, imir_ext = E1000_IMIREXT_SIZE_BP;
	uint8_t i;
	i = filter->index;
	ftqf |= filter->filter_info.proto & E1000_FTQF_PROTOCOL_MASK;
	if (filter->filter_info.src_ip_mask == 0) 
		ftqf &= ~E1000_FTQF_MASK_SOURCE_ADDR_BP;
	if (filter->filter_info.dst_ip_mask == 0)
		ftqf &= ~E1000_FTQF_MASK_DEST_ADDR_BP;
	if (filter->filter_info.src_port_mask == 0)
		ftqf &= ~E1000_FTQF_MASK_SOURCE_PORT_BP;
	if (filter->filter_info.proto_mask == 0)
		ftqf &= ~E1000_FTQF_MASK_PROTO_BP;
	ftqf |= (filter->queue << E1000_FTQF_QUEUE_SHIFT) &
		E1000_FTQF_QUEUE_MASK;
	ftqf |= E1000_FTQF_QUEUE_ENABLE;
	E1000_WRITE_REG(hw, E1000_FTQF(i), ftqf);
	E1000_WRITE_REG(hw, E1000_DAQF(i), filter->filter_info.dst_ip);
	E1000_WRITE_REG(hw, E1000_SAQF(i), filter->filter_info.src_ip);
	spqf = filter->filter_info.src_port & E1000_SPQF_SRCPORT;
	E1000_WRITE_REG(hw, E1000_SPQF(i), spqf);
	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;
	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_IMIREXT(i), imir_ext);
}
static inline void igb_inject_5tuple_filter_82576 ( struct rte_eth_dev * dev , struct e1000_5tuple_filter * filter ) { struct e1000_hw * hw = E1000_DEV_PRIVATE_TO_HW ( dev -> data -> dev_private ) ; uint32_t ftqf = E1000_FTQF_VF_BP | E1000_FTQF_MASK ; uint32_t spqf , imir , imir_ext = E1000_IMIREXT_SIZE_BP ; uint8_t i ; i = filter -> index ; ftqf |= filter -> filter_info . proto & E1000_FTQF_PROTOCOL_MASK ; if ( filter -> filter_info . src_ip_mask == 0 ) ftqf &= ~ E1000_FTQF_MASK_SOURCE_ADDR_BP ; if ( filter -> filter_info . dst_ip_mask == 0 ) ftqf &= ~ E1000_FTQF_MASK_DEST_ADDR_BP ; if ( filter -> filter_info . src_port_mask == 0 ) ftqf &= ~ E1000_FTQF_MASK_SOURCE_PORT_BP ; if ( filter -> filter_info . proto_mask == 0 ) ftqf &= ~ E1000_FTQF_MASK_PROTO_BP ; ftqf |= ( filter -> queue << E1000_FTQF_QUEUE_SHIFT ) & E1000_FTQF_QUEUE_MASK ; ftqf |= E1000_FTQF_QUEUE_ENABLE ; E1000_WRITE_REG ( hw , E1000_FTQF ( i ) , ftqf ) ; E1000_WRITE_REG ( hw , E1000_DAQF ( i ) , filter -> filter_info . dst_ip ) ; E1000_WRITE_REG ( hw , E1000_SAQF ( i ) , filter -> filter_info . src_ip ) ; spqf = filter -> filter_info . src_port & E1000_SPQF_SRCPORT ; E1000_WRITE_REG ( hw , E1000_SPQF ( i ) , spqf ) ; 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 ; 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_IMIREXT ( i ) , imir_ext ) ; }
inject a igb 5-tuple filter to HW
inject a igb 5 - tuple filter to HW
/* 0b means compare. */ /* 1b means not compare. */ /* tcp flags bits setting. */