]> Zhao Yanbai Git Server - minix.git/commitdiff
Message type for DL_{READ,WRITE}V_S
authorLionel Sambuc <lionel@minix3.org>
Tue, 20 May 2014 09:19:27 +0000 (11:19 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:45 +0000 (17:05 +0200)
Change-Id: I6e25e8e994b0bdec2bb54f50e6db08e6e935c819

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 747969d9ad818f1abbe5ea4d46a2e968f070b5ea..b07e3536c5a38886f8502026fb200de64c0c4cc2 100644 (file)
@@ -777,12 +777,13 @@ static void atl2_readv(const message *m, int from_int)
        left = count;
        pos = rxd->data;
 
-       for (i = 0; i < m->DL_COUNT && left > 0; i += batch) {
+       for (i = 0; i < m->m_net_netdrv_dl_readv_s.count && left > 0; i += batch) {
                /* Copy in the next batch. */
-               batch = MIN(m->DL_COUNT - i, NR_IOREQS);
+               batch = MIN(m->m_net_netdrv_dl_readv_s.count - i, NR_IOREQS);
 
-               r = sys_safecopyfrom(m->m_source, m->DL_GRANT, off, 
-                       (vir_bytes) iovec, batch * sizeof(iovec[0]));
+               r = sys_safecopyfrom(m->m_source,
+                       m->m_net_netdrv_dl_readv_s.grant, off, (vir_bytes) iovec,
+                       batch * sizeof(iovec[0]));
                if (r != OK)
                        panic("vector copy failed: %d", r);
 
@@ -874,12 +875,13 @@ static void atl2_writev(const message *m, int from_int)
        pos = (state.txd_tail + state.txd_num +
                sizeof(u32_t)) % ATL2_TXD_BUFSIZE;
 
-       for (i = 0; i < m->DL_COUNT; i += batch) {
+       for (i = 0; i < m->m_net_netdrv_dl_writev_s.count; i += batch) {
                /* Copy in the next batch. */
-               batch = MIN(m->DL_COUNT - i, NR_IOREQS);
+               batch = MIN(m->m_net_netdrv_dl_writev_s.count - i, NR_IOREQS);
 
-               r = sys_safecopyfrom(m->m_source, m->DL_GRANT, off, 
-                       (vir_bytes) iovec, batch * sizeof(iovec[0]));
+               r = sys_safecopyfrom(m->m_source,
+                       m->m_net_netdrv_dl_writev_s.grant, off, (vir_bytes) iovec,
+                       batch * sizeof(iovec[0]));
                if (r != OK)
                        panic("vector copy failed: %d", r);
 
index fedcd8c4bcb980244d5eb7c2fa82c162890b08b5..4ab0d5e40037344d97fad69f29a0aedc09f02f46 100644 (file)
@@ -470,10 +470,11 @@ static void do_vread_s(const message * mp, int from_int)
        client layer
     */
     dep->de_read_iovec.iod_proc_nr = mp->m_source;
-    de_get_userdata_s(mp->m_source, (cp_grant_id_t) mp->DL_GRANT, 0,
-                     mp->DL_COUNT, dep->de_read_iovec.iod_iovec);
-    dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT;
-    dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
+    de_get_userdata_s(mp->m_source, mp->m_net_netdrv_dl_readv_s.grant, 0,
+                     mp->m_net_netdrv_dl_readv_s.count,
+                     dep->de_read_iovec.iod_iovec);
+    dep->de_read_iovec.iod_iovec_s = mp->m_net_netdrv_dl_readv_s.count;
+    dep->de_read_iovec.iod_grant = mp->m_net_netdrv_dl_readv_s.grant;
     dep->de_read_iovec.iod_iovec_offset = 0;
     size = de_calc_iov_size(&dep->de_read_iovec);
     if (size < ETH_MAX_PACK_SIZE) 
@@ -823,10 +824,10 @@ static void do_vwrite_s(const message * mp, int from_int){
     buffer = descr->buf1;
     iovp = &dep->de_write_iovec;
     iovp->iod_proc_nr = mp->m_source;
-    de_get_userdata_s(mp->m_source, mp->DL_GRANT, 0,
-                     mp->DL_COUNT, iovp->iod_iovec);
-    iovp->iod_iovec_s = mp->DL_COUNT;
-    iovp->iod_grant = (cp_grant_id_t) mp->DL_GRANT;
+    de_get_userdata_s(mp->m_source, mp->m_net_netdrv_dl_writev_s.grant, 0,
+                     mp->m_net_netdrv_dl_writev_s.count, iovp->iod_iovec);
+    iovp->iod_iovec_s = mp->m_net_netdrv_dl_writev_s.count;
+    iovp->iod_grant = mp->m_net_netdrv_dl_writev_s.grant;
     iovp->iod_iovec_offset = 0;
     totalsize = size = de_calc_iov_size(iovp);
     if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)
index 091c314c841f444388851cafcbe85b27ef78c250..3d23db40b5246d5d042e93156041a2211715ba64 100644 (file)
@@ -364,7 +364,7 @@ int from_int;
 
        dep= &de_state;
 
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_writev_s.count;
        dep->de_client= mp->m_source;
 
        if (dep->de_mode == DEM_SINK)
@@ -391,13 +391,13 @@ int from_int;
        }
        assert(!(dep->de_flags & DEF_PACK_SEND));
 
-       get_userdata_s(mp->m_source, mp->DL_GRANT, 0,
+       get_userdata_s(mp->m_source, mp->m_net_netdrv_dl_writev_s.grant, 0,
                (count > IOVEC_NR ? IOVEC_NR : count) *
                sizeof(dep->de_write_iovec_s.iod_iovec[0]),
                dep->de_write_iovec_s.iod_iovec);
        dep->de_write_iovec_s.iod_iovec_s = count;
        dep->de_write_iovec_s.iod_proc_nr = mp->m_source;
-       dep->de_write_iovec_s.iod_grant = mp->DL_GRANT;
+       dep->de_write_iovec_s.iod_grant = mp->m_net_netdrv_dl_writev_s.grant;
        dep->de_write_iovec_s.iod_iovec_offset = 0;
 
        dep->de_tmp_iovec_s = dep->de_write_iovec_s;
@@ -451,7 +451,7 @@ message *mp;
 
        dep= &de_state;
 
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_readv_s.count;
        dep->de_client= mp->m_source;
        if (dep->de_mode == DEM_SINK)
        {
@@ -464,13 +464,13 @@ message *mp;
        if(dep->de_flags & DEF_READING)
                panic("dp8390: read already in progress");
 
-       get_userdata_s(mp->m_source, mp->DL_GRANT, 0,
+       get_userdata_s(mp->m_source, mp->m_net_netdrv_dl_readv_s.grant, 0,
                (count > IOVEC_NR ? IOVEC_NR : count) *
                sizeof(dep->de_read_iovec_s.iod_iovec[0]),
                dep->de_read_iovec_s.iod_iovec);
        dep->de_read_iovec_s.iod_iovec_s = count;
        dep->de_read_iovec_s.iod_proc_nr = mp->m_source;
-       dep->de_read_iovec_s.iod_grant = mp->DL_GRANT;
+       dep->de_read_iovec_s.iod_grant = mp->m_net_netdrv_dl_readv_s.grant;
        dep->de_read_iovec_s.iod_iovec_offset = 0;
 
        dep->de_tmp_iovec_s = dep->de_read_iovec_s;
index 8a56cfb41ccacde1acecf7eb0a3a3341a4abb31b..9ed770fcdf898c45c90d867152da45b8a9fc1175 100644 (file)
@@ -363,10 +363,10 @@ static void do_vwrite_s(const message * mp)
                panic("send already in progress ");
 
        dep->de_write_iovec.iod_proc_nr = mp->m_source;
-       get_userdata_s(mp->m_source, mp->DL_GRANT, 0,
-              mp->DL_COUNT, dep->de_write_iovec.iod_iovec);
-       dep->de_write_iovec.iod_iovec_s = mp->DL_COUNT;
-       dep->de_write_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
+       get_userdata_s(mp->m_source, mp->m_net_netdrv_dl_writev_s.grant, 0,
+              mp->m_net_netdrv_dl_writev_s.count, dep->de_write_iovec.iod_iovec);
+       dep->de_write_iovec.iod_iovec_s = mp->m_net_netdrv_dl_writev_s.count;
+       dep->de_write_iovec.iod_grant = mp->m_net_netdrv_dl_writev_s.grant;
        dep->de_write_iovec.iod_iovec_offset = 0;
        size = calc_iovec_size(&dep->de_write_iovec);
        if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE)
@@ -401,10 +401,10 @@ static void do_vread_s(const message * mp)
                panic("read already in progress");
 
        dep->de_read_iovec.iod_proc_nr = mp->m_source;
-       get_userdata_s(mp->m_source, (cp_grant_id_t) mp->DL_GRANT, 0,
-               mp->DL_COUNT, dep->de_read_iovec.iod_iovec);
-       dep->de_read_iovec.iod_iovec_s = mp->DL_COUNT;
-       dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
+       get_userdata_s(mp->m_source, mp->m_net_netdrv_dl_readv_s.grant, 0,
+               mp->m_net_netdrv_dl_readv_s.count, dep->de_read_iovec.iod_iovec);
+       dep->de_read_iovec.iod_iovec_s = mp->m_net_netdrv_dl_readv_s.count;
+       dep->de_read_iovec.iod_grant = mp->m_net_netdrv_dl_readv_s.grant;
        dep->de_read_iovec.iod_iovec_offset = 0;
        size = calc_iovec_size(&dep->de_read_iovec);
        if (size < ETH_MAX_PACK_SIZE) panic(SizeErrMsg, size);
index 69bd47b0dfad63237193db25e21803e97a395633..64cbf1720a53ee065d5834f5bdc843c087d784fe 100644 (file)
@@ -607,15 +607,16 @@ int from_int;
        e->status |= E1000_WRITING;
 
        /* Must be a sane vector count. */
-       assert(e->tx_message.DL_COUNT > 0);
-       assert(e->tx_message.DL_COUNT < E1000_IOVEC_NR);
+       assert(e->tx_message.m_net_netdrv_dl_writev_s.count > 0);
+       assert(e->tx_message.m_net_netdrv_dl_writev_s.count < E1000_IOVEC_NR);
 
        /*
         * Copy the I/O vector table.
         */
        if ((r = sys_safecopyfrom(e->tx_message.m_source,
-                                 e->tx_message.DL_GRANT, 0,
-                                 (vir_bytes) iovec, e->tx_message.DL_COUNT *
+                                 e->tx_message.m_net_netdrv_dl_writev_s.grant, 0,
+                                 (vir_bytes) iovec,
+                                 e->tx_message.m_net_netdrv_dl_writev_s.count *
                                  sizeof(iovec_s_t))) != OK)
        {
            panic("sys_safecopyfrom() failed: %d", r);
@@ -629,7 +630,7 @@ int from_int;
                         e->name, head, tail));
 
        /* Loop vector elements. */
-       for (i = 0; i < e->tx_message.DL_COUNT; i++)
+       for (i = 0; i < e->tx_message.m_net_netdrv_dl_writev_s.count; i++)
        {
            size = iovec[i].iov_size < (E1000_IOBUF_SIZE - bytes) ?
                   iovec[i].iov_size : (E1000_IOBUF_SIZE - bytes);
@@ -651,7 +652,7 @@ int from_int;
            desc->length  = size;
 
            /* Marks End-of-Packet. */
-           if (i == e->tx_message.DL_COUNT - 1)
+           if (i == e->tx_message.m_net_netdrv_dl_writev_s.count - 1)
            {
                desc->command = E1000_TX_CMD_EOP |
                                E1000_TX_CMD_FCS |
@@ -696,8 +697,8 @@ int from_int;
        e->status    |= E1000_READING;
        e->rx_size    = 0;
        
-       assert(e->rx_message.DL_COUNT > 0);
-       assert(e->rx_message.DL_COUNT < E1000_IOVEC_NR);
+       assert(e->rx_message.m_net_netdrv_dl_readv_s.count > 0);
+       assert(e->rx_message.m_net_netdrv_dl_readv_s.count < E1000_IOVEC_NR);
     }
     if (e->status & E1000_READING)
     {
@@ -705,8 +706,9 @@ int from_int;
         * Copy the I/O vector table first.
         */
        if ((r = sys_safecopyfrom(e->rx_message.m_source,
-                                 e->rx_message.DL_GRANT, 0,
-                                 (vir_bytes) iovec, e->rx_message.DL_COUNT *
+                                 e->rx_message.m_net_netdrv_dl_readv_s.grant, 0,
+                                 (vir_bytes) iovec,
+                                 e->rx_message.m_net_netdrv_dl_readv_s.count *
                                  sizeof(iovec_s_t))) != OK)
        {
            panic("sys_safecopyfrom() failed: %d", r);
@@ -731,7 +733,8 @@ int from_int;
        /*
         * Copy to vector elements.
         */    
-       for (i = 0; i < e->rx_message.DL_COUNT && bytes < desc->length; i++)
+       for (i = 0; i < e->rx_message.m_net_netdrv_dl_readv_s.count &&
+               bytes < desc->length; i++)
        {
            size = iovec[i].iov_size < (desc->length - bytes) ?
                   iovec[i].iov_size : (desc->length - bytes);
index c56588892fb3391c691ce5d6857f39323b4f913e..90ec370b64918fd7c4d374a52410174e920a63ea 100644 (file)
@@ -938,7 +938,7 @@ static void fxp_writev_s(const message *mp, int from_int)
 
        fp= fxp_state;
 
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_writev_s.count;
        fp->fxp_client= mp->m_source;
 
        assert(fp->fxp_mode == FM_ENABLED);
@@ -982,7 +982,7 @@ static void fxp_writev_s(const message *mp, int from_int)
        assert(!(fp->fxp_flags & FF_PACK_SENT));
 
        iov_endpt= mp->m_source;
-       iov_grant= mp->DL_GRANT;
+       iov_grant= mp->m_net_netdrv_dl_writev_s.grant;
 
        size= 0;
        o= 0;
@@ -1081,7 +1081,7 @@ int from_int;
 
        fp= fxp_state;
 
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_readv_s.count;
        fp->fxp_client= mp->m_source;
 
        assert(fp->fxp_mode == FM_ENABLED);
@@ -1117,7 +1117,7 @@ int from_int;
        packlen= rfd_res & RFDSZ_SIZE;
 
        iov_endpt = mp->m_source;
-       iov_grant = mp->DL_GRANT;
+       iov_grant = mp->m_net_netdrv_dl_readv_s.grant;
 
        size= 0;
        o= 0;
index 5918b65e05fa74c1dad6203b472d9b405205c9bf..9eac5d6985403c96f472b9a26f261b1db715fe89 100644 (file)
@@ -254,7 +254,7 @@ message *m;
        reply.m_type = DL_CONF_REPLY;
        reply.m_netdrv_net_dl_conf.stat = OK;
        memcpy(reply.m_netdrv_net_dl_conf.hw_addr,
-               lan8710a_state.address,
+               lan8710a_state.address.ea_addr,
                sizeof(reply.m_netdrv_net_dl_conf.hw_addr));
        mess_reply(m, &reply);
 }
@@ -849,15 +849,17 @@ int from_int;
                e->status |= LAN8710A_WRITING;
 
                /* verify vector count */
-               assert(mp->DL_COUNT > 0);
-               assert(mp->DL_COUNT < LAN8710A_IOVEC_NR);
+               assert(mp->m_net_netdrv_dl_writev_s.count > 0);
+               assert(mp->m_net_netdrv_dl_writev_s.count < LAN8710A_IOVEC_NR);
 
                /*
                 * Copy the I/O vector table.
                 */
-               if ((r = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, 0,
+               if ((r = sys_safecopyfrom(mp->m_source,
+                               mp->m_net_netdrv_dl_writev_s.grant, 0,
                                (vir_bytes) iovec,
-                               mp->DL_COUNT * sizeof(iovec_s_t))) != OK) {
+                               mp->m_net_netdrv_dl_writev_s.count *
+                               sizeof(iovec_s_t))) != OK) {
                        panic("sys_safecopyfrom() failed: %d", r);
                }
                /* setup descriptors */
@@ -874,7 +876,7 @@ int from_int;
                /* virtual address of buffer */
                p_buf = e->p_tx_buf + e->tx_desc_idx * LAN8710A_IOBUF_SIZE;
                buf_data_len = 0;
-               for (i = 0; i < mp->DL_COUNT; i++) {
+               for (i = 0; i < mp->m_net_netdrv_dl_writev_s.count; i++) {
                        if ((buf_data_len + iovec[i].iov_size)
                             > LAN8710A_IOBUF_SIZE) {
                                panic("packet too long");
@@ -943,16 +945,17 @@ int from_int;
                e->status |= LAN8710A_READING;
                e->rx_size = 0;
 
-               assert(e->rx_message.DL_COUNT > 0);
-               assert(e->rx_message.DL_COUNT < LAN8710A_IOVEC_NR);
+               assert(e->rx_message.m_net_netdrv_dl_readv_s.count > 0);
+               assert(e->rx_message.m_net_netdrv_dl_readv_s.count < LAN8710A_IOVEC_NR);
        }
        if (e->status & LAN8710A_READING) {
                /*
                 * Copy the I/O vector table first.
                 */
                if ((r = sys_safecopyfrom(e->rx_message.m_source,
-                               e->rx_message.DL_GRANT, 0, (vir_bytes) iovec,
-                               e->rx_message.DL_COUNT *
+                               e->rx_message.m_net_netdrv_dl_readv_s.grant, 0,
+                               (vir_bytes) iovec,
+                               e->rx_message.m_net_netdrv_dl_readv_s.count *
                                    sizeof(iovec_s_t))) != OK) {
                        panic("sys_safecopyfrom() failed: %d", r);
                }
@@ -987,7 +990,7 @@ int from_int;
                pkt_data_len = 0;
                buf_bytes = 0;
                p_buf = e->p_rx_buf + e->rx_desc_idx * LAN8710A_IOBUF_SIZE;
-               for (i = 0; i < e->rx_message.DL_COUNT; i++) {
+               for (i = 0; i < e->rx_message.m_net_netdrv_dl_readv_s.count; i++) {
                        buf_len = p_rx_desc->buffer_length_off & 0xFFFF;
                        if (buf_bytes == buf_len) {
                                /* Whole buffer move to the next descriptor */
index ecbf9d6420d208574e7711e39cab716ecb46ec7f..cf86f9d9e92c91570b02f13b52f524377f066159 100644 (file)
@@ -1006,9 +1006,9 @@ static void do_vread_s(const message *mp)
    ec= &ec_state;
 
    ec->client= mp->m_source;
-   count = mp->DL_COUNT;
+   count = mp->m_net_netdrv_dl_readv_s.count;
 
-   r = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, 0,
+   r = sys_safecopyfrom(mp->m_source, mp->m_net_netdrv_dl_readv_s.grant, 0,
                         (vir_bytes)ec->read_iovec.iod_iovec,
                         (count > IOVEC_NR ? IOVEC_NR : count) *
                         sizeof(iovec_s_t));
@@ -1016,7 +1016,7 @@ static void do_vread_s(const message *mp)
        panic("do_vread_s: sys_safecopyfrom failed: %d", r);
    ec->read_iovec.iod_iovec_s    = count;
    ec->read_iovec.iod_proc_nr    = mp->m_source;
-   ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT;
+   ec->read_iovec.iod_grant = mp->m_net_netdrv_dl_readv_s.grant;
    ec->read_iovec.iod_iovec_offset = 0;
 
    ec->tmp_iovec = ec->read_iovec;
@@ -1114,7 +1114,7 @@ int from_int;
    ec = &ec_state;
 
    ec->client= mp->m_source;
-   count = mp->DL_COUNT;
+   count = mp->m_net_netdrv_dl_writev_s.count;
 
    if (isstored[tx_slot_nr]==1)
    {
@@ -1126,7 +1126,7 @@ int from_int;
    }
 
    /* convert the message to write_iovec */
-   r = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, 0,
+   r = sys_safecopyfrom(mp->m_source, mp->m_net_netdrv_dl_writev_s.grant, 0,
                         (vir_bytes)ec->write_iovec.iod_iovec,
                         (count > IOVEC_NR ? IOVEC_NR : count) *
                         sizeof(iovec_s_t));
@@ -1134,7 +1134,7 @@ int from_int;
        panic("do_vwrite_s: sys_safecopyfrom failed: %d", r);
    ec->write_iovec.iod_iovec_s    = count;
    ec->write_iovec.iod_proc_nr    = mp->m_source;
-   ec->write_iovec.iod_grant      = mp->DL_GRANT;
+   ec->write_iovec.iod_grant      = mp->m_net_netdrv_dl_writev_s.grant;
    ec->write_iovec.iod_iovec_offset = 0;
 
    ec->tmp_iovec = ec->write_iovec;
index 62ec3ce2fad2503c4581147168d4fa48a463f64b..0c053eb7e5a4fa4335916efeb401cb8abbe3c686 100644 (file)
@@ -1165,7 +1165,7 @@ static void or_writev_s (message * mp, int from_int) {
 
        orp = &or_state;
 
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_writev_s.count;
 
        orp->or_client = mp->m_source;
        hw = &(orp->hw);
@@ -1210,7 +1210,8 @@ static void or_writev_s (message * mp, int from_int) {
                if (i + n > count)
                        n = count - i;
 
-               cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
+               cps = sys_safecopyfrom(mp->m_source,
+                       mp->m_net_netdrv_dl_writev_s.grant, iov_offset,
                        (vir_bytes) orp->or_iovec_s, 
                        n * sizeof(orp->or_iovec_s[0]));
                if (cps != OK) 
@@ -1563,7 +1564,7 @@ static void or_readv_s (message * mp, int from_int)
        orp = &or_state;
 
        orp->or_client = mp->m_source;
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_readv_s.count;
 
        assert (orp->or_mode == OR_M_ENABLED);
        assert (orp->or_flags & OR_F_ENABLED);
@@ -1601,7 +1602,8 @@ static void or_readv_s (message * mp, int from_int)
                if (i + n > count)
                        n = count - i;
 
-               cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset, 
+               cps = sys_safecopyfrom(mp->m_source,
+                               mp->m_net_netdrv_dl_readv_s.grant, iov_offset,
                                (vir_bytes)orp->or_iovec_s,
                                n * sizeof(orp->or_iovec_s[0]));
                if (cps != OK) 
index bdf2c76c7de72f320af00463b5d39430fd7e5ee0..a71f460908eb9dfc6ce09b6bf81c74e19007352b 100644 (file)
@@ -781,7 +781,7 @@ static void rl_readv_s(const message *mp, int from_int)
        rep= &re_state;
 
        rep->re_client= mp->m_source;
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_readv_s.count;
 
        if (rep->re_clear_rx)
                goto suspend;   /* Buffer overflow */
@@ -871,7 +871,8 @@ static void rl_readv_s(const message *mp, int from_int)
                if (i+n > count)
                        n= count-i;
 
-               cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
+               cps = sys_safecopyfrom(mp->m_source,
+                       mp->m_net_netdrv_dl_readv_s.grant, iov_offset,
                        (vir_bytes) rep->re_iovec_s,
                        n * sizeof(rep->re_iovec_s[0]));
                if (cps != OK) {
@@ -1003,7 +1004,7 @@ static void rl_writev_s(const message *mp, int from_int)
        rep= &re_state;
 
        rep->re_client= mp->m_source;
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_writev_s.count;
 
        assert(rep->re_mode == REM_ENABLED);
        assert(rep->re_flags & REF_ENABLED);
@@ -1035,7 +1036,8 @@ static void rl_writev_s(const message *mp, int from_int)
                n= IOVEC_NR;
                if (i+n > count)
                        n= count-i;
-               cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
+               cps = sys_safecopyfrom(mp->m_source,
+                       mp->m_net_netdrv_dl_writev_s.grant, iov_offset,
                        (vir_bytes) rep->re_iovec_s,
                        n * sizeof(rep->re_iovec_s[0]));
                if (cps != OK) {
index 76cdf2ce0731fff57f0e944542dade3d3c1abf1d..420736e30443e6dbc17cb69b10d08a3e4c0861f1 100644 (file)
@@ -1168,7 +1168,7 @@ static void rl_readv_s(const message *mp, int from_int)
        rep = &re_state;
 
        rep->re_client = mp->m_source;
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_readv_s.count;
 
        assert(rep->re_mode == REM_ENABLED);
        assert(rep->re_flags & REF_ENABLED);
@@ -1228,7 +1228,8 @@ readvs_loop:
                n = IOVEC_NR;
                if (i + n > count)
                        n = count-i;
-               cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
+               cps = sys_safecopyfrom(mp->m_source,
+                       mp->m_net_netdrv_dl_readv_s.grant, iov_offset,
                        (vir_bytes) rep->re_iovec_s,
                        n * sizeof(rep->re_iovec_s[0]));
                if (cps != OK) {
@@ -1307,7 +1308,7 @@ static void rl_writev_s(const message *mp, int from_int)
        rep = &re_state;
 
        rep->re_client = mp->m_source;
-       count = mp->DL_COUNT;
+       count = mp->m_net_netdrv_dl_writev_s.count;
        assert(rep->setup);
 
        assert(rep->re_mode == REM_ENABLED);
@@ -1364,7 +1365,8 @@ static void rl_writev_s(const message *mp, int from_int)
                n = IOVEC_NR;
                if (i + n > count)
                        n = count - i;
-               cps = sys_safecopyfrom(mp->m_source, mp->DL_GRANT, iov_offset,
+               cps = sys_safecopyfrom(mp->m_source,
+                       mp->m_net_netdrv_dl_writev_s.grant, iov_offset,
                        (vir_bytes) rep->re_iovec_s,
                        n * sizeof(rep->re_iovec_s[0]));
                if (cps != OK) {
index 5afb6db67ebd3bba38c0498259bd3c43582d9d33..e7daa1a6e97c3a677495a5c4691d89493219ff48 100644 (file)
@@ -90,7 +90,8 @@ static void virtio_net_refill_rx_queue(void);
 static void virtio_net_check_queues(void);
 static void virtio_net_check_pending(void);
 
-static void virtio_net_fetch_iovec(iovec_s_t *iov, message *m);
+static void virtio_net_fetch_iovec(iovec_s_t *iov, message *m,
+       cp_grant_id_t grant, size_t count);
 static int virtio_net_cpy_to_user(message *m);
 static int virtio_net_cpy_from_user(message *m);
 
@@ -318,11 +319,11 @@ virtio_net_check_pending(void)
 }
 
 static void
-virtio_net_fetch_iovec(iovec_s_t *iov, message *m)
+virtio_net_fetch_iovec(iovec_s_t *iov, message *m, cp_grant_id_t grant, size_t count)
 {
        int r;
-       r = sys_safecopyfrom(m->m_source, m->DL_GRANT, 0, (vir_bytes)iov,
-                            m->DL_COUNT * sizeof(iov[0]));
+       r = sys_safecopyfrom(m->m_source, grant, 0, (vir_bytes)iov,
+               count * sizeof(iov[0]));
 
        if (r != OK)
                panic("%s: iovec fail for %d (%d)", name, m->m_source, r);
@@ -344,9 +345,10 @@ virtio_net_cpy_to_user(message *m)
        p = STAILQ_FIRST(&recv_list);
        STAILQ_REMOVE_HEAD(&recv_list, next);
 
-       virtio_net_fetch_iovec(iovec, m);
+       virtio_net_fetch_iovec(iovec, m, m->m_net_netdrv_dl_readv_s.grant,
+                m->m_net_netdrv_dl_readv_s.count);
 
-       for (i = 0; i < m->DL_COUNT && left > 0; i++) {
+       for (i = 0; i < m->m_net_netdrv_dl_readv_s.count && left > 0; i++) {
                ivsz = iovec[i].iov_size;
                size = left > ivsz ? ivsz : left;
                r = sys_safecopyto(m->m_source, iovec[i].iov_grant, 0,
@@ -429,11 +431,12 @@ virtio_net_cpy_from_user(message *m)
        p = STAILQ_FIRST(&free_list);
        STAILQ_REMOVE_HEAD(&free_list, next);
 
-       virtio_net_fetch_iovec(iovec, m);
+       virtio_net_fetch_iovec(iovec, m, m->m_net_netdrv_dl_writev_s.grant,
+                m->m_net_netdrv_dl_writev_s.count);
 
-       r = sys_easy_vsafecopy_from(m->m_source, iovec, m->DL_COUNT,
-                                   (vir_bytes)p->vdata, MAX_PACK_SIZE,
-                                   &bytes);
+       r = sys_easy_vsafecopy_from(m->m_source, iovec,
+               m->m_net_netdrv_dl_writev_s.count, (vir_bytes)p->vdata,
+               MAX_PACK_SIZE, &bytes);
 
        if (r != OK)
                panic("%s: copy from %d failed", name, m->m_source);
index 26207dd92b0b16b4e389546768db2f0bc885451a..488baea8e35760dd9bcdd894a2b279403a668ba2 100644 (file)
 #define DL_STAT_REPLY  (DL_RS_BASE + 1)
 #define DL_TASK_REPLY  (DL_RS_BASE + 2)
 
-/* Field names for data link layer messages. */
-#define DL_COUNT       m2_i3
-#define DL_GRANT       m2_l2
-
 /* Bits in 'flags' field of DL replies. */
 #  define DL_NOFLAGS           0x00
 #  define DL_PACK_SEND         0x01
index 9b783817f62e82c99cab80738fbb37e36f65816b..666507ddc5867d32bfae91029fd8db134c287d7c 100644 (file)
@@ -835,6 +835,22 @@ typedef struct {
 } mess_net_netdrv_dl_getstat_s;
 _ASSERT_MSG_SIZE(mess_net_netdrv_dl_getstat_s);
 
+typedef struct {
+       cp_grant_id_t grant;
+       int count;
+
+       uint8_t padding[48];
+} mess_net_netdrv_dl_readv_s;
+_ASSERT_MSG_SIZE(mess_net_netdrv_dl_readv_s);
+
+typedef struct {
+       cp_grant_id_t grant;
+       int count;
+
+       uint8_t padding[48];
+} mess_net_netdrv_dl_writev_s;
+_ASSERT_MSG_SIZE(mess_net_netdrv_dl_writev_s);
+
 typedef struct {
        int count;
        uint32_t flags;
@@ -1425,6 +1441,8 @@ typedef struct {
 
                mess_net_netdrv_dl_conf m_net_netdrv_dl_conf;
                mess_net_netdrv_dl_getstat_s m_net_netdrv_dl_getstat_s;
+               mess_net_netdrv_dl_readv_s m_net_netdrv_dl_readv_s;
+               mess_net_netdrv_dl_writev_s m_net_netdrv_dl_writev_s;
 
                mess_netdrv_net_dl_conf m_netdrv_net_dl_conf;
                mess_netdrv_net_dl_task m_netdrv_net_dl_task;
index c1777f4ad6824f27e1eb5d35c0b886607303d1a7..bc4fc25445fcbc97049c1cd9b14e6f43a5c72e69 100644 (file)
@@ -555,8 +555,8 @@ eth_port_t *eth_port;
                        errno));
        }
        m.m_type= DL_WRITEV_S;
-       m.DL_COUNT= i;
-       m.DL_GRANT= eth_port->etp_osdep.etp_wr_vec_grant;
+       m.m_net_netdrv_dl_writev_s.count= i;
+       m.m_net_netdrv_dl_writev_s.grant= eth_port->etp_osdep.etp_wr_vec_grant;
 
        assert(eth_port->etp_osdep.etp_state == OEPS_IDLE);
        r= asynsend(eth_port->etp_osdep.etp_task, &m);
@@ -721,8 +721,8 @@ eth_port_t *eth_port;
        }
 
        mess.m_type= DL_READV_S;
-       mess.DL_COUNT= i;
-       mess.DL_GRANT= eth_port->etp_osdep.etp_rd_vec_grant;
+       mess.m_net_netdrv_dl_readv_s.count= i;
+       mess.m_net_netdrv_dl_readv_s.grant= eth_port->etp_osdep.etp_rd_vec_grant;
 
        assert(eth_port->etp_osdep.etp_state == OEPS_IDLE);
 
index 3674b4a6ed4f9dc3f0fb15f9d8a00eb5592330ce..d5c69445e0628a05d4c977d24399f8d0c774fbae 100644 (file)
@@ -147,8 +147,8 @@ static void driver_setup_read(struct nic * nic)
        nic->rx_iovec[0].iov_size = nic->rx_pbuf->len;
 
        m.m_type = DL_READV_S;
-       m.DL_COUNT = 1;
-       m.DL_GRANT = nic->rx_iogrant;
+       m.m_net_netdrv_dl_readv_s.count = 1;
+       m.m_net_netdrv_dl_readv_s.grant = nic->rx_iogrant;
 
        if (asynsend(nic->drv_ep, &m) != OK)
                panic("asynsend to the driver failed!");
@@ -209,8 +209,8 @@ int driver_tx(struct nic * nic)
                panic("Failed to set grant");
 
        m.m_type = DL_WRITEV_S;
-       m.DL_COUNT = 1;
-       m.DL_GRANT = nic->tx_iogrant;
+       m.m_net_netdrv_dl_writev_s.count = 1;
+       m.m_net_netdrv_dl_writev_s.grant = nic->tx_iogrant;
 
        if (asynsend(nic->drv_ep, &m) != OK)
                panic("asynsend to the driver failed!");