Message type for DL_TASK_REPLY
Change-Id: I7f15f8f874366e93866f53d7a60a0c7ef9c98636
This commit is contained in:
parent
079646e056
commit
992b76139f
16 changed files with 73 additions and 65 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1159,15 +1159,16 @@ 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 ?
|
||||
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. */
|
||||
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue