From owner-freebsd-hackers Thu Mar 30 21:46:18 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from spock.org (cm-24-161-8-2.nycap.rr.com [24.161.8.2]) by hub.freebsd.org (Postfix) with ESMTP id 135C237C428 for ; Thu, 30 Mar 2000 21:45:39 -0800 (PST) (envelope-from jon@spock.org) Received: (from jon@localhost) by spock.org serial EF600Q3T-B7F8823AAA83545F7T for freebsd-hackers@freebsd.org; Fri, 31 Mar 2000 00:45:37 -0500 (EST) (envelope-from jon) Date: Fri, 31 Mar 2000 00:45:37 -0500 From: Jonathan Chen To: freebsd-hackers@freebsd.org Subject: realigning mbufs? Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: telnet Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm writing some network card drivers and have ran into a problem with mbuf alignment. In summary, the problem is that the network card expects its transmit buffers to be double word aligned, while I'm getting tx mbufs that are single word aligned. The details: The card in question is the IBM EtherJet Cardbus adaptor, AKA Xircom CardBus Ethernet X3201-3. The PCI-Cardbus bridge driver (my own) and this whole mess is running on RELENG_4, and the netcard driver is based on if_dc. Basically, after the whole processes of going through ether_output() and stuff, when dc_start is called, the mbufs I get there are usually misaligned. Currently, I get by this by doing some really nasty hack which I'm sure is dead wrong, since I have very little knowledge of how mbufs work and what supporting functions are defined. So, the object of the game now is how to get an mbuf that's double word aligned (both offset and length) from some mbuf that might not be aligned properly, using the most correct and least resource intensive method. I do realize that since the ethernet header is 14 bytes long, it'll be hard to ensure that the mbuf I get will be double-word aligned to begin with, so I must either copy it or move it to somewhere else. Here's where I am stuck. Should I copy it or move it, and what are the functions/macros that will aid me in my task? Please bear with me, I'm fairly new to kernel level programming. Why do I get the feeling that someone at Xircom was smoking crack when they designed this card? -- (o_ 1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2-1-2 _o) \\\_\ Jonathan Chen jon@spock.org /_/// <____) WARNING:This email contains 100% nonbiodegradable electrons (____> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message