net/txgbe: support syn filter add and delete
Support add and delete operations on syn filter. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
This commit is contained in:
parent
1a529bffe8
commit
983a4ef226
@ -3511,6 +3511,44 @@ txgbe_set_queue_rate_limit(struct rte_eth_dev *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
txgbe_syn_filter_set(struct rte_eth_dev *dev,
|
||||
struct rte_eth_syn_filter *filter,
|
||||
bool add)
|
||||
{
|
||||
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
|
||||
struct txgbe_filter_info *filter_info = TXGBE_DEV_FILTER(dev);
|
||||
uint32_t syn_info;
|
||||
uint32_t synqf;
|
||||
|
||||
if (filter->queue >= TXGBE_MAX_RX_QUEUE_NUM)
|
||||
return -EINVAL;
|
||||
|
||||
syn_info = filter_info->syn_info;
|
||||
|
||||
if (add) {
|
||||
if (syn_info & TXGBE_SYNCLS_ENA)
|
||||
return -EINVAL;
|
||||
synqf = (uint32_t)TXGBE_SYNCLS_QPID(filter->queue);
|
||||
synqf |= TXGBE_SYNCLS_ENA;
|
||||
|
||||
if (filter->hig_pri)
|
||||
synqf |= TXGBE_SYNCLS_HIPRIO;
|
||||
else
|
||||
synqf &= ~TXGBE_SYNCLS_HIPRIO;
|
||||
} else {
|
||||
synqf = rd32(hw, TXGBE_SYNCLS);
|
||||
if (!(syn_info & TXGBE_SYNCLS_ENA))
|
||||
return -ENOENT;
|
||||
synqf &= ~(TXGBE_SYNCLS_QPID_MASK | TXGBE_SYNCLS_ENA);
|
||||
}
|
||||
|
||||
filter_info->syn_info = synqf;
|
||||
wr32(hw, TXGBE_SYNCLS, synqf);
|
||||
txgbe_flush(hw);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline enum txgbe_5tuple_protocol
|
||||
convert_protocol_type(uint8_t protocol_value)
|
||||
{
|
||||
@ -4445,11 +4483,28 @@ txgbe_ethertype_filter_restore(struct rte_eth_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
/* restore SYN filter */
|
||||
static inline void
|
||||
txgbe_syn_filter_restore(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
|
||||
struct txgbe_filter_info *filter_info = TXGBE_DEV_FILTER(dev);
|
||||
uint32_t synqf;
|
||||
|
||||
synqf = filter_info->syn_info;
|
||||
|
||||
if (synqf & TXGBE_SYNCLS_ENA) {
|
||||
wr32(hw, TXGBE_SYNCLS, synqf);
|
||||
txgbe_flush(hw);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
txgbe_filter_restore(struct rte_eth_dev *dev)
|
||||
{
|
||||
txgbe_ntuple_filter_restore(dev);
|
||||
txgbe_ethertype_filter_restore(dev);
|
||||
txgbe_syn_filter_restore(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -167,6 +167,8 @@ struct txgbe_filter_info {
|
||||
/* Bit mask for every used 5tuple filter */
|
||||
uint32_t fivetuple_mask[TXGBE_5TUPLE_ARRAY_SIZE];
|
||||
struct txgbe_5tuple_filter_list fivetuple_list;
|
||||
/* store the SYN filter info */
|
||||
uint32_t syn_info;
|
||||
};
|
||||
|
||||
/* The configuration of bandwidth */
|
||||
@ -323,6 +325,9 @@ int txgbe_add_del_ntuple_filter(struct rte_eth_dev *dev,
|
||||
int txgbe_add_del_ethertype_filter(struct rte_eth_dev *dev,
|
||||
struct rte_eth_ethertype_filter *filter,
|
||||
bool add);
|
||||
int txgbe_syn_filter_set(struct rte_eth_dev *dev,
|
||||
struct rte_eth_syn_filter *filter,
|
||||
bool add);
|
||||
|
||||
void txgbe_set_ivar_map(struct txgbe_hw *hw, int8_t direction,
|
||||
uint8_t queue, uint8_t msix_vector);
|
||||
|
Loading…
x
Reference in New Issue
Block a user