X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcommon%2Fmlx5%2Flinux%2Fmlx5_nl.c;h=40d86203002783d340fa691fefe5dffbfb642c79;hb=7e7af4e99a9d34e3d8510fe9c57b683ea762cfcc;hp=dc504d81a5e667d17aee626707e3e965cc3d5445;hpb=420bbdae89f29744847a166b831c675ad5affd2a;p=dpdk.git diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index dc504d81a5..40d8620300 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -18,10 +18,10 @@ #include #include -#include #include "mlx5_nl.h" #include "mlx5_common_utils.h" +#include "mlx5_malloc.h" #ifdef HAVE_DEVLINK #include #endif @@ -168,10 +168,10 @@ struct mlx5_nl_ifindex_data { uint32_t portnum; /**< IB device max port number (out). */ }; -rte_atomic32_t atomic_sn = RTE_ATOMIC32_INIT(0); +uint32_t atomic_sn; /* Generate Netlink sequence number. */ -#define MLX5_NL_SN_GENERATE ((uint32_t)rte_atomic32_add_return(&atomic_sn, 1)) +#define MLX5_NL_SN_GENERATE __atomic_add_fetch(&atomic_sn, 1, __ATOMIC_RELAXED) /** * Opens a Netlink socket. @@ -330,7 +330,7 @@ mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg), void *arg) { struct sockaddr_nl sa; - void *buf = malloc(MLX5_RECV_BUF_SIZE); + void *buf = mlx5_malloc(0, MLX5_RECV_BUF_SIZE, 0, SOCKET_ID_ANY); struct iovec iov = { .iov_base = buf, .iov_len = MLX5_RECV_BUF_SIZE, @@ -393,7 +393,7 @@ mlx5_nl_recv(int nlsk_fd, uint32_t sn, int (*cb)(struct nlmsghdr *, void *arg), } } while (multipart); exit: - free(buf); + mlx5_free(buf); return ret; } @@ -789,7 +789,7 @@ mlx5_nl_mac_addr_flush(int nlsk_fd, unsigned int iface_idx, { int i; - if (n <= 0 || n >= MLX5_MAX_MAC_ADDRESSES) + if (n <= 0 || n > MLX5_MAX_MAC_ADDRESSES) return; for (i = n - 1; i >= 0; --i) {