]> git.droids-corp.org - dpdk.git/commitdiff
net/bonding: remove socket id check
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 21 Jun 2017 05:07:32 +0000 (06:07 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 22 Jun 2017 15:46:09 +0000 (17:46 +0200)
Socket id parsed from the user was checked
if it was in the range of available sockets.
This check is unnecessary, as the socket specified
might not have memory anyway, so it will fail
at memory allocation.

Therefore, the best solution is to remove this check.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
drivers/net/bonding/rte_eth_bond_api.c
drivers/net/bonding/rte_eth_bond_args.c
drivers/net/bonding/rte_eth_bond_pmd.c
drivers/net/bonding/rte_eth_bond_private.h

index 164eb593da67a3d0b105eb83f2d260af5eb66959..55d71d92a85ab75697aea416389d48220e860be1 100644 (file)
@@ -143,22 +143,6 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
        }
 }
 
-uint8_t
-number_of_sockets(void)
-{
-       int sockets = 0;
-       int i;
-       const struct rte_memseg *ms = rte_eal_get_physmem_layout();
-
-       for (i = 0; ((i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL)); i++) {
-               if (sockets < ms[i].socket_id)
-                       sockets = ms[i].socket_id;
-       }
-
-       /* Number of sockets = maximum socket_id + 1 */
-       return ++sockets;
-}
-
 int
 rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
 {
index dc468d2a0e425ef95388f3e0f7d806051d8b3dda..c718e6145f129ab216ab641c76e4606877ff40b4 100644 (file)
@@ -204,8 +204,8 @@ bond_ethdev_parse_socket_id_kvarg(const char *key __rte_unused,
        if (*endptr != 0 || errno != 0)
                return -1;
 
-       /* validate mode value */
-       if (socket_id >= 0 && socket_id < number_of_sockets()) {
+       /* validate socket id value */
+       if (socket_id >= 0) {
                *(uint8_t *)extra_args = (uint8_t)socket_id;
                return 0;
        }
index 37f3d43bc40ded67691db0e10c0a65dd122b16a8..a8d9780273c1ab6672572f8ca60b4acb6d8f8015 100644 (file)
@@ -2272,12 +2272,6 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode)
         * and internal (private) data
         */
 
-       if (socket_id >= number_of_sockets()) {
-               RTE_BOND_LOG(ERR,
-                               "Invalid socket id specified to create bonded device on.");
-               goto err;
-       }
-
        /* reserve an ethdev entry */
        eth_dev = rte_eth_vdev_allocate(dev, sizeof(*internals));
        if (eth_dev == NULL) {
index 71067da627f49986217c06b03c707bc61aca6b5c..50d908d51958a2a96b98290ecf1b7999ee5deb32 100644 (file)
@@ -232,9 +232,6 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr);
 int
 mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev);
 
-uint8_t
-number_of_sockets(void);
-
 int
 bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, int mode);