[lib][minip] add an arg to the ethernet transmit callback

Already had the registration hook for it, but was never used.
This commit is contained in:
Travis Geiselbrecht
2022-03-19 15:06:57 -07:00
parent fe28bd8a95
commit 6ad3643165
12 changed files with 22 additions and 23 deletions

View File

@@ -511,18 +511,15 @@ status_t e1000::init_device(pci_location_t loc, const e1000_id_features *id) {
return NO_ERROR;
}
static int e1000_tx(pktbuf_t *p) {
if (the_e) {
the_e->tx(p);
}
return NO_ERROR;
}
extern "C"
status_t e1000_register_with_minip() {
auto tx_routine = [](void *arg, pktbuf_t *p) {
auto *e = static_cast<e1000 *>(arg);
return e->tx(p);
};
if (the_e) {
minip_set_eth(e1000_tx, the_e, the_e->mac_addr());
minip_set_eth(tx_routine, the_e, the_e->mac_addr());
return NO_ERROR;
}

View File

@@ -20,5 +20,5 @@ int virtio_net_found(void);
status_t virtio_net_get_mac_addr(uint8_t mac_addr[6]);
struct pktbuf;
extern status_t virtio_net_send_minip_pkt(struct pktbuf *p);
extern status_t virtio_net_send_minip_pkt(void *arg, struct pktbuf *p);

View File

@@ -426,7 +426,7 @@ status_t virtio_net_get_mac_addr(uint8_t mac_addr[6]) {
return NO_ERROR;
}
status_t virtio_net_send_minip_pkt(pktbuf_t *p) {
status_t virtio_net_send_minip_pkt(void *arg, pktbuf_t *p) {
LTRACEF("p %p, dlen %u, flags 0x%x\n", p, p->dlen, p->flags);
DEBUG_ASSERT(p && p->dlen);