]> Zhao Yanbai Git Server - minix.git/commitdiff
Message type for DL_TASK_REPLY
authorLionel Sambuc <lionel@minix3.org>
Tue, 20 May 2014 07:13:26 +0000 (09:13 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:45 +0000 (17:05 +0200)
Change-Id: I7f15f8f874366e93866f53d7a60a0c7ef9c98636

16 files changed:
drivers/atl2/atl2.c
drivers/dec21140A/dec21140A.c
drivers/dp8390/dp8390.c
drivers/dpeth/dp.c
drivers/e1000/e1000.c
drivers/fxp/fxp.c
drivers/lan8710a/lan8710a.c
drivers/lance/lance.c
drivers/orinoco/orinoco.c
drivers/rtl8139/rtl8139.c
drivers/rtl8169/rtl8169.c
drivers/virtio_net/virtio_net.c
include/minix/com.h
include/minix/ipc.h
servers/inet/mnx_eth.c
servers/lwip/driver.c

index 4faeecb05599239369e9527f49139164203e045d..747969d9ad818f1abbe5ea4d46a2e968f070b5ea 100644 (file)
@@ -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);
index e538fb27efe0b07fe9ee505f7acceae521878090..fedcd8c4bcb980244d5eb7c2fa82c162890b08b5 100644 (file)
@@ -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);
 
index c0abc61be0ef59c8dda89533c507966531f272f1..091c314c841f444388851cafcbe85b27ef78c250 100644 (file)
@@ -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)
index 972845d55faad4e85fe6608808b935c36f045711..8a56cfb41ccacde1acecf7eb0a3a3341a4abb31b 100644 (file)
@@ -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);
index 45af30bfe17aab6eeee6db559270f6a03217d59f..69bd47b0dfad63237193db25e21803e97a395633 100644 (file)
@@ -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);
index 61496eaa5d2cb1b4b6a328df9edbc132934656a2..c56588892fb3391c691ce5d6857f39323b4f913e 100644 (file)
@@ -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);
 
index 77fd1983d1eefe2a5f94136f8cece6832761cf57..5918b65e05fa74c1dad6203b472d9b405205c9bf 100644 (file)
@@ -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);
index a7adcf3f8a252a8c81e3f134e1b780fac9c77060..ecbf9d6420d208574e7711e39cab716ecb46ec7f 100644 (file)
@@ -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)
index 96bbc30295ee60559a237e2c55167aebf74f58f5..62ec3ce2fad2503c4581147168d4fa48a463f64b 100644 (file)
@@ -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);
 
index a1b2ac13feb66444d7b422026f89ac964f33ae3c..bdf2c76c7de72f320af00463b5d39430fd7e5ee0 100644 (file)
@@ -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);
 
index 1d5617fd840365f997255bfa55826cc26609062a..76cdf2ce0731fff57f0e944542dade3d3c1abf1d 100644 (file)
@@ -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);
 
index c25459a7c6c0ad84b9f0a0aaa8e2179e35808bdd..5afb6db67ebd3bba38c0498259bd3c43582d9d33 100644 (file)
@@ -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,
index 6ca15fabdc5f5d23b02f10b3e6b26dee0f0ff0f6..26207dd92b0b16b4e389546768db2f0bc885451a 100644 (file)
 
 /* 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
index eaab43f160a38017adc879318f47a791f227fd0a..9b783817f62e82c99cab80738fbb37e36f65816b 100644 (file)
@@ -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;
 
index 8580318a1c161c5b73de2fd0755fd8faa14ad0ca..c1777f4ad6824f27e1eb5d35c0b886607303d1a7 100644 (file)
@@ -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)
index 96464d4a787c3834d54123253b70cd1755486103..3674b4a6ed4f9dc3f0fb15f9d8a00eb5592330ce 100644 (file)
@@ -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;