[v4,2/2] ethdev: document default and non-default MAC address

Message ID 20220601063949.43202-3-humin29@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: fix MAC addrs list |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build fail github build: failed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

humin (Q) June 1, 2022, 6:39 a.m. UTC
  From: Huisong Li <lihuisong@huawei.com>

The rte_eth_dev_data::mac_addrs is a MAC address array. The index zero of
this array is as the default address index, and other indexes can't be the
same as the address corresponding to index 0. If we break it, may cause
following problems:
1) waste of MAC address spaces.
2) a fake MAC address in the MAC list, isn't in hardware MAC entries.
3) a MAC address is assigned to diffent pool.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu <humin29@huawei.com>
---
 lib/ethdev/ethdev_driver.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Andrew Rybchenko June 1, 2022, 5:49 p.m. UTC | #1
On 6/1/22 09:39, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> The rte_eth_dev_data::mac_addrs is a MAC address array. The index zero of
> this array is as the default address index, and other indexes can't be the
> same as the address corresponding to index 0. If we break it, may cause
> following problems:
> 1) waste of MAC address spaces.
> 2) a fake MAC address in the MAC list, isn't in hardware MAC entries.
> 3) a MAC address is assigned to diffent pool.
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Min Hu <humin29@huawei.com>
> ---
>   lib/ethdev/ethdev_driver.h | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index 69d9dc21d8..d49e9138c6 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -115,7 +115,12 @@ struct rte_eth_dev_data {
>   
>   	uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */
>   
> -	/** Device Ethernet link address. @see rte_eth_dev_release_port() */
> +	/**
> +	 * Device Ethernet link address. The index zero of the array is as the
> +	 * index of the default address, and other indexes can't be the same
> +	 * as the address corresponding to index 0.
> +	 * @see rte_eth_dev_release_port()
> +	 */
>   	struct rte_ether_addr *mac_addrs;
>   	/** Bitmap associating MAC addresses to pools */
>   	uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR];

The patch itself does not make sense since it documents what happens
in the first patch of the series. So, it should be a part of the first
patch.
  

Patch

diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 69d9dc21d8..d49e9138c6 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -115,7 +115,12 @@  struct rte_eth_dev_data {
 
 	uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */
 
-	/** Device Ethernet link address. @see rte_eth_dev_release_port() */
+	/**
+	 * Device Ethernet link address. The index zero of the array is as the
+	 * index of the default address, and other indexes can't be the same
+	 * as the address corresponding to index 0.
+	 * @see rte_eth_dev_release_port()
+	 */
 	struct rte_ether_addr *mac_addrs;
 	/** Bitmap associating MAC addresses to pools */
 	uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR];