- (void)conf; /* Thresholds configuration (ignored). */
- mb_len = rte_pktmbuf_data_room_size(mp);
- if (desc == 0) {
- rte_errno = EINVAL;
- ERROR("%p: invalid number of Rx descriptors", (void *)dev);
- goto error;
- }
- /* Enable scattered packets support for this queue if necessary. */
- assert(mb_len >= RTE_PKTMBUF_HEADROOM);
- if (dev->data->dev_conf.rxmode.max_rx_pkt_len <=
- (mb_len - RTE_PKTMBUF_HEADROOM)) {
- ;
- } else if (dev->data->dev_conf.rxmode.enable_scatter) {
- WARN("%p: scattered mode has been requested but is"
- " not supported, this may lead to packet loss",
- (void *)dev);
- } else {
- WARN("%p: the requested maximum Rx packet size (%u) is"
- " larger than a single mbuf (%u) and scattered"
- " mode has not been requested",
- (void *)dev,
- dev->data->dev_conf.rxmode.max_rx_pkt_len,
- mb_len - RTE_PKTMBUF_HEADROOM);
- }
- /* Use the entire RX mempool as the memory region. */
- tmpl.mr = mlx4_mp2mr(priv->pd, mp);
- if (tmpl.mr == NULL) {
- rte_errno = EINVAL;
- ERROR("%p: MR creation failure: %s",
- (void *)dev, strerror(rte_errno));
- goto error;
- }
- if (dev->data->dev_conf.intr_conf.rxq) {
- tmpl.channel = ibv_create_comp_channel(priv->ctx);
- if (tmpl.channel == NULL) {
- rte_errno = ENOMEM;
- ERROR("%p: Rx interrupt completion channel creation"
- " failure: %s",
- (void *)dev, strerror(rte_errno));
- goto error;
- }
- if (mlx4_fd_set_non_blocking(tmpl.channel->fd) < 0) {
- ERROR("%p: unable to make Rx interrupt completion"
- " channel non-blocking: %s",
- (void *)dev, strerror(rte_errno));
- goto error;
- }
- }
- tmpl.cq = ibv_create_cq(priv->ctx, desc, NULL, tmpl.channel, 0);
- if (tmpl.cq == NULL) {
- rte_errno = ENOMEM;
- ERROR("%p: CQ creation failure: %s",
- (void *)dev, strerror(rte_errno));
- goto error;
- }
- DEBUG("priv->device_attr.max_qp_wr is %d",
- priv->device_attr.max_qp_wr);
- DEBUG("priv->device_attr.max_sge is %d",
- priv->device_attr.max_sge);
- tmpl.qp = rxq_setup_qp(priv, tmpl.cq, desc);
- if (tmpl.qp == NULL) {
- ERROR("%p: QP creation failure: %s",
- (void *)dev, strerror(rte_errno));
- goto error;
- }
- mod = (struct ibv_qp_attr){
- /* Move the QP to this state. */
- .qp_state = IBV_QPS_INIT,
- /* Primary port number. */
- .port_num = priv->port
- };
- ret = ibv_modify_qp(tmpl.qp, &mod, IBV_QP_STATE | IBV_QP_PORT);
- if (ret) {
- rte_errno = ret;
- ERROR("%p: QP state to IBV_QPS_INIT failed: %s",
- (void *)dev, strerror(rte_errno));
- goto error;
- }
- ret = rxq_alloc_elts(&tmpl, desc);