Hi, Thank you for your reply. Annexed to this you will find the final part of the source code of function fxp_start with the changes I have made. I hope the comments in the code are clear enough. The idea is to read and modify the mbufs right before they go to the wire, although I haven't yet written this code. So far I am just trying to read the contents of the mbufs (first six bytes of m_data). Kind Regards, Marcus. Bosko Milekic wrote: > Hi, > > Please show us how you're manipulating the mbufs. > You should not be getting page faults unless you're doing > something wrong. > A good idea would also be to check the fault virtual > address and enable debugging support in your kernel in order > to be able to analyze the situation as much as you can. > > Regards, > Bosko. > > ----- Original Message ----- > From: "Marcus Vinícius Midena Ramos" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, December 28, 2000 8:58 AM > Subject: Intel ethernet driver source code > > > Hello, > > > > I am developing an application to measure the performance of an IP > > communications network, accounting for packet loss rate and transmission > > delay values between any two sites on a net. This work resembles that of > > www.advanced.org and is also based on IETF's IPPM initiative. > > > > One of the goals is to insert a GPS timestamp on the packets to be > > transmitted as late as possible before they are put on the wire. This > > means I cannot do this job on the application level. Instead, this has > > to be done on the ethernet driver level in order to achieve the maximum > > accuracy, specially when the measurement machine is under heavy load. > > > > I've studied the "if_fxp.c" (Intel ethernet driver) source code plus > > Stevens' TCP Illustrated vol. 2, which helped me get a good > > understanding of the data structures manipulated by this code. My aim > > now is to insert the GPS timestamps on the packets to be transmitted > > right before they go to the interface. > > > > To do this, I am trying to modify the driver source code to achieve the > > following objectives: (1) read the contents of the mbufs in order to > > identify the ones that hold the packets to be transmitted, and (2) > > insert the timestamps on those ellegible for so. > > > > However, any access to mbufs from inside the driver causes an error > > message "page fault while in kernel mode" to be displayed the new kernel > > is booted. It then enters a loop, trying to reboot forever. > > > > I guess the mbufs are in an area somehow protected by the kernel, which > > prevents even the driver to have access to it. May question is: how can > > I go around this problem and be able to read and change the contents of > > the mbufs from inside the driver ? > > > > Thank you very much. > > Marcus. > > > > > > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > > with "unsubscribe freebsd-net" in the body of the message > > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe freebsd-net" in the body of the message
/* The code below is a duplication of the final part of function fxp_start, * from file /usr/src/sys/pci/if_fxp.c, with the added code to display the * strucuture and partial contents of the mbufs. * The message "page fault while in kernel mode" appears when the m_copydata * function call is added to this code by removing the comment delimiters. */ /* * We're finished. If we added to the list, issue a RESUME to get DMA * going again if suspended. */ if (txp != NULL) { /* BEGIN OF ADDED CODE */ int i; char b [20]; struct fxp_cb_tx *p; printf ("\nTX_QUEUED: %d", sc->tx_queued); for (i = 0, p = sc->cbl_first; i < sc->tx_queued; i++, p = p->next) { int j; u_int32_t size, addr; printf ("\n\tQUEUE [%d] * TBD_NUMBER: %d", i, p->tbd_number); /* m_copydata (p->mb_head, 0, 6, b); printf ("\n\t.%d.%d.%d.%d.%d.%d.", b[0], b[1], b[2], b[3], b[4], b[5]); */ for (j = 0; j < p->tbd_number; j++) { size = p->tbd [j].tb_size; addr = p->tbd [j].tb_addr; printf ("\n\t\t TBD [%d] * SIZE %d & ADDRESS %d", j, size, addr); } } /* END OF ADDED CODE */ fxp_scb_wait(sc); CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_RESUME); } }