Skip to contentSkip to conversation

net/bonding: switch to new offloading flags

PATCH Superseded Ferruh Yigit 3 participants 9 messages Mar 13, 2018 – Apr 6, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/bonding: switch to new offloading flags

Switch from using deprecated bitfields in rxmode to offloads variable.

---
 drivers/net/bonding/rte_eth_bond_api.c | 3 ++-
 drivers/net/bonding/rte_eth_bond_pmd.c | 9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_api.c +2 -1
index f854b7375..669004fec 100644
@@ -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;
drivers/net/bonding/rte_eth_bond_pmd.c +7 -2
index c34c3251f..c18aca222 100644
@@ -1818,8 +1818,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;
Signature · 1 line
2.13.6
#2 lore raw
In reply to Ferruh Yigit

Hi Ferruh

From: Ferruh Yigit, Sent: Tuesday, March 13, 2018 2:25 PM

Quoted 49 lines

Switch from using deprecated bitfields in rxmode to offloads variable.

---
 drivers/net/bonding/rte_eth_bond_api.c | 3 ++-
drivers/net/bonding/rte_eth_bond_pmd.c | 9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_api.c +2 -1
index f854b7375..669004fec 100644
@@ -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;
 
drivers/net/bonding/rte_eth_bond_api.c +0 -0
 	internals = bonded_eth_dev->data->dev_private;
drivers/net/bonding/rte_eth_bond_pmd.c +7 -2
index c34c3251f..c18aca222 100644
@@ -1818,8 +1818,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;
drivers/net/bonding/rte_eth_bond_pmd.c +0 -1
 	nb_rx_queues = bonded_eth_dev->data->nb_rx_queues;
 	nb_tx_queues = bonded_eth_dev->data->nb_tx_queues;
--
Quoted 1 line

2.13.6

The bonding PMD is using internal variables to save the offload capabilities (Actually holds the offloads intersection set of all the bond slaves). I think you are missing next:

	You should change the next variable types to uint64_t to support the new offload flags:
		internals->rx_offload_capa
		internals->tx_offload_capa

	You should add the new per queue offload variables to save the intersection set of it too:
		rx_queue_offload_capa
		tx_queue_offload_capa

Questions:
Have you an idea why bonding PMD doesn't adjust the slaves port configurations to the bonding port configuration like he does for slave queue configuration? Is the responsibility to fill the slave port configuration structure for the application?

What do you think about next configuration checks (both per port and per queue)?
Validate the actual bonding offloads with the bonding capability. Validate that the queue offloads includes all the port configured offloads.

Matan.

#3 lore raw
Quoted 56 lines · Matan Azrad

Hi Ferruh

From: Ferruh Yigit, Sent: Tuesday, March 13, 2018 2:25 PM

Quoted 49 lines

Switch from using deprecated bitfields in rxmode to offloads variable.

---
 drivers/net/bonding/rte_eth_bond_api.c | 3 ++-
drivers/net/bonding/rte_eth_bond_pmd.c | 9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_api.c +2 -1
index f854b7375..669004fec 100644
@@ -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;
 
drivers/net/bonding/rte_eth_bond_api.c +0 -0
 	internals = bonded_eth_dev->data->dev_private;
drivers/net/bonding/rte_eth_bond_pmd.c +7 -2
index c34c3251f..c18aca222 100644
@@ -1818,8 +1818,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;
drivers/net/bonding/rte_eth_bond_pmd.c +0 -1
 	nb_rx_queues = bonded_eth_dev->data->nb_rx_queues;
 	nb_tx_queues = bonded_eth_dev->data->nb_tx_queues;
--
Quoted 1 line

2.13.6

The bonding PMD is using internal variables to save the offload capabilities (Actually holds the offloads intersection set of all the bond slaves). I think you are missing next:

Quoted 7 lines
	You should change the next variable types to uint64_t to support the new offload flags:
		internals->rx_offload_capa
		internals->tx_offload_capa

	You should add the new per queue offload variables to save the intersection set of it too:
		rx_queue_offload_capa
		tx_queue_offload_capa

Thanks, I will update this v2.

Quoted 11 lines

Questions:
Have you an idea why bonding PMD doesn't adjust the slaves port configurations to the bonding port configuration like he does for slave queue configuration? Is the responsibility to fill the slave port configuration structure for the application?

What do you think about next configuration checks (both per port and per queue)?
Validate the actual bonding offloads with the bonding capability. Validate that the queue offloads includes all the port configured offloads.

Matan.

#6 lore raw

PATCH v2 1/1 net/bonding: switch to new offloading API

In reply to Ferruh Yigit

Switch to new ethdev offloading API.

---
Cc: Radu Nicolau <[email protected]>
Cc: Matan Azrad <[email protected]>

v2:
* added [rt]x_queue_offload_capa to driver internal struct
* increased [rt]x_offload_capa size to 64bit as same as ethdev

---
 drivers/net/bonding/rte_eth_bond_api.c     |  9 ++++++++-
 drivers/net/bonding/rte_eth_bond_pmd.c     | 13 +++++++++++--
 drivers/net/bonding/rte_eth_bond_private.h |  6 ++++--
 3 files changed, 23 insertions(+), 5 deletions(-)
drivers/net/bonding/rte_eth_bond_api.c +8 -1
index f854b7375..6d34f6038 100644
@@ -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;
@@ -284,6 +285,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 */
@@ -292,6 +295,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,
@@ -458,6 +463,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;
drivers/net/bonding/rte_eth_bond_pmd.c +11 -2
index b59ba9f7c..74ad3d297 100644
@@ -1818,8 +1818,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;
@@ -2252,6 +2257,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;
@@ -2944,6 +2951,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;
 
drivers/net/bonding/rte_eth_bond_private.h +4 -2
index 92e15f8cc..94eca8838 100644
@@ -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;
Signature · 1 line
2.13.6
#4 lore raw
In reply to Matan Azrad
Quoted 7 lines · Matan Azrad

Questions:
Have you an idea why bonding PMD doesn't adjust the slaves port configurations to the bonding port configuration like he does for slave queue configuration? Is the responsibility to fill the slave port configuration structure for the application?

What do you think about next configuration checks (both per port and per queue)?
Validate the actual bonding offloads with the bonding capability. Validate that the queue offloads includes all the port configured offloads.

I don't have answers for these, perhaps Declan or Radu can help.

#5 lore raw

Hi Declan, Radu

Please try to answer for the below questions.

From: Ferruh Yigit, Sent: Thursday, March 22, 2018 8:14 PM

Quoted 15 lines · Matan Azrad
Quoted 2 lines

Questions:
Have you an idea why bonding PMD doesn't adjust the slaves port

configurations to the bonding port configuration like it does for slave queue configuration?

Quoted 1 line

Is the responsibility to fill the slave port configuration structure for the

application?

Quoted 2 lines

What do you think about next configuration checks (both per port and per

queue)?

Quoted 2 lines

Validate the actual bonding offloads with the bonding capability. Validate that the queue offloads includes all the port configured

offloads.

I don't have answers for these, perhaps Declan or Radu can help.

Acked-by on v2 1/1
#7 lore raw

Re: [PATCH v2] net/bonding: switch to new offloading API

In reply to Ferruh Yigit
Quoted 12 lines · Ferruh Yigit

Switch to new ethdev offloading API.

---
Cc: Radu Nicolau <[email protected]>
Cc: Matan Azrad <[email protected]>

v2:
* added [rt]x_queue_offload_capa to driver internal struct
* increased [rt]x_offload_capa size to 64bit as same as ethdev
---

author Applied
#8 lore raw

Re: [PATCH v2] net/bonding: switch to new offloading API

Quoted 9 lines · Radu Nicolau
Quoted 7 lines · Ferruh Yigit

Switch to new ethdev offloading API.

---
Cc: Radu Nicolau <[email protected]>
Cc: Matan Azrad <[email protected]>

Quoted 6 lines
Quoted 5 lines

v2:
* added [rt]x_queue_offload_capa to driver internal struct
* increased [rt]x_offload_capa size to 64bit as same as ethdev
---

Applied to dpdk-next-net/master, thanks.