- ethinf transmit queue full notification added
This commit is contained in:
parent
c269f4a8bd
commit
d8a657a88d
@ -85,35 +85,35 @@ static ThreadReturnType task_ethintf(ThreadParamType param) {
|
|||||||
|
|
||||||
// act accordingly...
|
// act accordingly...
|
||||||
switch (event_code) {
|
switch (event_code) {
|
||||||
case ETH_IIE_RECV_NOTIFY: {
|
case ETH_IIE_RECV_NOTIFY: {
|
||||||
intf->ioDef->llRxRead(intf->ioDef); // read packets, will invoke RxStore
|
intf->ioDef->llRxRead(intf->ioDef); // read packets, will invoke RxStore
|
||||||
while (mq_avail(intf->rxQ) > 0) {
|
while (mq_avail(intf->rxQ) > 0) {
|
||||||
RawPckt rawPckt = mq_top(intf->rxQ);
|
RawPckt rawPckt = mq_top(intf->rxQ);
|
||||||
mq_pop(intf->rxQ);
|
mq_pop(intf->rxQ);
|
||||||
packsieve_input(&intf->sieve, &rawPckt);
|
packsieve_input(&intf->sieve, &rawPckt);
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case ETH_IIE_LINK_CHG_NOTIFY: {
|
||||||
|
bool ls = event_data;
|
||||||
|
ethinf_set_link_state(intf, ls);
|
||||||
|
|
||||||
|
if (intf->dhcp != NULL) {
|
||||||
|
if (ls) { // if link is on
|
||||||
|
dhcp_start(intf->dhcp);
|
||||||
|
} else { // if link is off
|
||||||
|
dhcp_stop(intf->dhcp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} break;
|
MSG("ETH LINK: %s%s\n", (ls ? (ANSI_COLOR_BGREEN "UP") : (ANSI_COLOR_BRED "DOWN")), ANSI_COLOR_RESET);
|
||||||
case ETH_IIE_LINK_CHG_NOTIFY: {
|
} break;
|
||||||
bool ls = event_data;
|
case ETH_IIE_TRANSMIT_NOTIFY: {
|
||||||
ethinf_set_link_state(intf, ls);
|
intf->ioDef->llTxTrigger(intf->ioDef, intf->txQ);
|
||||||
|
} break;
|
||||||
if (intf->dhcp != NULL) {
|
default:
|
||||||
if (ls) { // if link is on
|
MSG("UNKNOWN event!\n");
|
||||||
dhcp_start(intf->dhcp);
|
break;
|
||||||
} else { // if link is off
|
|
||||||
dhcp_stop(intf->dhcp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MSG("ETH LINK: %s%s\n", (ls ? (ANSI_COLOR_BGREEN "UP") : (ANSI_COLOR_BRED "DOWN")), ANSI_COLOR_RESET);
|
|
||||||
} break;
|
|
||||||
case ETH_IIE_TRANSMIT_NOTIFY: {
|
|
||||||
intf->ioDef->llTxTrigger(intf->ioDef, intf->txQ);
|
|
||||||
} break;
|
|
||||||
default:
|
|
||||||
MSG("UNKNOWN event!\n");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,8 +127,11 @@ void ethinf_receive(EthInterface *intf, const RawPckt *rawPckt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ethinf_transmit(EthInterface *intf, const RawPckt *rawPckt) {
|
void ethinf_transmit(EthInterface *intf, const RawPckt *rawPckt) {
|
||||||
mq_push(intf->txQ, rawPckt); // push packet onto the message queue
|
if (mq_push(intf->txQ, rawPckt)) { // push packet onto the message queue
|
||||||
ethinf_push_notification(intf, ETH_IIE_TRANSMIT_NOTIFY, 0); // notify processing thread of the peding transmit
|
ethinf_push_notification(intf, ETH_IIE_TRANSMIT_NOTIFY, 0); // notify processing thread of the peding transmit
|
||||||
|
} else {
|
||||||
|
ERROR("Interface transmit queue full!\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ethinf_push_notification(EthInterface *intf, uint16_t event_code, uint16_t event_data) {
|
void ethinf_push_notification(EthInterface *intf, uint16_t event_code, uint16_t event_data) {
|
||||||
@ -148,7 +151,7 @@ void ethinf_pull_notification(EthInterface *intf, uint16_t *event_code, uint16_t
|
|||||||
*event_code = cpd & 0xFFFF;
|
*event_code = cpd & 0xFFFF;
|
||||||
*event_data = (cpd >> 16) & 0xFFFF;
|
*event_data = (cpd >> 16) & 0xFFFF;
|
||||||
|
|
||||||
//MSG("EC: %d\n", *event_code);
|
// MSG("EC: %d\n", *event_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ethinf_set_capabilities(EthInterface *intf, uint32_t cap) {
|
void ethinf_set_capabilities(EthInterface *intf, uint32_t cap) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user