in uint8 msix_intdest,
in bool use_irq,
in bool use_rsc,
+ in bool qzero,
out uint64 mac,
out int qid,
out cap regs,
struct e10k_queue;
typedef void (*e10k_event_cb_t)(void* q);
+
+/**
+* @brief create a handle to a queue of an e10k card. Assumes the driver is
+* running
+*
+* @param q Return pointer to the device queue
+* @param cb Callback function when an interrupt is raised
+* @param use_vf Start virtual functions, otherwise the physical function
+* will be used
+* @param interrupts Use interrupts, otherwise polling
+* @param default_q Request a handle to the default queue where
+* all the not filtered packes go to. Mostly use when
+* a queue is request from the driver itself.
+*
+* @returns error on NIC_ERR_ALLOC or SYS_ERR_OK on success
+*
+*/
errval_t e10k_queue_create(struct e10k_queue** q, e10k_event_cb_t cb,
- bool use_vf, bool interrupts);
+ bool use_vf, bool interrupts, bool default_q);
errval_t e10k_queue_destroy(struct e10k_queue* q);
+
+/**
+* @brief get the queue id of this queue handle. The returned id corresponds
+* to the real id used on the card
+*
+* @param q handl to the device queue
+*
+* @returns the queues id
+*
+*/
uint64_t e10k_queue_get_id(struct e10k_queue* q);
#endif
valid_length, flags)) {
err = DEVQ_ERR_QUEUE_EMPTY;
} else {
- DEBUG_QUEUE("Sent offset=%lu valid_data=%lu \n", *offset, *valid_data);
+ DEBUG_QUEUE("Queue %d sent offset=%lu valid_length=%lu \n",
+ que->id, *offset, *valid_length);
return SYS_ERR_OK;
}
valid_length, flags, &last)) {
err = DEVQ_ERR_QUEUE_EMPTY;
} else {
- DEBUG_QUEUE("Received offset=%lu valid_data=%lu \n", *offset, *valid_data);
+ DEBUG_QUEUE("Queue %d received offset=%lu valid_length=%lu \n",
+ que->id, *offset, *valid_length);
return SYS_ERR_OK;
}
d = q->d;
return SYS_ERR_OK;
}
+
// TODO mostly cleanup when fail
errval_t e10k_queue_create(struct e10k_queue** queue, e10k_event_cb_t cb,
- bool use_vf, bool interrupts)
+ bool use_vf, bool interrupts, bool qzero)
{
errval_t err;
err = q->binding->rpc_tx_vtbl.create_queue(q->binding, tx_frame, txhwb_frame,
rx_frame, 2048, q->msix_intvec,
- q->msix_intdest, false, false,
+ q->msix_intdest, false, false, qzero,
&q->mac, &qid,
®s, &err2);
if (err_is_fail(err) || err_is_fail(err2)) {
errval_t err;
err = e10k_queue_create((struct e10k_queue**)retqueue, int_handler,
false /*virtual functions*/,
- !(st->flags & NET_FLAGS_POLLING) /* user interrupts*/);
+ !(st->flags & NET_FLAGS_POLLING), /* user interrupts*/
+ (st->flags & NET_FLAGS_DEFAULT_QUEUE));
*queueid = e10k_queue_get_id((struct e10k_queue*)*retqueue);
return err;
}
} else if ((strcmp(cardname, "e10k") == 0) && (qid != 0)) {
USER_PANIC("e10k queue NIY \n");
struct e10k_queue* e10k;
- err = e10k_queue_create(&e10k, int_handler, false, true);
+ err = e10k_queue_create(&e10k, int_handler, false, true, false);
assert(err_is_ok(err));
devq = (struct devq*) e10k;