From: Lionel Sambuc Date: Tue, 20 May 2014 09:19:27 +0000 (+0200) Subject: Message type for DL_{READ,WRITE}V_S X-Git-Tag: v3.3.0~232 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/readme1st.txt?a=commitdiff_plain;h=1576ef55421315cf52dd56a01378eb10d676852b;p=minix.git Message type for DL_{READ,WRITE}V_S Change-Id: I6e25e8e994b0bdec2bb54f50e6db08e6e935c819 --- diff --git a/drivers/atl2/atl2.c b/drivers/atl2/atl2.c index 747969d9a..b07e3536c 100644 --- a/drivers/atl2/atl2.c +++ b/drivers/atl2/atl2.c @@ -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); diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index fedcd8c4b..4ab0d5e40 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -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) diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index 091c314c8..3d23db40b 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -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; diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 8a56cfb41..9ed770fcd 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -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); diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index 69bd47b0d..64cbf1720 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -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); diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index c56588892..90ec370b6 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -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; diff --git a/drivers/lan8710a/lan8710a.c b/drivers/lan8710a/lan8710a.c index 5918b65e0..9eac5d698 100644 --- a/drivers/lan8710a/lan8710a.c +++ b/drivers/lan8710a/lan8710a.c @@ -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 */ diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index ecbf9d642..cf86f9d9e 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -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; diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index 62ec3ce2f..0c053eb7e 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -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) diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index bdf2c76c7..a71f46090 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -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) { diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index 76cdf2ce0..420736e30 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -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) { diff --git a/drivers/virtio_net/virtio_net.c b/drivers/virtio_net/virtio_net.c index 5afb6db67..e7daa1a6e 100644 --- a/drivers/virtio_net/virtio_net.c +++ b/drivers/virtio_net/virtio_net.c @@ -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); diff --git a/include/minix/com.h b/include/minix/com.h index 26207dd92..488baea8e 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -178,10 +178,6 @@ #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 diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 9b783817f..666507ddc 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -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; diff --git a/servers/inet/mnx_eth.c b/servers/inet/mnx_eth.c index c1777f4ad..bc4fc2544 100644 --- a/servers/inet/mnx_eth.c +++ b/servers/inet/mnx_eth.c @@ -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); diff --git a/servers/lwip/driver.c b/servers/lwip/driver.c index 3674b4a6e..d5c69445e 100644 --- a/servers/lwip/driver.c +++ b/servers/lwip/driver.c @@ -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!");