In my application, there are three instances of the ethernet server full for three separate ports on three separate tiles.
On on port/tile, I have modified the mii_filter.xc file to essentially operate in promiscuous mode by setting the filter result to 1 on every packet received. The mac_set_custom_filter is set with a value of 1.
So the problem is that packets are being received by the mii_rx_pins task and the mii_filter task because I have set up a debug printf statement in the mii filter task.
However they are not getting forwarded to the rx client by the ethernet_rx_server task.
Code: Select all
for (unsigned p=0; p<NUM_ETHERNET_PORTS; ++p) {
int buf = mii_get_my_next_buf(rxmem_lp[p], rdptr_lp[p]);
if (buf != 0 && mii_packet_get_stage(buf) == 1) {
rdptr_lp[p] = mii_update_my_rdptr(rxmem_lp[p], rdptr_lp[p]);
process_received_frame(buf, link, num_link, p);
break;
Code: Select all
mii_buffer_t mii_get_my_next_buf(mii_mempool_t mempool, int rdptr0)
{
mempool_info_t *info = (mempool_info_t *) mempool;
int *rdptr = (int *) rdptr0;
int *wrptr = info->wrptr;
if (rdptr == wrptr)
return 0;
return (mii_buffer_t) ((char *) rdptr + sizeof(malloc_hdr_t));
}
So even though I am getting packets, the server seems to be saying that there are no packets in the buffer.
Can someone explain how the rx_server routine works or what the problem might be.
Basically, I want to bypass all filtering and just have one ethernet rx client get all packets from the port. Can I change the rx_server code to do this.
Can someone tell me what this section of code in the rx server does?
Code: Select all
case (int i=0;i<num_link;i++) service_link_cmd(link[i], i, cmd):
if (cmd == ETHERNET_RX_FRAME_REQ ||
cmd == ETHERNET_RX_TYPE_PAYLOAD_REQ ||
cmd == ETHERNET_RX_FRAME_REQ_OFFSET2)
{
int rdIndex = link_status[i].rdIndex;
int wrIndex = link_status[i].wrIndex;
int new_rdIndex;
if (link_status[i].wants_status_updates == 2) {
// This currently only works for single master port implementations
int status = ethernet_get_link_status(0);
send_status_packet(link[i], 0, status);
link_status[i].wants_status_updates = 1;
if (rdIndex != wrIndex) {
notify(link[i]);
}
else {
link_status[i].notified = 0;
}
}
else {
if (rdIndex != wrIndex) {
int buf = link_status[i].fifo[rdIndex];
new_rdIndex=rdIndex+1;
new_rdIndex *= (new_rdIndex != NUM_MII_RX_BUF);
mac_rx_send_frame1(buf, link[i], cmd);
if (get_and_dec_transmit_count(buf)==0)
{
mii_free(buf);
}
link_status[i].rdIndex = new_rdIndex;
if (new_rdIndex != wrIndex) {
notify(link[i]);
}
else {
link_status[i].notified = 0;
}
}
else {
// mac request without notification
}
}
}
break;