当前位置: 首页>>代码示例>>C++>>正文


C++ en_err函数代码示例

本文整理汇总了C++中en_err函数的典型用法代码示例。如果您正苦于以下问题:C++ en_err函数的具体用法?C++ en_err怎么用?C++ en_err使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了en_err函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mlx4_en_validate_rate_ctl_req

/* Check whether the requested rate is valid.
 * If so, retrieve the relevant rate index. */
static int mlx4_en_validate_rate_ctl_req(struct mlx4_en_priv *priv,
					 struct ifreq_hwtxring *rl_req, u8 *rate_index)
{
	int i;
	u32 rate;

	/* Kernel passes rate in bytes and the driver converts it to bits in order
	 * to communicate with the hardware. */
	rl_req->txringid_max_rate = rl_req->txringid_max_rate * BITS_PER_BYTE;
	rate = rl_req->txringid_max_rate;

	if (rate > priv->mdev->dev->caps.rl_caps.calc_max_val ||
	    (rate < priv->mdev->dev->caps.rl_caps.calc_min_val &&
	     rate != 0)) {
		en_err(priv, "Not valid rate limit : %u Bps %d\n",rate / BITS_PER_BYTE, priv->port);
		return (EINVAL);
	}

	/* Searching for the requested rate in the rate table */
	for (i = 0; i <= priv->num_rates_per_prio; i++) {
		if (priv->rate_limits[i].rate == rate) {
			*rate_index = i;
			return (0);
		}
	}

	en_err(priv, "Not existing rate limit %u Bps %d\n",rate / BITS_PER_BYTE, priv->port);
	return (EINVAL);
}
开发者ID:ldesiqueira,项目名称:freebsd_mlx5en,代码行数:31,代码来源:en_tx.c

示例2: mlx4_en_ets_validate

static int mlx4_en_ets_validate(struct mlx4_en_priv *priv, struct ieee_ets *ets)
{
	int i;
	int total_ets_bw = 0;
	int has_ets_tc = 0;

	for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
		if (ets->prio_tc[i] > MLX4_EN_NUM_UP) {
			en_err(priv, "Bad priority in UP <=> TC mapping. TC: %d, UP: %d\n",
					i, ets->prio_tc[i]);
			return -EINVAL;
		}

		switch (ets->tc_tsa[i]) {
		case IEEE_8021QAZ_TSA_STRICT:
			break;
		case IEEE_8021QAZ_TSA_ETS:
			has_ets_tc = 1;
			total_ets_bw += ets->tc_tx_bw[i];
			break;
		default:
			en_err(priv, "TC[%d]: Not supported TSA: %d\n",
					i, ets->tc_tsa[i]);
			return -ENOTSUPP;
		}
	}

	if (has_ets_tc && total_ets_bw != MLX4_EN_BW_MAX) {
		en_err(priv, "Bad ETS BW sum: %d. Should be exactly 100%%\n",
				total_ets_bw);
		return -EINVAL;
	}

	return 0;
}
开发者ID:3null,项目名称:fastsocket,代码行数:35,代码来源:en_dcb_nl.c

示例3: mlx4_en_create_rate_limit_ring

int mlx4_en_create_rate_limit_ring(struct mlx4_en_priv *priv,
				   struct ifreq_hwtxring *rl_req)
{
	int	err = 0;
	int	index = 0;
	u8	rate_index;

	/* Check for HW/FW support */
	if (!priv->mdev->dev->caps.rl_caps.enable) {
		en_err(priv, "No HW/FW support for rate limit rings\n");
		return (ENODEV);
	}

	/* Validate rate limit request */
	if(mlx4_en_validate_rate_ctl_req(priv, rl_req, &rate_index))
		return (EINVAL);

	/* Find available ring index */
	index = mlx4_en_find_available_tx_ring_index(priv);

	if (index < 0) {
		en_err(priv, "Failed to create Rate limit resources, "
					"Max capacity reached\n");
		return (EINVAL);
	}

	atomic_add_int(&priv->rate_limits[rate_index].ref, 1);
	rl_req->txringid = index;

	/* Defer ring creation */
	err = mlx4_en_defer_rl_op(priv, rl_req->txringid, rate_index, MLX4_EN_RL_ADD);

	return err;
}
开发者ID:ldesiqueira,项目名称:freebsd_mlx5en,代码行数:34,代码来源:en_tx.c

示例4: mlx4_en_test_loopback

static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
{
	u32 loopback_ok = 0;
	int i;


        priv->loopback_ok = 0;
	priv->validate_loopback = 1;

	/* xmit */
	if (mlx4_en_test_loopback_xmit(priv)) {
		en_err(priv, "Transmitting loopback packet failed\n");
		goto mlx4_en_test_loopback_exit;
	}

	/* polling for result */
	for (i = 0; i < MLX4_EN_LOOPBACK_RETRIES; ++i) {
		msleep(MLX4_EN_LOOPBACK_TIMEOUT);
		if (priv->loopback_ok) {
			loopback_ok = 1;
			break;
		}
	}
	if (!loopback_ok)
		en_err(priv, "Loopback packet didn't arrive\n");

mlx4_en_test_loopback_exit:

	priv->validate_loopback = 0;
	return !loopback_ok;
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:31,代码来源:en_selftest.c

示例5: mlx4_en_modify_rl_res

static void mlx4_en_modify_rl_res(struct mlx4_en_priv *priv,
			   int ring_id, u8 rate_index)
{
	struct mlx4_en_tx_ring *tx_ring;
	struct mlx4_update_qp_params update_params;
	int err;

	tx_ring = priv->tx_ring[ring_id];

	/* Ring validation */
	if(!TX_RING_USER_VALID(ring_id)) {
		en_err(priv, "Failed modifying new rate, ring %d doesn't exist\n", ring_id);
		/* If the modified ring does not exist, no need to add one
		 * to the reference count of the requested rate */
		atomic_subtract_int(&priv->rate_limits[rate_index].ref, 1);
		return;
	}

	if (priv->rate_limits[tx_ring->rl_data.rate_index].rate !=
				priv->rate_limits[rate_index].rate) {
		update_params.rl_index = rate_index;
		err = mlx4_update_qp(priv->mdev->dev, tx_ring->qpn, MLX4_UPDATE_QP_RATE_LIMIT,
				     &update_params);
		if (err) {
			en_err(priv, "Failed updating ring %d with new rate %uBytes/sec, err: %d\n",
			       ring_id, (priv->rate_limits[rate_index].rate/8), err);
			atomic_subtract_int(&priv->rate_limits[rate_index].ref, 1);
			return;
		}
	}
	atomic_subtract_int(&priv->rate_limits[tx_ring->rl_data.rate_index].ref, 1);
	tx_ring->rl_data.rate_index = rate_index;
}
开发者ID:ldesiqueira,项目名称:freebsd_mlx5en,代码行数:33,代码来源:en_tx.c

示例6: mlx4_en_dcbnl_ieee_setpfc

static int mlx4_en_dcbnl_ieee_setpfc(struct net_device *dev,
		struct ieee_pfc *pfc)
{
	struct mlx4_en_priv *priv = netdev_priv(dev);
	struct mlx4_en_dev *mdev = priv->mdev;
	int err;

	en_dbg(DRV, priv, "cap: 0x%x en: 0x%x mbc: 0x%x delay: %d\n",
			pfc->pfc_cap,
			pfc->pfc_en,
			pfc->mbc,
			pfc->delay);

	priv->prof->rx_pause = priv->prof->tx_pause = !!pfc->pfc_en;
	priv->prof->rx_ppp = priv->prof->tx_ppp = pfc->pfc_en;

	err = mlx4_SET_PORT_general(mdev->dev, priv->port,
				    priv->rx_skb_size + ETH_FCS_LEN,
				    priv->prof->tx_pause,
				    priv->prof->tx_ppp,
				    priv->prof->rx_pause,
				    priv->prof->rx_ppp);
	if (err)
		en_err(priv, "Failed setting pause params\n");

	return err;
}
开发者ID:3null,项目名称:fastsocket,代码行数:27,代码来源:en_dcb_nl.c

示例7: mlx4_en_test_loopback_xmit

static int mlx4_en_test_loopback_xmit(struct mlx4_en_priv *priv)
{
	struct sk_buff *skb;
	struct ethhdr *ethh;
	unsigned char *packet;
	unsigned int packet_size = MLX4_LOOPBACK_TEST_PAYLOAD;
	unsigned int i;
	int err;


	/* build the pkt before xmit */
	skb = netdev_alloc_skb(priv->dev, MLX4_LOOPBACK_TEST_PAYLOAD + ETH_HLEN + NET_IP_ALIGN);
	if (!skb) {
		en_err(priv, "-LOOPBACK_TEST_XMIT- failed to create skb for xmit\n");
		return -ENOMEM;
	}
	skb_reserve(skb, NET_IP_ALIGN);

	ethh = (struct ethhdr *)skb_put(skb, sizeof(struct ethhdr));
	packet	= (unsigned char *)skb_put(skb, packet_size);
	memcpy(ethh->h_dest, priv->dev->dev_addr, ETH_ALEN);
	memset(ethh->h_source, 0, ETH_ALEN);
	ethh->h_proto = htons(ETH_P_ARP);
	skb_set_mac_header(skb, 0);
	for (i = 0; i < packet_size; ++i)	/* fill our packet */
		packet[i] = (unsigned char)(i & 0xff);

	/* xmit the pkt */
	err = mlx4_en_xmit(skb, priv->dev);
	return err;
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:31,代码来源:en_selftest.c

示例8: mlx4_en_create_cq

int mlx4_en_create_cq(struct mlx4_en_priv *priv,
		      struct mlx4_en_cq **pcq,
		      int entries, int ring, enum cq_type mode,
		      int node)
{
	struct mlx4_en_dev *mdev = priv->mdev;
	struct mlx4_en_cq *cq;
	int err;

	cq = kzalloc_node(sizeof(struct mlx4_en_cq), GFP_KERNEL, node);
	if (!cq) {
		cq = kzalloc(sizeof(struct mlx4_en_cq), GFP_KERNEL);
		if (!cq) {
			en_err(priv, "Failed to allocate CW struture\n");
			return -ENOMEM;
		}
	}

	cq->size = entries;
	cq->buf_size = cq->size * mdev->dev->caps.cqe_size;

	cq->tq = taskqueue_create_fast("mlx4_en_que", M_NOWAIT,
                        taskqueue_thread_enqueue, &cq->tq);
        if (mode == RX) {
		TASK_INIT(&cq->cq_task, 0, mlx4_en_rx_que, cq);
		taskqueue_start_threads(&cq->tq, 1, PI_NET, "%s rx cq",
				if_name(priv->dev));

	} else {
		TASK_INIT(&cq->cq_task, 0, mlx4_en_tx_que, cq);
		taskqueue_start_threads(&cq->tq, 1, PI_NET, "%s tx cq",
				if_name(priv->dev));
	}

	cq->ring = ring;
	cq->is_tx = mode;
	spin_lock_init(&cq->lock);

	err = mlx4_alloc_hwq_res(mdev->dev, &cq->wqres,
				cq->buf_size, 2 * PAGE_SIZE);
	if (err)
		goto err_cq;

	err = mlx4_en_map_buffer(&cq->wqres.buf);
	if (err)
		goto err_res;

	cq->buf = (struct mlx4_cqe *) cq->wqres.buf.direct.buf;
	*pcq = cq;

	return 0;

err_res:
	mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size);
err_cq:
	kfree(cq);
	return err;
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:58,代码来源:en_cq.c

示例9: mlx4_en_timestamp_config

int mlx4_en_timestamp_config(struct net_device *dev, int tx_type, int rx_filter)
{
    struct mlx4_en_priv *priv = netdev_priv(dev);
    struct mlx4_en_dev *mdev = priv->mdev;
    int port_up = 0;
    int err = 0;

    mutex_lock(&mdev->state_lock);
    if (priv->port_up) {
        port_up = 1;
        mlx4_en_stop_port(dev, 1);
    }

    mlx4_en_free_resources(priv);

    en_warn(priv, "Changing Time Stamp configuration\n");

    priv->hwtstamp_config.tx_type = tx_type;
    priv->hwtstamp_config.rx_filter = rx_filter;

    if (rx_filter != HWTSTAMP_FILTER_NONE)
        dev->features &= ~NETIF_F_HW_VLAN_RX;
    else
        dev->features |= NETIF_F_HW_VLAN_RX;

    err = mlx4_en_alloc_resources(priv);
    if (err) {
        en_err(priv, "Failed reallocating port resources\n");
        goto out;
    }
    if (port_up) {
        err = mlx4_en_start_port(dev);
        if (err)
            en_err(priv, "Failed starting port\n");
    }

out:
    mutex_unlock(&mdev->state_lock);
    netdev_features_change(dev);
    return err;
}
开发者ID:yangliang913,项目名称:fastsocket,代码行数:41,代码来源:en_clock.c

示例10: mlx4_en_test_loopback

static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
{
	uint32_t loopback_ok = 0;
	int i;
	bool gro_enabled;

        priv->loopback_ok = 0;
	priv->validate_loopback = 1;
	gro_enabled = priv->dev->feat & NETIF_F_GRO;

	mlx4_en_update_loopback_state(priv->dev, priv->dev->feat);
	priv->dev->feat &= ~NETIF_F_GRO;

	/* xmit */
	if (mlx4_en_test_loopback_xmit(priv)) {
		en_err(priv, "Transmitting loopback packet failed\n");
		goto mlx4_en_test_loopback_exit;
	}

	/* polling for result */
	for (i = 0; i < MLX4_EN_LOOPBACK_RETRIES; ++i) {
		kthread_usleep(1000 * MLX4_EN_LOOPBACK_TIMEOUT);
		if (priv->loopback_ok) {
			loopback_ok = 1;
			break;
		}
	}
	if (!loopback_ok)
		en_err(priv, "Loopback packet didn't arrive\n");

mlx4_en_test_loopback_exit:

	priv->validate_loopback = 0;

	if (gro_enabled)
		priv->dev->feat |= NETIF_F_GRO;

	mlx4_en_update_loopback_state(priv->dev, priv->dev->feat);
	return !loopback_ok;
}
开发者ID:anandab,项目名称:akaros,代码行数:40,代码来源:en_selftest.c

示例11: mlx4_en_create_cq

int mlx4_en_create_cq(struct mlx4_en_priv *priv,
		      struct mlx4_en_cq *cq,
		      int entries, int ring, enum cq_type mode)
{
	struct mlx4_en_dev *mdev = priv->mdev;
	int err;

	cq->size = entries;
	if (mode == RX) {
		cq->buf_size = cq->size * sizeof(struct mlx4_cqe);
		cq->vector = (ring + priv->port) %
			mdev->dev->caps.num_comp_vectors;
	} else {
		cq->buf_size = sizeof(struct mlx4_cqe);
		cq->vector = 0;
	}
	cq->ring = ring;
	cq->is_tx = mode;
	if (priv->rx_ring[ring].use_frags)
		cq->process_cq = mlx4_en_process_rx_cq;
	else
		cq->process_cq = mlx4_en_process_rx_cq_skb;
	spin_lock_init(&cq->lock);

	err = mlx4_alloc_hwq_res(mdev->dev, &cq->wqres,
				cq->buf_size, 2 * PAGE_SIZE);
	if (err) {
		en_err(priv, "Failed to allocate CQ buffer\n");
		return err;
	}

	err = mlx4_en_map_buffer(&cq->wqres.buf);
	if (err) {
		en_err(priv, "Failed to map CQ buffer\n");
		mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size);
	} else
		cq->buf = (struct mlx4_cqe *) cq->wqres.buf.direct.buf;

	return err;
}
开发者ID:xf739645524,项目名称:kernel-rhel5,代码行数:40,代码来源:en_cq.c

示例12: mlx4_en_create_cq

int mlx4_en_create_cq(struct mlx4_en_priv *priv,
		      struct mlx4_en_cq **pcq,
		      int entries, int ring, enum cq_type mode,
		      int node)
{
	struct mlx4_en_dev *mdev = priv->mdev;
	struct mlx4_en_cq *cq;
	int err;

	cq = kzalloc_node(sizeof(*cq), GFP_KERNEL, node);
	if (!cq) {
		cq = kzalloc(sizeof(*cq), GFP_KERNEL);
		if (!cq) {
			en_err(priv, "Failed to allocate CQ structure\n");
			return -ENOMEM;
		}
	}

	cq->size = entries;
	cq->buf_size = cq->size * mdev->dev->caps.cqe_size;

	cq->ring = ring;
	cq->is_tx = mode;
	cq->vector = mdev->dev->caps.num_comp_vectors;

	/* Allocate HW buffers on provided NUMA node.
	 * dev->numa_node is used in mtt range allocation flow.
	 */
	set_dev_node(&mdev->dev->persist->pdev->dev, node);
	err = mlx4_alloc_hwq_res(mdev->dev, &cq->wqres,
				cq->buf_size, 2 * PAGE_SIZE);
	set_dev_node(&mdev->dev->persist->pdev->dev, mdev->dev->numa_node);
	if (err)
		goto err_cq;

	err = mlx4_en_map_buffer(&cq->wqres.buf);
	if (err)
		goto err_res;

	cq->buf = (struct mlx4_cqe *)cq->wqres.buf.direct.buf;
	*pcq = cq;

	return 0;

err_res:
	mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size);
err_cq:
	kfree(cq);
	*pcq = NULL;
	return err;
}
开发者ID:ANLAB-KAIST,项目名称:mlnx-en,代码行数:51,代码来源:en_cq.c

示例13: mlx4_en_config_rss_qp

static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
				 struct mlx4_en_rx_ring *ring,
				 enum mlx4_qp_state *state,
				 struct mlx4_qp *qp)
{
	struct mlx4_en_dev *mdev = priv->mdev;
	struct mlx4_qp_context *context;
	int err = 0;

	context = kmalloc(sizeof *context , GFP_KERNEL);
	if (!context) {
		en_err(priv, "Failed to allocate qp context\n");
		return -ENOMEM;
	}

	err = mlx4_qp_alloc(mdev->dev, qpn, qp);
	if (err) {
		en_err(priv, "Failed to allocate qp #%x\n", qpn);
		goto out;
	}
	qp->event = mlx4_en_sqp_event;

	memset(context, 0, sizeof *context);
	mlx4_en_fill_qp_context(priv, ring->actual_size, ring->stride, 0, 0,
				qpn, ring->cqn, context);
	context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma);

	err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, context, qp, state);
	if (err) {
		mlx4_qp_remove(mdev->dev, qp);
		mlx4_qp_free(mdev->dev, qp);
	}
	mlx4_en_update_rx_prod_db(ring);
out:
	kfree(context);
	return err;
}
开发者ID:andi34,项目名称:Dhollmen_Kernel,代码行数:37,代码来源:en_rx.c

示例14: mlx4_en_fill_rx_buffers

static int mlx4_en_fill_rx_buffers(struct mlx4_en_priv *priv)
{
	struct mlx4_en_rx_ring *ring;
	int ring_ind;
	int buf_ind;
	int new_size;
	int err;

	for (buf_ind = 0; buf_ind < priv->prof->rx_ring_size; buf_ind++) {
		for (ring_ind = 0; ring_ind < priv->rx_ring_num; ring_ind++) {
			ring = priv->rx_ring[ring_ind];

			err = mlx4_en_prepare_rx_desc(priv, ring,
						      ring->actual_size);
			if (err) {
				if (ring->actual_size == 0) {
					en_err(priv, "Failed to allocate "
						     "enough rx buffers\n");
					return -ENOMEM;
				} else {
					new_size =
						rounddown_pow_of_two(ring->actual_size);
					en_warn(priv, "Only %d buffers allocated "
						      "reducing ring size to %d\n",
						ring->actual_size, new_size);
					goto reduce_rings;
				}
			}
			ring->actual_size++;
			ring->prod++;
		}
	}
	return 0;

reduce_rings:
	for (ring_ind = 0; ring_ind < priv->rx_ring_num; ring_ind++) {
		ring = priv->rx_ring[ring_ind];
		while (ring->actual_size > new_size) {
			ring->actual_size--;
			ring->prod--;
			mlx4_en_free_buf(ring,
			    ring->mbuf + ring->actual_size);
		}
	}

	return 0;
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:47,代码来源:mlx4_en_rx.c

示例15: mlx4_en_destroy_rl_res

static void mlx4_en_destroy_rl_res(struct mlx4_en_priv *priv,
                                    int ring_id)
{
	struct mlx4_en_tx_ring *ring;
	struct mlx4_en_dev *mdev = priv->mdev;

	ring = priv->tx_ring[ring_id];

	mutex_lock(&mdev->state_lock);

	/* Index was validated, thus ring is not NULL */
	spin_lock(&ring->tx_lock);
	if (ring->rl_data.user_valid == false) {
		en_err(priv, "ring %d doesn't exist\n", ring_id);
		spin_unlock(&ring->tx_lock);
		return;
	} else {
		ring->rl_data.user_valid = false;
	}
	if (!drbr_empty(priv->dev, ring->br)) {
		struct mbuf *m;
		while ((m = buf_ring_dequeue_sc(ring->br)) != NULL) {
			m_freem(m);
		}
	}
	spin_unlock(&ring->tx_lock);
	atomic_subtract_int(&priv->rate_limits[ring->rl_data.rate_index].ref, 1);

	/* Deactivate resources */
	if (priv->port_up) {
		mlx4_en_deactivate_tx_ring(priv, ring);
		mlx4_en_deactivate_cq(priv, priv->tx_cq[ring_id]);
		msleep(10);
		mlx4_en_free_tx_buf(priv->dev, ring);
	}
	mutex_unlock(&mdev->state_lock);

	/* clear statistics */
	ring->bytes = 0;
	ring->packets = 0;

	sysctl_ctx_free(&ring->rl_data.rl_stats_ctx);

	/* Add index to re-use list */
	priv->rate_limit_tx_ring_num--;
	mlx4_en_rl_reused_index_insert(priv, ring_id);
}
开发者ID:ldesiqueira,项目名称:freebsd_mlx5en,代码行数:47,代码来源:en_tx.c


注:本文中的en_err函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。