本文整理汇总了C++中en_err函数的典型用法代码示例。如果您正苦于以下问题:C++ en_err函数的具体用法?C++ en_err怎么用?C++ en_err使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了en_err函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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;
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];
if (mlx4_en_prepare_rx_desc(priv, ring,
ring->actual_size,
GFP_KERNEL | __GFP_COLD)) {
if (ring->actual_size < MLX4_EN_MIN_RX_SIZE) {
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_rx_desc(priv, ring, ring->actual_size);
}
}
return 0;
}
开发者ID:namanM003,项目名称:Operating-Systems-CSE-506-,代码行数:42,代码来源:en_rx.c
示例17: mlx4_en_destroy_rate_limit_ring
int mlx4_en_destroy_rate_limit_ring(struct mlx4_en_priv *priv,
struct ifreq_hwtxring *rl_req)
{
uint32_t ring_id;
int err = 0;
ring_id = rl_req->txringid;
/* Check that this is indeed a rate limit ring */
if (ring_id < priv->native_tx_ring_num || ring_id >= priv->tx_ring_num) {
en_err(priv, "Deleting ring %d: Permision denied: Not a rate limit ring\n", ring_id);
return (EINVAL);
}
/* Defer ring destruction */
/* There is no handling with new rate index when destroying a ring
* therefor, sending zero as a rate index. */
err = mlx4_en_defer_rl_op(priv, rl_req->txringid, 0, MLX4_EN_RL_DEL);
return err;
}
开发者ID:ldesiqueira,项目名称:freebsd_mlx5en,代码行数:21,代码来源:en_tx.c
示例18: mlx4_en_defer_rl_op
static int mlx4_en_defer_rl_op(struct mlx4_en_priv *priv,
int ring_id, u8 rate_index,
enum mlx4_en_rl_operation opp)
{
struct mlx4_en_rl_task_list_element *rl_item;
rl_item = kmalloc(sizeof(struct mlx4_en_rl_task_list_element), M_NOWAIT);
if (!rl_item) {
en_err(priv, "Failed allocating rl_item\n");
return (ENOMEM);
}
/* Saving recieved data from kernel in order to use it later in
* the defer function */
rl_item->ring_id = ring_id;
rl_item->rate_index = rate_index;
rl_item->operation = opp;
spin_lock(&priv->rl_op_lock);
STAILQ_INSERT_TAIL(&priv->rl_op_list_head, rl_item, entry);
spin_unlock(&priv->rl_op_lock);
taskqueue_enqueue(priv->rl_tq, &priv->rl_task);
return (0);
}
开发者ID:ldesiqueira,项目名称:freebsd_mlx5en,代码行数:24,代码来源:en_tx.c
示例19: mlx4_en_process_rx_cq
int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int budget)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_cqe *cqe;
struct mlx4_en_rx_ring *ring = &priv->rx_ring[cq->ring];
struct skb_frag_struct *skb_frags;
struct mlx4_en_rx_desc *rx_desc;
struct sk_buff *skb;
int index;
int nr;
unsigned int length;
int polled = 0;
int ip_summed;
if (!priv->port_up)
return 0;
/* We assume a 1:1 mapping between CQEs and Rx descriptors, so Rx
* descriptor offset can be deduced from the CQE index instead of
* reading 'cqe->index' */
index = cq->mcq.cons_index & ring->size_mask;
cqe = &cq->buf[index];
/* Process all completed CQEs */
while (XNOR(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK,
cq->mcq.cons_index & cq->size)) {
skb_frags = ring->rx_info + (index << priv->log_rx_info);
rx_desc = ring->buf + (index << ring->log_stride);
/*
* make sure we read the CQE after we read the ownership bit
*/
rmb();
/* Drop packet on bad receive or bad checksum */
if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) ==
MLX4_CQE_OPCODE_ERROR)) {
en_err(priv, "CQE completed in error - vendor "
"syndrom:%d syndrom:%d\n",
((struct mlx4_err_cqe *) cqe)->vendor_err_syndrome,
((struct mlx4_err_cqe *) cqe)->syndrome);
goto next;
}
if (unlikely(cqe->badfcs_enc & MLX4_CQE_BAD_FCS)) {
en_dbg(RX_ERR, priv, "Accepted frame with bad FCS\n");
goto next;
}
/*
* Packet is OK - process it.
*/
length = be32_to_cpu(cqe->byte_cnt);
ring->bytes += length;
ring->packets++;
if (likely(dev->features & NETIF_F_RXCSUM)) {
if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) &&
(cqe->checksum == cpu_to_be16(0xffff))) {
priv->port_stats.rx_chksum_good++;
/* This packet is eligible for LRO if it is:
* - DIX Ethernet (type interpretation)
* - TCP/IP (v4)
* - without IP options
* - not an IP fragment */
if (dev->features & NETIF_F_GRO) {
struct sk_buff *gro_skb = napi_get_frags(&cq->napi);
if (!gro_skb)
goto next;
nr = mlx4_en_complete_rx_desc(
priv, rx_desc,
skb_frags, skb_shinfo(gro_skb)->frags,
ring->page_alloc, length);
if (!nr)
goto next;
skb_shinfo(gro_skb)->nr_frags = nr;
gro_skb->len = length;
gro_skb->data_len = length;
gro_skb->truesize += length;
gro_skb->ip_summed = CHECKSUM_UNNECESSARY;
if (priv->vlgrp && (cqe->vlan_my_qpn &
cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK)))
vlan_gro_frags(&cq->napi, priv->vlgrp, be16_to_cpu(cqe->sl_vid));
else
napi_gro_frags(&cq->napi);
goto next;
}
/* LRO not possible, complete processing here */
ip_summed = CHECKSUM_UNNECESSARY;
} else {
ip_summed = CHECKSUM_NONE;
priv->port_stats.rx_chksum_none++;
}
} else {
ip_summed = CHECKSUM_NONE;
//.........这里部分代码省略.........
开发者ID:andi34,项目名称:Dhollmen_Kernel,代码行数:101,代码来源:en_rx.c
示例20: mlx4_en_process_tx_cq
static int mlx4_en_process_tx_cq(struct net_device *dev,
struct mlx4_en_cq *cq)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_cq *mcq = &cq->mcq;
struct mlx4_en_tx_ring *ring = priv->tx_ring[cq->ring];
struct mlx4_cqe *cqe;
u16 index;
u16 new_index, ring_index, stamp_index;
u32 txbbs_skipped = 0;
#ifndef CONFIG_WQE_FORMAT_1
u32 txbbs_stamp = 0;
#endif
u32 cons_index = mcq->cons_index;
int size = cq->size;
u32 size_mask = ring->size_mask;
struct mlx4_cqe *buf = cq->buf;
u32 packets = 0;
u32 bytes = 0;
int factor = priv->cqe_factor;
u64 timestamp = 0;
int done = 0;
if (!priv->port_up)
return 0;
index = cons_index & size_mask;
cqe = &buf[(index << factor) + factor];
ring_index = ring->cons & size_mask;
stamp_index = ring_index;
/* Process all completed CQEs */
while (XNOR(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK,
cons_index & size)) {
/*
* make sure we read the CQE after we read the
* ownership bit
*/
rmb();
if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) ==
MLX4_CQE_OPCODE_ERROR)) {
en_err(priv, "CQE completed in error - vendor syndrom: 0x%x syndrom: 0x%x\n",
((struct mlx4_err_cqe *)cqe)->
vendor_err_syndrome,
((struct mlx4_err_cqe *)cqe)->syndrome);
}
/* Skip over last polled CQE */
new_index = be16_to_cpu(cqe->wqe_index) & size_mask;
do {
txbbs_skipped += ring->last_nr_txbb;
ring_index = (ring_index + ring->last_nr_txbb) & size_mask;
/* free next descriptor */
ring->last_nr_txbb = mlx4_en_free_tx_desc(
priv, ring, ring_index,
!!((ring->cons + txbbs_skipped) &
ring->size), timestamp);
#ifndef CONFIG_WQE_FORMAT_1
mlx4_en_stamp_wqe(priv, ring, stamp_index,
!!((ring->cons + txbbs_stamp) &
ring->size));
stamp_index = ring_index;
txbbs_stamp = txbbs_skipped;
#endif
packets++;
bytes += ring->tx_info[ring_index].nr_bytes;
} while (ring_index != new_index);
++cons_index;
index = cons_index & size_mask;
cqe = &buf[(index << factor) + factor];
}
/*
* To prevent CQ overflow we first update CQ consumer and only then
* the ring consumer.
*/
mcq->cons_index = cons_index;
mlx4_cq_set_ci(mcq);
wmb();
ring->cons += txbbs_skipped;
/* Wakeup Tx queue if it was stopped and ring is not full */
if (unlikely(ring->blocked) &&
(ring->prod - ring->cons) <= ring->full_size) {
ring->blocked = 0;
#ifdef CONFIG_RATELIMIT
if (cq->ring < priv->native_tx_ring_num) {
if (atomic_fetchadd_int(&priv->blocked, -1) == 1)
atomic_clear_int(&dev->if_drv_flags ,IFF_DRV_OACTIVE);
priv->port_stats.wake_queue++;
}
#else
if (atomic_fetchadd_int(&priv->blocked, -1) == 1)
atomic_clear_int(&dev->if_drv_flags ,IFF_DRV_OACTIVE);
priv->port_stats.wake_queue++;
//.........这里部分代码省略.........
开发者ID:ldesiqueira,项目名称:freebsd_mlx5en,代码行数:101,代码来源:en_tx.c
注:本文中的en_err函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论