Skip to content

Commit

Permalink
net/bonding: switch to new offloading API
Browse files Browse the repository at this point in the history
Switch to new ethdev offloading API.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
  • Loading branch information
Ferruh Yigit committed Apr 13, 2018
1 parent 85d3c09 commit e8b3e1a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
9 changes: 8 additions & 1 deletion drivers/net/bonding/rte_eth_bond_api.c
Expand Up @@ -194,7 +194,8 @@ slave_vlan_filter_set(uint16_t bonded_port_id, uint16_t slave_port_id)
uint16_t first;

bonded_eth_dev = &rte_eth_devices[bonded_port_id];
if (bonded_eth_dev->data->dev_conf.rxmode.hw_vlan_filter == 0)
if ((bonded_eth_dev->data->dev_conf.rxmode.offloads &
DEV_RX_OFFLOAD_VLAN_FILTER) == 0)
return 0;

internals = bonded_eth_dev->data->dev_private;
Expand Down Expand Up @@ -287,6 +288,8 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
/* Take the first dev's offload capabilities */
internals->rx_offload_capa = dev_info.rx_offload_capa;
internals->tx_offload_capa = dev_info.tx_offload_capa;
internals->rx_queue_offload_capa = dev_info.rx_queue_offload_capa;
internals->tx_queue_offload_capa = dev_info.tx_queue_offload_capa;
internals->flow_type_rss_offloads = dev_info.flow_type_rss_offloads;

/* Inherit first slave's max rx packet size */
Expand All @@ -295,6 +298,8 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
} else {
internals->rx_offload_capa &= dev_info.rx_offload_capa;
internals->tx_offload_capa &= dev_info.tx_offload_capa;
internals->rx_queue_offload_capa &= dev_info.rx_queue_offload_capa;
internals->tx_queue_offload_capa &= dev_info.tx_queue_offload_capa;
internals->flow_type_rss_offloads &= dev_info.flow_type_rss_offloads;

if (link_properties_valid(bonded_eth_dev,
Expand Down Expand Up @@ -461,6 +466,8 @@ __eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
if (internals->slave_count == 0) {
internals->rx_offload_capa = 0;
internals->tx_offload_capa = 0;
internals->rx_queue_offload_capa = 0;
internals->tx_queue_offload_capa = 0;
internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK;
internals->reta_size = 0;
internals->candidate_max_rx_pktlen = 0;
Expand Down
13 changes: 11 additions & 2 deletions drivers/net/bonding/rte_eth_bond_pmd.c
Expand Up @@ -1819,8 +1819,13 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
bonded_eth_dev->data->dev_conf.rxmode.mq_mode;
}

slave_eth_dev->data->dev_conf.rxmode.hw_vlan_filter =
bonded_eth_dev->data->dev_conf.rxmode.hw_vlan_filter;
if (bonded_eth_dev->data->dev_conf.rxmode.offloads &
DEV_RX_OFFLOAD_VLAN_FILTER)
slave_eth_dev->data->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_VLAN_FILTER;
else
slave_eth_dev->data->dev_conf.rxmode.offloads &=
~DEV_RX_OFFLOAD_VLAN_FILTER;

nb_rx_queues = bonded_eth_dev->data->nb_rx_queues;
nb_tx_queues = bonded_eth_dev->data->nb_tx_queues;
Expand Down Expand Up @@ -2258,6 +2263,8 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)

dev_info->rx_offload_capa = internals->rx_offload_capa;
dev_info->tx_offload_capa = internals->tx_offload_capa;
dev_info->rx_queue_offload_capa = internals->rx_queue_offload_capa;
dev_info->tx_queue_offload_capa = internals->tx_queue_offload_capa;
dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads;

dev_info->reta_size = internals->reta_size;
Expand Down Expand Up @@ -2950,6 +2957,8 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode)
internals->active_slave_count = 0;
internals->rx_offload_capa = 0;
internals->tx_offload_capa = 0;
internals->rx_queue_offload_capa = 0;
internals->tx_queue_offload_capa = 0;
internals->candidate_max_rx_pktlen = 0;
internals->max_rx_pktlen = 0;

Expand Down
6 changes: 4 additions & 2 deletions drivers/net/bonding/rte_eth_bond_private.h
Expand Up @@ -128,8 +128,10 @@ struct bond_dev_private {
/**< TLB active slaves send order */
struct mode_alb_private mode6;

uint32_t rx_offload_capa; /** Rx offload capability */
uint32_t tx_offload_capa; /** Tx offload capability */
uint64_t rx_offload_capa; /** Rx offload capability */
uint64_t tx_offload_capa; /** Tx offload capability */
uint64_t rx_queue_offload_capa; /** per queue Rx offload capability */
uint64_t tx_queue_offload_capa; /** per queue Tx offload capability */

/** Bit mask of RSS offloads, the bit offset also means flow type */
uint64_t flow_type_rss_offloads;
Expand Down

0 comments on commit e8b3e1a

Please sign in to comment.