From: Lionel Sambuc Date: Tue, 20 May 2014 07:13:26 +0000 (+0200) Subject: Message type for DL_TASK_REPLY X-Git-Tag: v3.3.0~233 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/howto.html?a=commitdiff_plain;h=992b76139f2cef80b3066b845a94ec1f9c456570;p=minix.git Message type for DL_TASK_REPLY Change-Id: I7f15f8f874366e93866f53d7a60a0c7ef9c98636 --- diff --git a/drivers/atl2/atl2.c b/drivers/atl2/atl2.c index 4faeecb05..747969d9a 100644 --- a/drivers/atl2/atl2.c +++ b/drivers/atl2/atl2.c @@ -729,11 +729,11 @@ static void atl2_reply(void) flags |= DL_PACK_RECV; m.m_type = DL_TASK_REPLY; - m.DL_FLAGS = flags; - m.DL_COUNT = state.recv_count; + m.m_netdrv_net_dl_task.flags = flags; + m.m_netdrv_net_dl_task.count = state.recv_count; ATL2_DEBUG(("ATL2: sending reply, flags %x count %d\n", flags, - m.DL_COUNT)); + m.m_netdrv_net_dl_task.count)); if ((r = ipc_send(state.task_endpt, &m)) != OK) panic("unable to reply: %d", r); diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index e538fb27e..fedcd8c4b 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -268,8 +268,8 @@ static void do_reply(dpeth_t * dep) if (dep->de_flags & DEF_ACK_RECV) flags |= DL_PACK_RECV; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = flags; - reply.DL_COUNT = dep->de_read_s; + reply.m_netdrv_net_dl_task.flags = flags; + reply.m_netdrv_net_dl_task.count = dep->de_read_s; r = ipc_send(dep->de_client, &reply); diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index c0abc61be..091c314c8 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -1744,8 +1744,8 @@ dpeth_t *dep; flags |= DL_PACK_RECV; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = flags; - reply.DL_COUNT = dep->de_read_s; + reply.m_netdrv_net_dl_task.flags = flags; + reply.m_netdrv_net_dl_task.count = dep->de_read_s; r= ipc_send(dep->de_client, &reply); if (r < 0) diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 972845d55..8a56cfb41 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -62,10 +62,11 @@ static void reply(dpeth_t * dep) if (dep->de_flags & DEF_ACK_RECV) flags |= DL_PACK_RECV; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = flags; - reply.DL_COUNT = dep->de_read_s; + reply.m_netdrv_net_dl_task.flags = flags; + reply.m_netdrv_net_dl_task.count = dep->de_read_s; - DEBUG(printf("\t reply %d (%lx)\n", reply.m_type, reply.DL_FLAGS)); + DEBUG(printf("\t reply %d (%lx)\n", reply.m_type, + reply.m_netdrv_net_dl_task.flags)); if ((r = ipc_send(dep->de_client, &reply)) != OK) panic(SendErrMsg, r); diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index 45af30bfe..69bd47b0d 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -1159,16 +1159,17 @@ e1000_t *e; } /* Construct reply message. */ msg.m_type = DL_TASK_REPLY; - msg.DL_FLAGS = DL_NOFLAGS; - msg.DL_COUNT = 0; + msg.m_netdrv_net_dl_task.flags = DL_NOFLAGS; + msg.m_netdrv_net_dl_task.count = 0; /* Did we successfully receive packet(s)? */ if (e->status & E1000_READING && e->status & E1000_RECEIVED) { - msg.DL_FLAGS |= DL_PACK_RECV; - msg.DL_COUNT = e->rx_size >= ETH_MIN_PACK_SIZE ? - e->rx_size : ETH_MIN_PACK_SIZE; + msg.m_netdrv_net_dl_task.flags |= DL_PACK_RECV; + msg.m_netdrv_net_dl_task.count = + e->rx_size >= ETH_MIN_PACK_SIZE ? + e->rx_size : ETH_MIN_PACK_SIZE; /* Clear flags. */ e->status &= ~(E1000_READING | E1000_RECEIVED); @@ -1177,7 +1178,7 @@ e1000_t *e; if (e->status & E1000_TRANSMIT && e->status & E1000_WRITING) { - msg.DL_FLAGS |= DL_PACK_SEND; + msg.m_netdrv_net_dl_task.flags |= DL_PACK_SEND; /* Clear flags. */ e->status &= ~(E1000_WRITING | E1000_TRANSMIT); diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 61496eaa5..c56588892 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -1938,8 +1938,8 @@ fxp_t *fp; flags |= DL_PACK_RECV; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = flags; - reply.DL_COUNT = fp->fxp_read_s; + reply.m_netdrv_net_dl_task.flags = flags; + reply.m_netdrv_net_dl_task.count = fp->fxp_read_s; r= ipc_send(fp->fxp_client, &reply); diff --git a/drivers/lan8710a/lan8710a.c b/drivers/lan8710a/lan8710a.c index 77fd1983d..5918b65e0 100644 --- a/drivers/lan8710a/lan8710a.c +++ b/drivers/lan8710a/lan8710a.c @@ -1213,16 +1213,16 @@ lan8710a_t *e; } /* Construct reply message. */ msg.m_type = DL_TASK_REPLY; - msg.DL_FLAGS = DL_NOFLAGS; - msg.DL_COUNT = 0; + msg.m_netdrv_net_dl_task.flags = DL_NOFLAGS; + msg.m_netdrv_net_dl_task.count = 0; /* Did we successfully receive packet(s)? */ if (e->status & LAN8710A_READING && e->status & LAN8710A_RECEIVED) { - msg.DL_FLAGS |= DL_PACK_RECV; - msg.DL_COUNT = e->rx_size >= ETH_MIN_PACK_SIZE ? - e->rx_size : - ETH_MIN_PACK_SIZE; + msg.m_netdrv_net_dl_task.flags |= DL_PACK_RECV; + msg.m_netdrv_net_dl_task.count = + e->rx_size >= ETH_MIN_PACK_SIZE ? + e->rx_size : ETH_MIN_PACK_SIZE; /* Clear flags. */ e->status &= ~(LAN8710A_READING | LAN8710A_RECEIVED); @@ -1230,7 +1230,7 @@ lan8710a_t *e; /* Did we successfully transmit packet(s)? */ if (e->status & LAN8710A_TRANSMIT && e->status & LAN8710A_WRITING) { - msg.DL_FLAGS |= DL_PACK_SEND; + msg.m_netdrv_net_dl_task.flags |= DL_PACK_SEND; /* Clear flags. */ e->status &= ~(LAN8710A_WRITING | LAN8710A_TRANSMIT); diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index a7adcf3f8..ecbf9d642 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -676,8 +676,8 @@ ether_card_t *ec; flags |= DL_PACK_RECV; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = flags; - reply.DL_COUNT = ec->read_s; + reply.m_netdrv_net_dl_task.flags = flags; + reply.m_netdrv_net_dl_task.count = ec->read_s; r = ipc_send(ec->client, &reply); if (r < 0) diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index 96bbc3029..62ec3ce2f 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -1345,8 +1345,8 @@ static void reply (t_or * orp) { flags |= DL_PACK_RECV; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = flags; - reply.DL_COUNT = orp->or_read_s; + reply.m_netdrv_net_dl_task.flags = flags; + reply.m_netdrv_net_dl_task.count = orp->or_read_s; r = ipc_send(orp->or_client, &reply); diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index a1b2ac13f..bdf2c76c7 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -1560,8 +1560,8 @@ re_t *rep; flags |= DL_PACK_RECV; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = flags; - reply.DL_COUNT = rep->re_read_s; + reply.m_netdrv_net_dl_task.flags = flags; + reply.m_netdrv_net_dl_task.count = rep->re_read_s; r= ipc_send(rep->re_client, &reply); diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index 1d5617fd8..76cdf2ce0 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -1559,8 +1559,8 @@ re_t *rep; flags |= DL_PACK_RECV; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = flags; - reply.DL_COUNT = rep->re_read_s; + reply.m_netdrv_net_dl_task.flags = flags; + reply.m_netdrv_net_dl_task.count = rep->re_read_s; r = ipc_send(rep->re_client, &reply); diff --git a/drivers/virtio_net/virtio_net.c b/drivers/virtio_net/virtio_net.c index c25459a7c..5afb6db67 100644 --- a/drivers/virtio_net/virtio_net.c +++ b/drivers/virtio_net/virtio_net.c @@ -292,26 +292,27 @@ virtio_net_check_pending(void) message reply; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = DL_NOFLAGS; - reply.DL_COUNT = 0; + reply.m_netdrv_net_dl_task.flags = DL_NOFLAGS; + reply.m_netdrv_net_dl_task.count = 0; /* Pending read and something in recv_list? */ if (!STAILQ_EMPTY(&recv_list) && rx_pending) { dst = pending_rx_msg.m_source; - reply.DL_COUNT = virtio_net_cpy_to_user(&pending_rx_msg); - reply.DL_FLAGS |= DL_PACK_RECV; + reply.m_netdrv_net_dl_task.count = + virtio_net_cpy_to_user(&pending_rx_msg); + reply.m_netdrv_net_dl_task.flags |= DL_PACK_RECV; rx_pending = 0; } if (!STAILQ_EMPTY(&free_list) && tx_pending) { dst = pending_tx_msg.m_source; virtio_net_cpy_from_user(&pending_tx_msg); - reply.DL_FLAGS |= DL_PACK_SEND; + reply.m_netdrv_net_dl_task.flags |= DL_PACK_SEND; tx_pending = 0; } /* Only reply if a pending request was handled */ - if (reply.DL_FLAGS != DL_NOFLAGS) + if (reply.m_netdrv_net_dl_task.flags != DL_NOFLAGS) if ((r = ipc_send(dst, &reply)) != OK) panic("%s: ipc_send to %d failed (%d)", name, dst, r); } @@ -473,14 +474,14 @@ virtio_net_write(message *m) message reply; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = DL_NOFLAGS; - reply.DL_COUNT = 0; + reply.m_netdrv_net_dl_task.flags = DL_NOFLAGS; + reply.m_netdrv_net_dl_task.count = 0; if (!STAILQ_EMPTY(&free_list)) { /* free_list contains at least one packet, use it */ - reply.DL_COUNT = virtio_net_cpy_from_user(m); - reply.DL_FLAGS = DL_PACK_SEND; + reply.m_netdrv_net_dl_task.count = virtio_net_cpy_from_user(m); + reply.m_netdrv_net_dl_task.flags = DL_PACK_SEND; } else { pending_tx_msg = *m; tx_pending = 1; @@ -497,13 +498,13 @@ virtio_net_read(message *m) message reply; reply.m_type = DL_TASK_REPLY; - reply.DL_FLAGS = DL_NOFLAGS; - reply.DL_COUNT = 0; + reply.m_netdrv_net_dl_task.flags = DL_NOFLAGS; + reply.m_netdrv_net_dl_task.count = 0; if (!STAILQ_EMPTY(&recv_list)) { /* recv_list contains at least one packet, copy it */ - reply.DL_COUNT = virtio_net_cpy_to_user(m); - reply.DL_FLAGS = DL_PACK_RECV; + reply.m_netdrv_net_dl_task.count = virtio_net_cpy_to_user(m); + reply.m_netdrv_net_dl_task.flags = DL_PACK_RECV; } else { rx_pending = 1; pending_rx_msg = *m; @@ -548,9 +549,6 @@ virtio_net_getstat(message *m) message reply; reply.m_type = DL_STAT_REPLY; - reply.DL_STAT = OK; - reply.DL_COUNT = 0; - r = sys_safecopyto(m->m_source, m->m_net_netdrv_dl_getstat_s.grant, 0, (vir_bytes)&virtio_net_stats, diff --git a/include/minix/com.h b/include/minix/com.h index 6ca15fabd..26207dd92 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -180,11 +180,9 @@ /* Field names for data link layer messages. */ #define DL_COUNT m2_i3 -#define DL_FLAGS m2_l1 #define DL_GRANT m2_l2 -#define DL_STAT m3_i1 -/* Bits in 'DL_FLAGS' field of DL replies. */ +/* Bits in 'flags' field of DL replies. */ # define DL_NOFLAGS 0x00 # define DL_PACK_SEND 0x01 # define DL_PACK_RECV 0x02 diff --git a/include/minix/ipc.h b/include/minix/ipc.h index eaab43f16..9b783817f 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -835,6 +835,14 @@ typedef struct { } mess_net_netdrv_dl_getstat_s; _ASSERT_MSG_SIZE(mess_net_netdrv_dl_getstat_s); +typedef struct { + int count; + uint32_t flags; + + uint8_t padding[48]; +} mess_netdrv_net_dl_task; +_ASSERT_MSG_SIZE(mess_netdrv_net_dl_task); + typedef struct { uid_t egid; @@ -1419,6 +1427,7 @@ typedef struct { mess_net_netdrv_dl_getstat_s m_net_netdrv_dl_getstat_s; mess_netdrv_net_dl_conf m_netdrv_net_dl_conf; + mess_netdrv_net_dl_task m_netdrv_net_dl_task; mess_pci_lsys_busc_get_bar m_pci_lsys_busc_get_bar; diff --git a/servers/inet/mnx_eth.c b/servers/inet/mnx_eth.c index 8580318a1..c1777f4ad 100644 --- a/servers/inet/mnx_eth.c +++ b/servers/inet/mnx_eth.c @@ -201,12 +201,12 @@ void eth_rec(message *m) { if (m_type == DL_TASK_REPLY) { - flags= m->DL_FLAGS; + flags= m->m_netdrv_net_dl_task.flags; if (flags & DL_PACK_SEND) write_int(loc_port); if (flags & DL_PACK_RECV) - read_int(loc_port, m->DL_COUNT); + read_int(loc_port, m->m_netdrv_net_dl_task.count); return; } @@ -218,7 +218,7 @@ void eth_rec(message *m) return; } - r= m->DL_STAT; + r= m->m_netdrv_net_dl_conf.stat; if (r < 0) { ip_warning(("eth_rec: DL_CONF returned error %d\n", @@ -281,12 +281,12 @@ void eth_rec(message *m) { if (m_type == DL_TASK_REPLY) { - flags= m->DL_FLAGS; + flags= m->m_netdrv_net_dl_task.flags; if (flags & DL_PACK_SEND) write_int(loc_port); if (flags & DL_PACK_RECV) - read_int(loc_port, m->DL_COUNT); + read_int(loc_port, m->m_netdrv_net_dl_task.count); return; } @@ -341,12 +341,12 @@ void eth_rec(message *m) (printf("etp_state = %d\n", loc_port->etp_osdep.etp_state), 0)); loc_port->etp_osdep.etp_state= OEPS_IDLE; - flags= m->DL_FLAGS; + flags= m->m_netdrv_net_dl_task.flags; if (flags & DL_PACK_SEND) write_int(loc_port); if (flags & DL_PACK_RECV) - read_int(loc_port, m->DL_COUNT); + read_int(loc_port, m->m_netdrv_net_dl_task.count); if (loc_port->etp_osdep.etp_state == OEPS_IDLE && loc_port->etp_osdep.etp_flags & OEPF_NEED_SEND) diff --git a/servers/lwip/driver.c b/servers/lwip/driver.c index 96464d4a7..3674b4a6e 100644 --- a/servers/lwip/driver.c +++ b/servers/lwip/driver.c @@ -366,20 +366,21 @@ void driver_request(message * m) switch (m->m_type) { case DL_CONF_REPLY: - if (m->DL_STAT == OK) + if (m->m_netdrv_net_dl_conf.stat == OK) nic_up(nic, m); break; case DL_TASK_REPLY: /* - if (!(m->DL_FLAGS & DL_PACK_SEND) && !(m->DL_FLAGS & DL_PACK_RECV)) { + if (!(m->m_netdrv_net_dl_task.flags & DL_PACK_SEND) && + !(m->m_netdrv_net_dl_task.flags & DL_PACK_RECV)) { printf("void reply from driver\n"); break; } */ - if (m->DL_FLAGS & DL_PACK_SEND) + if (m->m_netdrv_net_dl_task.flags & DL_PACK_SEND) nic_pkt_sent(nic); - if (m->DL_FLAGS & DL_PACK_RECV) - nic_pkt_received(nic, m->DL_COUNT); + if (m->m_netdrv_net_dl_task.flags & DL_PACK_RECV) + nic_pkt_received(nic, m->m_netdrv_net_dl_task.count); break; case DL_STAT_REPLY: break;