}
                ctx->dev = u_ctx->dev;
                adap = padap(ctx->dev);
-               ntxq = min_not_zero((unsigned int)u_ctx->lldi.nrxq,
-                                   adap->vres.ncrypto_fc);
+               ntxq = u_ctx->lldi.ntxq;
                rxq_perchan = u_ctx->lldi.nrxq / u_ctx->lldi.nchan;
                txq_perchan = ntxq / u_ctx->lldi.nchan;
                spin_lock(&ctx->dev->lock_chcr_dev);
 
        txq_info = kzalloc(sizeof(*txq_info), GFP_KERNEL);
        if (!txq_info)
                return -ENOMEM;
+       if (uld_type == CXGB4_ULD_CRYPTO) {
+               i = min_t(int, adap->vres.ncrypto_fc,
+                         num_online_cpus());
+               txq_info->ntxq = rounddown(i, adap->params.nports);
+               if (txq_info->ntxq <= 0) {
+                       dev_warn(adap->pdev_dev, "Crypto Tx Queues can't be zero\n");
+                       kfree(txq_info);
+                       return -EINVAL;
+               }
 
-       i = min_t(int, uld_info->ntxq, num_online_cpus());
-       txq_info->ntxq = roundup(i, adap->params.nports);
-
+       } else {
+               i = min_t(int, uld_info->ntxq, num_online_cpus());
+               txq_info->ntxq = roundup(i, adap->params.nports);
+       }
        txq_info->uldtxq = kcalloc(txq_info->ntxq, sizeof(struct sge_uld_txq),
                                   GFP_KERNEL);
        if (!txq_info->uldtxq) {
                           struct cxgb4_lld_info *lli)
 {
        struct sge_uld_rxq_info *rxq_info = adap->sge.uld_rxq_info[uld_type];
+       int tx_uld_type = TX_ULD(uld_type);
+       struct sge_uld_txq_info *txq_info = adap->sge.uld_txq_info[tx_uld_type];
 
        lli->rxq_ids = rxq_info->rspq_id;
        lli->nrxq = rxq_info->nrxq;
        lli->ciq_ids = rxq_info->rspq_id + rxq_info->nrxq;
        lli->nciq = rxq_info->nciq;
+       lli->ntxq = txq_info->ntxq;
 }
 
 int t4_uld_mem_alloc(struct adapter *adap)
        lld->ports = adap->port;
        lld->vr = &adap->vres;
        lld->mtus = adap->params.mtus;
-       lld->ntxq = adap->sge.ofldqsets;
        lld->nchan = adap->params.nports;
        lld->nports = adap->params.nports;
        lld->wr_cred = adap->params.ofldq_wr_cred;