Index: sys/pci/if_sk.c =================================================================== RCS file: /home/ncvs/src/sys/pci/if_sk.c,v retrieving revision 1.27 diff -u -r1.27 if_sk.c --- sys/pci/if_sk.c 2000/08/19 08:32:35 1.27 +++ sys/pci/if_sk.c 2000/10/12 02:36:51 @@ -689,9 +689,10 @@ } /* Attach the buffer to the mbuf */ - MEXTADD(m_new, buf, SK_MCLBYTES, sk_jfree, NULL); + MEXTADD(m_new, buf, SK_JLEN, sk_jfree, + (struct sk_if_softc *)sc_if); m_new->m_data = (void *)buf; - m_new->m_pkthdr.len = m_new->m_len = SK_MCLBYTES; + m_new->m_pkthdr.len = m_new->m_len = SK_JLEN; } else { /* * We're re-using a previously allocated mbuf; @@ -699,7 +700,7 @@ * default values. */ m_new = m; - m_new->m_len = m_new->m_pkthdr.len = SK_MCLBYTES; + m_new->m_len = m_new->m_pkthdr.len = SK_JLEN; m_new->m_data = m_new->m_ext.ext_buf; } @@ -748,20 +749,12 @@ /* * Now divide it up into 9K pieces and save the addresses - * in an array. Note that we play an evil trick here by using - * the first few bytes in the buffer to hold the the address - * of the softc structure for this interface. This is because - * sk_jfree() needs it, but it is called by the mbuf management - * code which will not pass it to us explicitly. + * in an array. */ ptr = sc_if->sk_cdata.sk_jumbo_buf; for (i = 0; i < SK_JSLOTS; i++) { - u_int64_t **aptr; - aptr = (u_int64_t **)ptr; - aptr[0] = (u_int64_t *)sc_if; - ptr += sizeof(u_int64_t); - sc_if->sk_cdata.sk_jslots[i].sk_buf = ptr; - ptr += SK_MCLBYTES; + sc_if->sk_cdata.sk_jslots[i] = ptr; + ptr += SK_JLEN; entry = malloc(sizeof(struct sk_jpool_entry), M_DEVBUF, M_NOWAIT); if (entry == NULL) { @@ -798,7 +791,7 @@ SLIST_REMOVE_HEAD(&sc_if->sk_jfree_listhead, jpool_entries); SLIST_INSERT_HEAD(&sc_if->sk_jinuse_listhead, entry, jpool_entries); - return(sc_if->sk_cdata.sk_jslots[entry->slot].sk_buf); + return(sc_if->sk_cdata.sk_jslots[entry->slot]); } /* @@ -809,19 +802,17 @@ void *args; { struct sk_if_softc *sc_if; - u_int64_t **aptr; int i; struct sk_jpool_entry *entry; /* Extract the softc struct pointer. */ - aptr = (u_int64_t **)(buf - sizeof(u_int64_t)); - sc_if = (struct sk_if_softc *)(aptr[0]); + sc_if = (struct sk_if_softc *)args; if (sc_if == NULL) - panic("sk_jfree: can't find softc pointer!"); + panic("sk_jfree: didn't get softc pointer!"); /* calculate the slot this buffer belongs to */ - i = ((vm_offset_t)aptr + i = ((vm_offset_t)buf - (vm_offset_t)sc_if->sk_cdata.sk_jumbo_buf) / SK_JLEN; if ((i < 0) || (i >= SK_JSLOTS)) Index: sys/pci/if_skreg.h =================================================================== RCS file: /home/ncvs/src/sys/pci/if_skreg.h,v retrieving revision 1.12 diff -u -r1.12 if_skreg.h --- sys/pci/if_skreg.h 2000/08/19 08:32:35 1.12 +++ sys/pci/if_skreg.h 2000/10/12 02:36:57 @@ -1114,18 +1114,13 @@ #define SK_JUMBO_MTU (SK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) #define SK_JSLOTS 384 -#define SK_JRAWLEN (SK_JUMBO_FRAMELEN + ETHER_ALIGN + sizeof(u_int64_t)) +#define SK_JRAWLEN (SK_JUMBO_FRAMELEN + ETHER_ALIGN) #define SK_JLEN (SK_JRAWLEN + (sizeof(u_int64_t) - \ (SK_JRAWLEN % sizeof(u_int64_t)))) -#define SK_MCLBYTES (SK_JLEN - sizeof(u_int64_t)) #define SK_JPAGESZ PAGE_SIZE #define SK_RESID (SK_JPAGESZ - (SK_JLEN * SK_JSLOTS) % SK_JPAGESZ) #define SK_JMEM ((SK_JLEN * SK_JSLOTS) + SK_RESID) -struct sk_jslot { - caddr_t sk_buf; -}; - struct sk_jpool_entry { int slot; SLIST_ENTRY(sk_jpool_entry) jpool_entries; @@ -1147,7 +1142,7 @@ int sk_rx_cons; int sk_rx_cnt; /* Stick the jumbo mem management stuff here too. */ - struct sk_jslot sk_jslots[SK_JSLOTS]; + caddr_t sk_jslots[SK_JSLOTS]; void *sk_jumbo_buf; };