src/dpdk/drivers/common/mlx5/linux/mlx5_nl.c
static int
mlx5_nl_roce_cb(struct nlmsghdr *nh, void *arg)
{

	int ret = -EINVAL;
	int *enable = arg;
	struct nlattr *tail = RTE_PTR_ADD(nh, nh->nlmsg_len);
	struct nlattr *nla = RTE_PTR_ADD(nh, NLMSG_ALIGN(sizeof(*nh)) +
					NLMSG_ALIGN(sizeof(struct genlmsghdr)));

	while (nla->nla_len && nla < tail) {
		switch (nla->nla_type) {
		/* Expected nested attributes case. */
		case DEVLINK_ATTR_PARAM:
		case DEVLINK_ATTR_PARAM_VALUES_LIST:
		case DEVLINK_ATTR_PARAM_VALUE:
			ret = 0;
			nla += 1;
			break;
		case DEVLINK_ATTR_PARAM_VALUE_DATA:
			*enable = 1;
			return 0;
		default:
			nla = RTE_PTR_ADD(nla, NLMSG_ALIGN(nla->nla_len));
		}
	}
	*enable = 0;
	return ret;
}
/**
 * Parse Netlink message to retrieve the ROCE enable status.
 *
 * @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 ROCE enable status.
@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 ROCE enable status . @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_roce_cb(struct nlmsghdr *nh, void *arg)
{
	int ret = -EINVAL;
	int *enable = arg;
	struct nlattr *tail = RTE_PTR_ADD(nh, nh->nlmsg_len);
	struct nlattr *nla = RTE_PTR_ADD(nh, NLMSG_ALIGN(sizeof(*nh)) +
					NLMSG_ALIGN(sizeof(struct genlmsghdr)));
	while (nla->nla_len && nla < tail) {
		switch (nla->nla_type) {
		case DEVLINK_ATTR_PARAM:
		case DEVLINK_ATTR_PARAM_VALUES_LIST:
		case DEVLINK_ATTR_PARAM_VALUE:
			ret = 0;
			nla += 1;
			break;
		case DEVLINK_ATTR_PARAM_VALUE_DATA:
			*enable = 1;
			return 0;
		default:
			nla = RTE_PTR_ADD(nla, NLMSG_ALIGN(nla->nla_len));
		}
	}
	*enable = 0;
	return ret;
}
static int mlx5_nl_roce_cb ( struct nlmsghdr * nh , void * arg ) { int ret = - EINVAL ; int * enable = arg ; struct nlattr * tail = RTE_PTR_ADD ( nh , nh -> nlmsg_len ) ; struct nlattr * nla = RTE_PTR_ADD ( nh , NLMSG_ALIGN ( sizeof ( * nh ) ) + NLMSG_ALIGN ( sizeof ( struct genlmsghdr ) ) ) ; while ( nla -> nla_len && nla < tail ) { switch ( nla -> nla_type ) { case DEVLINK_ATTR_PARAM : case DEVLINK_ATTR_PARAM_VALUES_LIST : case DEVLINK_ATTR_PARAM_VALUE : ret = 0 ; nla += 1 ; break ; case DEVLINK_ATTR_PARAM_VALUE_DATA : * enable = 1 ; return 0 ; default : nla = RTE_PTR_ADD ( nla , NLMSG_ALIGN ( nla -> nla_len ) ) ; } } * enable = 0 ; return ret ; }
Parse Netlink message to retrieve the ROCE enable status.
Parse Netlink message to retrieve the ROCE enable status .
/* Expected nested attributes case. */