2000-11-13 Jiri Gaisler <jgais@ws.estec.esa.nl>

* network/sonic.c: Added ipalign() routine to align the
	received packet so that the ip header is on a 32-bit boundary.
	Necessary for cpu's that do not allow unaligned loads and stores
	and when the 32-bit DMA mode is used.
This commit is contained in:
Joel Sherrill
2000-11-13 22:58:36 +00:00
parent a44f9ca520
commit f6ef823a22
2 changed files with 41 additions and 0 deletions

View File

@@ -1,3 +1,10 @@
2000-11-13 Jiri Gaisler <jgais@ws.estec.esa.nl>
* network/sonic.c: Added ipalign() routine to align the
received packet so that the ip header is on a 32-bit boundary.
Necessary for cpu's that do not allow unaligned loads and stores
and when the 32-bit DMA mode is used.
2000-11-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS.

View File

@@ -887,6 +887,40 @@ SONIC_STATIC void sonic_rda_wait(
}
#ifdef CPU_U32_FIX
/*
* Routine to align the received packet so that the ip header
* is on a 32-bit boundary. Necessary for cpu's that do not
* allow unaligned loads and stores and when the 32-bit DMA
* mode is used.
*
* Transfers are done on word basis to avoid possibly slow byte
* and half-word writes.
*/
void ipalign(struct mbuf *m)
{
unsigned int *first, *last, data;
unsigned int tmp = 0;
if ((((int) m->m_data) & 2) && (m->m_len)) {
last = (unsigned int *) ((((int) m->m_data) + m->m_len + 8) & ~3);
first = (unsigned int *) (((int) m->m_data) & ~3);
tmp = *first << 16;
first++;
do {
data = *first;
*first = tmp | (data >> 16);
tmp = data << 16;
first++;
} while (first <= last);
m->m_data = (caddr_t)(((int) m->m_data) + 2);
}
}
#endif
/*
* SONIC reader task
*/