src/dpdk/drivers/common/mlx5/linux/mlx5_nl.c
static int
mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg)
{
	struct mlx5_nl_mac_addr *data = arg;
	struct ndmsg *r = NLMSG_DATA(nh);
	struct rtattr *attribute;
	int len;

	len = nh->nlmsg_len - NLMSG_LENGTH(sizeof(*r));
	for (attribute = MLX5_NDA_RTA(r);
	     RTA_OK(attribute, len);
	     attribute = RTA_NEXT(attribute, len)) {
		if (attribute->rta_type == NDA_LLADDR) {
			if (data->mac_n == MLX5_MAX_MAC_ADDRESSES) {
				DRV_LOG(WARNING,
					"not enough room to finalize the"
					" request");
				rte_errno = ENOMEM;
				return -rte_errno;
			}
#ifdef RTE_LIBRTE_MLX5_DEBUG
			char m[RTE_ETHER_ADDR_FMT_SIZE];

			rte_ether_format_addr(m, RTE_ETHER_ADDR_FMT_SIZE,
					      RTA_DATA(attribute));
			DRV_LOG(DEBUG, "bridge MAC address %s", m);
#endif
			memcpy(&(*data->mac)[data->mac_n++],
			       RTA_DATA(attribute), RTE_ETHER_ADDR_LEN);
		}
	}
	return 0;
}
/**
 * Parse Netlink message to retrieve the bridge MAC address.
 *
 * @param nh
 *   Pointer to Netlink Message Header.
 * @param arg
 *   PMD data register with this callback.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
Parse Netlink message to retrieve the bridge MAC address.
@param nh
Pointer to Netlink Message Header.
@param arg
PMD data register with this callback.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
Parse Netlink message to retrieve the bridge MAC address . @param nh Pointer to Netlink Message Header . @param arg PMD data register with this callback . @return 0 on success a negative errno value otherwise and rte_errno is set .
static int
mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg)
{
	struct mlx5_nl_mac_addr *data = arg;
	struct ndmsg *r = NLMSG_DATA(nh);
	struct rtattr *attribute;
	int len;
	len = nh->nlmsg_len - NLMSG_LENGTH(sizeof(*r));
	for (attribute = MLX5_NDA_RTA(r);
	     RTA_OK(attribute, len);
	     attribute = RTA_NEXT(attribute, len)) {
		if (attribute->rta_type == NDA_LLADDR) {
			if (data->mac_n == MLX5_MAX_MAC_ADDRESSES) {
				DRV_LOG(WARNING,
					"not enough room to finalize the"
					" request");
				rte_errno = ENOMEM;
				return -rte_errno;
			}
#ifdef RTE_LIBRTE_MLX5_DEBUG
			char m[RTE_ETHER_ADDR_FMT_SIZE];
			rte_ether_format_addr(m, RTE_ETHER_ADDR_FMT_SIZE,
					      RTA_DATA(attribute));
			DRV_LOG(DEBUG, "bridge MAC address %s", m);
#endif
			memcpy(&(*data->mac)[data->mac_n++],
			       RTA_DATA(attribute), RTE_ETHER_ADDR_LEN);
		}
	}
	return 0;
}
static int mlx5_nl_mac_addr_cb ( struct nlmsghdr * nh , void * arg ) { struct mlx5_nl_mac_addr * data = arg ; struct ndmsg * r = NLMSG_DATA ( nh ) ; struct rtattr * attribute ; int len ; len = nh -> nlmsg_len - NLMSG_LENGTH ( sizeof ( * r ) ) ; for ( attribute = MLX5_NDA_RTA ( r ) ; RTA_OK ( attribute , len ) ; attribute = RTA_NEXT ( attribute , len ) ) { if ( attribute -> rta_type == NDA_LLADDR ) { if ( data -> mac_n == MLX5_MAX_MAC_ADDRESSES ) { DRV_LOG ( WARNING , " " " " ) ; rte_errno = ENOMEM ; return - rte_errno ; } #ifdef RTE_LIBRTE_MLX5_DEBUG char m [ RTE_ETHER_ADDR_FMT_SIZE ] ; rte_ether_format_addr ( m , RTE_ETHER_ADDR_FMT_SIZE , RTA_DATA ( attribute ) ) ; DRV_LOG ( DEBUG , " " , m ) ; #endif memcpy ( & ( * data -> mac ) [ data -> mac_n ++ ] , RTA_DATA ( attribute ) , RTE_ETHER_ADDR_LEN ) ; } } return 0 ; }
Parse Netlink message to retrieve the bridge MAC address.
Parse Netlink message to retrieve the bridge MAC address .