Revision 4f1c942b hw/eepro100.c
b/hw/eepro100.c | ||
---|---|---|
1441 | 1441 |
//~ return !eepro100_buffer_full(s); |
1442 | 1442 |
} |
1443 | 1443 |
|
1444 |
static void nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
|
|
1444 |
static ssize_t nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
|
|
1445 | 1445 |
{ |
1446 | 1446 |
/* TODO: |
1447 | 1447 |
* - Magic packets should set bit 30 in power management driver register. |
... | ... | |
1458 | 1458 |
if (s->configuration[8] & 0x80) { |
1459 | 1459 |
/* CSMA is disabled. */ |
1460 | 1460 |
logout("%p received while CSMA is disabled\n", s); |
1461 |
return; |
|
1461 |
return -1;
|
|
1462 | 1462 |
} else if (size < 64 && (s->configuration[7] & 1)) { |
1463 | 1463 |
/* Short frame and configuration byte 7/0 (discard short receive) set: |
1464 | 1464 |
* Short frame is discarded */ |
1465 | 1465 |
logout("%p received short frame (%d byte)\n", s, size); |
1466 | 1466 |
s->statistics.rx_short_frame_errors++; |
1467 |
//~ return; |
|
1467 |
//~ return -1;
|
|
1468 | 1468 |
} else if ((size > MAX_ETH_FRAME_SIZE + 4) && !(s->configuration[18] & 8)) { |
1469 | 1469 |
/* Long frame and configuration byte 18/3 (long receive ok) not set: |
1470 | 1470 |
* Long frames are discarded. */ |
1471 | 1471 |
logout("%p received long frame (%d byte), ignored\n", s, size); |
1472 |
return; |
|
1472 |
return -1;
|
|
1473 | 1473 |
} else if (memcmp(buf, s->macaddr, 6) == 0) { // !!! |
1474 | 1474 |
/* Frame matches individual address. */ |
1475 | 1475 |
/* TODO: check configuration byte 15/4 (ignore U/L). */ |
... | ... | |
1485 | 1485 |
assert(!(s->configuration[21] & BIT(3))); |
1486 | 1486 |
int mcast_idx = compute_mcast_idx(buf); |
1487 | 1487 |
if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) { |
1488 |
return; |
|
1488 |
return size;
|
|
1489 | 1489 |
} |
1490 | 1490 |
rfd_status |= 0x0002; |
1491 | 1491 |
} else if (s->configuration[15] & 1) { |
... | ... | |
1495 | 1495 |
} else { |
1496 | 1496 |
logout("%p received frame, ignored, len=%d,%s\n", s, size, |
1497 | 1497 |
nic_dump(buf, size)); |
1498 |
return; |
|
1498 |
return size;
|
|
1499 | 1499 |
} |
1500 | 1500 |
|
1501 | 1501 |
if (get_ru_state(s) != ru_ready) { |
... | ... | |
1503 | 1503 |
logout("no ressources, state=%u\n", get_ru_state(s)); |
1504 | 1504 |
s->statistics.rx_resource_errors++; |
1505 | 1505 |
//~ assert(!"no ressources"); |
1506 |
return; |
|
1506 |
return -1;
|
|
1507 | 1507 |
} |
1508 | 1508 |
//~ !!! |
1509 | 1509 |
//~ $3 = {status = 0x0, command = 0xc000, link = 0x2d220, rx_buf_addr = 0x207dc, count = 0x0, size = 0x5f8, packet = {0x0 <repeats 1518 times>}} |
... | ... | |
1540 | 1540 |
/* S bit is set. */ |
1541 | 1541 |
set_ru_state(s, ru_suspended); |
1542 | 1542 |
} |
1543 |
return size; |
|
1543 | 1544 |
} |
1544 | 1545 |
|
1545 | 1546 |
static int nic_load(QEMUFile * f, void *opaque, int version_id) |
Also available in: Unified diff