ionic_lif_reset(struct ionic_lif *lif)
{
struct ionic_dev *idev = &lif->adapter->idev;
+ int err;
IONIC_PRINT_CALL();
ionic_dev_cmd_lif_reset(idev, lif->index);
- ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+ err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);
+ if (err)
+ IONIC_PRINT(WARNING, "Failed to reset %s", lif->name);
}
static void
}
void
-ionic_dev_remove_mac(struct rte_eth_dev *eth_dev, uint32_t index __rte_unused)
+ionic_dev_remove_mac(struct rte_eth_dev *eth_dev, uint32_t index)
{
struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
struct ionic_adapter *adapter = lif->adapter;
+ struct rte_ether_addr *mac_addr;
IONIC_PRINT_CALL();
return;
}
- if (!rte_is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index]))
+ mac_addr = ð_dev->data->mac_addrs[index];
+
+ if (!rte_is_valid_assigned_ether_addr(mac_addr))
return;
- ionic_lif_addr_del(lif, (const uint8_t *)
- ð_dev->data->mac_addrs[index]);
+ ionic_lif_addr_del(lif, (const uint8_t *)mac_addr);
}
int
if (err)
return err;
- lif->mtu = new_mtu;
-
return 0;
}
/*
* Note: interrupt handler is called for index = 0 only
* (we use interrupts for the notifyq only anyway,
- * which hash index = 0)
+ * which has index = 0)
*/
for (index = 0; index < adapter->nintrs; index++)
uint32_t desc_size,
uint32_t cq_desc_size,
uint32_t sg_desc_size,
- uint32_t pid, struct ionic_qcq **qcq)
+ struct ionic_qcq **qcq)
{
struct ionic_dev *idev = &lif->adapter->idev;
struct ionic_qcq *new;
new->q.type = type;
err = ionic_q_init(lif, idev, &new->q, index, num_descs,
- desc_size, sg_desc_size, pid);
+ desc_size, sg_desc_size);
if (err) {
IONIC_PRINT(ERR, "Queue initialization failed");
return err;
ionic_q_sg_map(&new->q, sg_base, sg_base_pa);
}
- IONIC_PRINT(DEBUG, "Q-Base-PA = %ju CQ-Base-PA = %ju "
- "SG-base-PA = %ju",
+ IONIC_PRINT(DEBUG, "Q-Base-PA = %#jx CQ-Base-PA = %#jx "
+ "SG-base-PA = %#jx",
q_base_pa, cq_base_pa, sg_base_pa);
ionic_q_map(&new->q, q_base, q_base_pa);
sizeof(struct ionic_rxq_desc),
sizeof(struct ionic_rxq_comp),
sizeof(struct ionic_rxq_sg_desc),
- lif->kern_pid, &lif->rxqcqs[index]);
+ &lif->rxqcqs[index]);
if (err)
return err;
sizeof(struct ionic_txq_desc),
sizeof(struct ionic_txq_comp),
sizeof(struct ionic_txq_sg_desc),
- lif->kern_pid, &lif->txqcqs[index]);
+ &lif->txqcqs[index]);
if (err)
return err;
sizeof(struct ionic_admin_cmd),
sizeof(struct ionic_admin_comp),
0,
- lif->kern_pid, &lif->adminqcq);
+ &lif->adminqcq);
if (err)
return err;
sizeof(struct ionic_notifyq_cmd),
sizeof(union ionic_notifyq_comp),
0,
- lif->kern_pid, &lif->notifyqcq);
+ &lif->notifyqcq);
if (err)
return err;
int dbpage_num;
int err;
- snprintf(lif->name, sizeof(lif->name), "lif%u", lif->index);
+ /*
+ * lif->name was zeroed on allocation.
+ * Copy (sizeof() - 1) bytes to ensure that it is NULL terminated.
+ */
+ memcpy(lif->name, lif->eth_dev->data->name, sizeof(lif->name) - 1);
+
+ IONIC_PRINT(DEBUG, "LIF: %s", lif->name);
IONIC_PRINT(DEBUG, "Allocating Lif Info");
rte_spinlock_init(&lif->adminq_lock);
rte_spinlock_init(&lif->adminq_service_lock);
- lif->kern_pid = 0;
-
dbpage_num = ionic_db_page_num(lif, 0);
lif->kern_dbpage = ionic_bus_map_dbpage(adapter, dbpage_num);
IONIC_PRINT(DEBUG, "Allocating Admin Queue");
- IONIC_PRINT(DEBUG, "Allocating Admin Queue");
-
err = ionic_admin_qcq_alloc(lif);
if (err) {
IONIC_PRINT(ERR, "Cannot allocate admin queue");
.index = q->index,
.flags = (IONIC_QINIT_F_IRQ | IONIC_QINIT_F_ENA),
.intr_index = qcq->intr.index,
- .pid = q->pid,
.ring_size = rte_log2_u32(q->num_descs),
.ring_base = q->base_pa,
}
};
- IONIC_PRINT(DEBUG, "notifyq_init.pid %d", ctx.cmd.q_init.pid);
IONIC_PRINT(DEBUG, "notifyq_init.index %d",
ctx.cmd.q_init.index);
IONIC_PRINT(DEBUG, "notifyq_init.ring_base 0x%" PRIx64 "",
ctx.cmd.q_init.ring_base);
IONIC_PRINT(DEBUG, "notifyq_init.ring_size %d",
ctx.cmd.q_init.ring_size);
+ IONIC_PRINT(DEBUG, "notifyq_init.ver %u", ctx.cmd.q_init.ver);
err = ionic_adminq_post_wait(lif, &ctx);
if (err)
.index = q->index,
.flags = IONIC_QINIT_F_SG,
.intr_index = cq->bound_intr->index,
- .pid = q->pid,
.ring_size = rte_log2_u32(q->num_descs),
.ring_base = q->base_pa,
.cq_ring_base = cq->base_pa,
};
int err;
- IONIC_PRINT(DEBUG, "txq_init.pid %d", ctx.cmd.q_init.pid);
IONIC_PRINT(DEBUG, "txq_init.index %d", ctx.cmd.q_init.index);
IONIC_PRINT(DEBUG, "txq_init.ring_base 0x%" PRIx64 "",
ctx.cmd.q_init.ring_base);
IONIC_PRINT(DEBUG, "txq_init.ring_size %d",
ctx.cmd.q_init.ring_size);
+ IONIC_PRINT(DEBUG, "txq_init.ver %u", ctx.cmd.q_init.ver);
err = ionic_adminq_post_wait(qcq->lif, &ctx);
if (err)
.index = q->index,
.flags = IONIC_QINIT_F_SG,
.intr_index = cq->bound_intr->index,
- .pid = q->pid,
.ring_size = rte_log2_u32(q->num_descs),
.ring_base = q->base_pa,
.cq_ring_base = cq->base_pa,
};
int err;
- IONIC_PRINT(DEBUG, "rxq_init.pid %d", ctx.cmd.q_init.pid);
IONIC_PRINT(DEBUG, "rxq_init.index %d", ctx.cmd.q_init.index);
IONIC_PRINT(DEBUG, "rxq_init.ring_base 0x%" PRIx64 "",
ctx.cmd.q_init.ring_base);
IONIC_PRINT(DEBUG, "rxq_init.ring_size %d",
ctx.cmd.q_init.ring_size);
+ IONIC_PRINT(DEBUG, "rxq_init.ver %u", ctx.cmd.q_init.ver);
err = ionic_adminq_post_wait(qcq->lif, &ctx);
if (err)
},
};
- snprintf(ctx.cmd.lif_setattr.name, sizeof(ctx.cmd.lif_setattr.name),
- "%d", lif->port_id);
+ memcpy(ctx.cmd.lif_setattr.name, lif->name,
+ sizeof(ctx.cmd.lif_setattr.name) - 1);
ionic_adminq_post_wait(lif, &ctx);
}
for (i = 0; i < lif->nrxqcqs; i++) {
struct ionic_qcq *rxq = lif->rxqcqs[i];
- if (!rxq->deferred_start) {
+ if (!(rxq->flags & IONIC_QCQ_F_DEFERRED)) {
err = ionic_dev_rx_queue_start(lif->eth_dev, i);
if (err)
for (i = 0; i < lif->ntxqcqs; i++) {
struct ionic_qcq *txq = lif->txqcqs[i];
- if (!txq->deferred_start) {
+ if (!(txq->flags & IONIC_QCQ_F_DEFERRED)) {
err = ionic_dev_tx_queue_start(lif->eth_dev, i);
if (err)
nintrs = nlifs * 1 /* notifyq */;
if (nintrs > dev_nintrs) {
- IONIC_PRINT(ERR, "At most %d intr queues supported, minimum required is %u",
+ IONIC_PRINT(ERR,
+ "At most %d intr supported, minimum req'd is %u",
dev_nintrs, nintrs);
return -ENOSPC;
}