2 * Linux OS Independent Layer
4 * Copyright 2004, Broadcom Corporation
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
20 /* use current 2.4.x calling conventions */
23 /* assert and panic */
26 do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
27 extern void osl_assert(char *exp
, char *file
, int line
);
28 #else /* BCMDBG_ASSERT */
30 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
31 #if GCC_VERSION > 30100
32 #define ASSERT(exp) do {} while (0)
34 /* ASSERT could causes segmentation fault on GCC3.1, use empty instead */
36 #endif /* GCC_VERSION > 30100 */
38 #endif /* BCMDBG_ASSERT */
40 /* microsecond delay */
41 #define OSL_DELAY(usec) osl_delay(usec)
42 extern void osl_delay(uint usec
);
44 #if defined(DSLCPE_DELAY)
52 #define OSL_LONG_DELAY(osh, usec) osl_long_delay(osh, usec, 0)
53 #define OSL_YIELD_EXEC(osh, usec) osl_long_delay(osh, usec, 1)
54 extern void osl_long_delay(osl_t
*osh
, uint usec
, bool yield
);
55 extern int in_long_delay(osl_t
*osh
);
56 extern void osl_oshsh_init(osl_t
*osh
, shared_osl_t
*oshsh
);
57 #define IN_LONG_DELAY(osh) in_long_delay(osh)
60 /* PCMCIA attribute space access macros */
61 #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
63 dev_link_t link
; /* PCMCIA device pointer */
64 dev_node_t node
; /* PCMCIA node structure */
65 void *base
; /* Mapped attribute memory window */
66 size_t size
; /* Size of window */
67 void *drv
; /* Driver data */
69 #endif /* defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) */
70 #define OSL_PCMCIA_READ_ATTR(osh, offset, buf, size) \
71 osl_pcmcia_read_attr((osh), (offset), (buf), (size))
72 #define OSL_PCMCIA_WRITE_ATTR(osh, offset, buf, size) \
73 osl_pcmcia_write_attr((osh), (offset), (buf), (size))
74 extern void osl_pcmcia_read_attr(osl_t
*osh
, uint offset
, void *buf
, int size
);
75 extern void osl_pcmcia_write_attr(osl_t
*osh
, uint offset
, void *buf
, int size
);
77 /* PCI configuration space access macros */
78 #define OSL_PCI_READ_CONFIG(osh, offset, size) \
79 osl_pci_read_config((osh), (offset), (size))
80 #define OSL_PCI_WRITE_CONFIG(osh, offset, size, val) \
81 osl_pci_write_config((osh), (offset), (size), (val))
82 extern uint32
osl_pci_read_config(osl_t
*osh
, uint offset
, uint size
);
83 extern void osl_pci_write_config(osl_t
*osh
, uint offset
, uint size
, uint val
);
85 /* PCI device bus # and slot # */
86 #define OSL_PCI_BUS(osh) osl_pci_bus(osh)
87 #define OSL_PCI_SLOT(osh) osl_pci_slot(osh)
88 extern uint
osl_pci_bus(osl_t
*osh
);
89 extern uint
osl_pci_slot(osl_t
*osh
);
91 /* Pkttag flag should be part of public information */
94 uint pktalloced
; /* Number of allocated packet buffers */
95 bool mmbus
; /* Bus supports memory-mapped register accesses */
96 pktfree_cb_fn_t tx_fn
; /* Callback function for PKTFREE */
97 void *tx_ctx
; /* Context to the callback function */
100 /* OSL initialization */
101 extern osl_t
*osl_attach(void *pdev
, uint bustype
, bool pkttag
);
102 extern void osl_detach(osl_t
*osh
);
104 #define PKTFREESETCB(osh, _tx_fn, _tx_ctx) \
106 ((osl_pubinfo_t*)osh)->tx_fn = _tx_fn; \
107 ((osl_pubinfo_t*)osh)->tx_ctx = _tx_ctx; \
110 /* host/bus architecture-specific byte swap */
111 #define BUS_SWAP32(v) (v)
115 #define MALLOC(osh, size) osl_debug_malloc((osh), (size), __LINE__, __FILE__)
116 #define MFREE(osh, addr, size) osl_debug_mfree((osh), (addr), (size), __LINE__, __FILE__)
117 #define MALLOCED(osh) osl_malloced((osh))
118 #define MALLOC_DUMP(osh, b) osl_debug_memdump((osh), (b))
119 extern void *osl_debug_malloc(osl_t
*osh
, uint size
, int line
, char* file
);
120 extern void osl_debug_mfree(osl_t
*osh
, void *addr
, uint size
, int line
, char* file
);
122 extern int osl_debug_memdump(osl_t
*osh
, struct bcmstrbuf
*b
);
126 #define MALLOC(osh, size) osl_malloc((osh), (size))
127 #define MFREE(osh, addr, size) osl_mfree((osh), (addr), (size))
128 #define MALLOCED(osh) osl_malloced((osh))
130 #endif /* BCMDBG_MEM */
132 #define MALLOC_FAILED(osh) osl_malloc_failed((osh))
134 extern void *osl_malloc(osl_t
*osh
, uint size
);
135 extern void osl_mfree(osl_t
*osh
, void *addr
, uint size
);
136 extern uint
osl_malloced(osl_t
*osh
);
137 extern uint
osl_malloc_failed(osl_t
*osh
);
139 /* allocate/free shared (dma-able) consistent memory */
140 #define DMA_CONSISTENT_ALIGN PAGE_SIZE
141 #define DMA_ALLOC_CONSISTENT(osh, size, pap, dmah) \
142 osl_dma_alloc_consistent((osh), (size), (pap))
143 #define DMA_FREE_CONSISTENT(osh, va, size, pa, dmah) \
144 osl_dma_free_consistent((osh), (void*)(va), (size), (pa))
145 extern void *osl_dma_alloc_consistent(osl_t
*osh
, uint size
, ulong
*pap
);
146 extern void osl_dma_free_consistent(osl_t
*osh
, void *va
, uint size
, ulong pa
);
148 /* map/unmap direction */
149 #define DMA_TX 1 /* TX direction for DMA */
150 #define DMA_RX 2 /* RX direction for DMA */
152 /* map/unmap shared (dma-able) memory */
153 #define DMA_MAP(osh, va, size, direction, p, dmah) \
154 osl_dma_map((osh), (va), (size), (direction))
155 #define DMA_UNMAP(osh, pa, size, direction, p, dmah) \
156 osl_dma_unmap((osh), (pa), (size), (direction))
157 extern uint
osl_dma_map(osl_t
*osh
, void *va
, uint size
, int direction
);
158 extern void osl_dma_unmap(osl_t
*osh
, uint pa
, uint size
, int direction
);
160 /* API for DMA addressing capability */
161 #define OSL_DMADDRWIDTH(osh, addrwidth) do {} while (0)
163 /* register access macros */
166 #define OSL_WRITE_REG(osh, r, v) (bcmjtag_write(NULL, (uintptr)(r), (v), sizeof(*(r))))
167 #define OSL_READ_REG(osh, r) (bcmjtag_read(NULL, (uintptr)(r), sizeof(*(r))))
171 #define SELECT_BUS_WRITE(osh, mmap_op, bus_op) if (((osl_pubinfo_t*)(osh))->mmbus) \
173 #define SELECT_BUS_READ(osh, mmap_op, bus_op) (((osl_pubinfo_t*)(osh))->mmbus) ? \
176 #define SELECT_BUS_WRITE(osh, mmap_op, bus_op) mmap_op
177 #define SELECT_BUS_READ(osh, mmap_op, bus_op) mmap_op
181 * BINOSL selects the slightly slower function-call-based binary compatible osl.
182 * Macros expand to calls to functions defined in linux_osl.c .
186 /* string library, kernel mode */
188 #define printf(fmt, args...) printk(fmt, ## args)
190 #include <linux/kernel.h>
191 #include <linux/string.h>
193 /* register access macros */
195 #define R_REG(osh, r) (\
196 SELECT_BUS_READ(osh, sizeof(*(r)) == sizeof(uint8) ? readb((volatile uint8*)(r)) : \
197 sizeof(*(r)) == sizeof(uint16) ? readw((volatile uint16*)(r)) : \
198 readl((volatile uint32*)(r)), OSL_READ_REG(osh, r)) \
200 #define W_REG(osh, r, v) do { \
201 SELECT_BUS_WRITE(osh, \
202 switch (sizeof(*(r))) { \
203 case sizeof(uint8): writeb((uint8)(v), (volatile uint8*)(r)); break; \
204 case sizeof(uint16): writew((uint16)(v), (volatile uint16*)(r)); break; \
205 case sizeof(uint32): writel((uint32)(v), (volatile uint32*)(r)); break; \
207 (OSL_WRITE_REG(osh, r, v))); \
209 #else /* IL_BIGENDIAN */
210 #define R_REG(osh, r) (\
211 SELECT_BUS_READ(osh, \
213 __typeof(*(r)) __osl_v; \
214 switch (sizeof(*(r))) { \
215 case sizeof(uint8): __osl_v = \
216 readb((volatile uint8*)((uintptr)(r)^3)); break; \
217 case sizeof(uint16): __osl_v = \
218 readw((volatile uint16*)((uintptr)(r)^2)); break; \
219 case sizeof(uint32): __osl_v = \
220 readl((volatile uint32*)(r)); break; \
224 OSL_READ_REG(osh, r)) \
226 #define W_REG(osh, r, v) do { \
227 SELECT_BUS_WRITE(osh, \
228 switch (sizeof(*(r))) { \
229 case sizeof(uint8): writeb((uint8)(v), \
230 (volatile uint8*)((uintptr)(r)^3)); break; \
231 case sizeof(uint16): writew((uint16)(v), \
232 (volatile uint16*)((uintptr)(r)^2)); break; \
233 case sizeof(uint32): writel((uint32)(v), \
234 (volatile uint32*)(r)); break; \
236 (OSL_WRITE_REG(osh, r, v))); \
238 #endif /* IL_BIGENDIAN */
240 #define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
241 #define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
243 /* bcopy, bcmp, and bzero */
244 #define bcopy(src, dst, len) memcpy((dst), (src), (len))
245 #define bcmp(b1, b2, len) memcmp((b1), (b2), (len))
246 #define bzero(b, len) memset((b), '\0', (len))
248 /* uncached virtual address */
250 #define OSL_UNCACHED(va) KSEG1ADDR((va))
251 #include <asm/addrspace.h>
253 #define OSL_UNCACHED(va) (va)
256 /* get processor cycle count */
258 #if defined DSLCPE_DELAY
259 #define OSL_GETCYCLES(x) ((x) = read_c0_count())
260 #define TICKDIFF(_x2_, _x1_) \
261 ((_x2_ >= _x1_) ? (_x2_ - _x1_) : ((unsigned long)(-1) - _x2_ + _x1_))
263 #define OSL_GETCYCLES(x) ((x) = read_c0_count() * 2)
265 #elif defined(__i386__)
266 #define OSL_GETCYCLES(x) rdtscl((x))
268 #define OSL_GETCYCLES(x) ((x) = 0)
269 #endif /* defined(mips) */
271 /* dereference an address that may cause a bus exception */
273 #if defined(MODULE) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 17))
274 #define BUSPROBE(val, addr) panic("get_dbe() will not fixup a bus exception when compiled into"\
277 #define BUSPROBE(val, addr) get_dbe((val), (addr))
278 #include <asm/paccess.h>
279 #endif /* defined(MODULE) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 17)) */
281 #define BUSPROBE(val, addr) ({ (val) = R_REG(NULL, (addr)); 0; })
284 /* map/unmap physical to virtual I/O */
285 #define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), (unsigned long)(size))
286 #define REG_UNMAP(va) iounmap((void *)(va))
288 /* shared (dma-able) memory access macros */
290 #define W_SM(r, v) (*(r) = (v))
291 #define BZERO_SM(r, len) memset((r), '\0', (len))
293 /* packet primitives */
294 #define PKTGET(osh, len, send) osl_pktget((osh), (len))
295 #define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send))
296 #define PKTDATA(osh, skb) (((struct sk_buff*)(skb))->data)
297 #define PKTLEN(osh, skb) (((struct sk_buff*)(skb))->len)
298 #define PKTHEADROOM(osh, skb) (PKTDATA(osh, skb)-(((struct sk_buff*)(skb))->head))
299 #define PKTTAILROOM(osh, skb) ((((struct sk_buff*)(skb))->end)-(((struct sk_buff*)(skb))->tail))
300 #define PKTNEXT(osh, skb) (((struct sk_buff*)(skb))->next)
301 #define PKTSETNEXT(osh, skb, x) (((struct sk_buff*)(skb))->next = (struct sk_buff*)(x))
302 #define PKTSETLEN(osh, skb, len) __skb_trim((struct sk_buff*)(skb), (len))
303 #define PKTPUSH(osh, skb, bytes) skb_push((struct sk_buff*)(skb), (bytes))
304 #define PKTPULL(osh, skb, bytes) skb_pull((struct sk_buff*)(skb), (bytes))
305 #define PKTDUP(osh, skb) osl_pktdup((osh), (skb))
306 #define PKTTAG(skb) ((void*)(((struct sk_buff*)(skb))->cb))
307 #define PKTALLOCED(osh) ((osl_pubinfo_t *)(osh))->pktalloced
308 #ifdef BCMDBG_PKT /* pkt logging for debugging */
309 #define PKTLIST_DUMP(osh, buf) osl_pktlist_dump(osh, buf)
310 #else /* BCMDBG_PKT */
311 #define PKTLIST_DUMP(osh, buf)
312 #endif /* BCMDBG_PKT */
314 #ifdef BCMDBG_PKT /* pkt logging for debugging */
315 extern void osl_pktlist_add(osl_t
*osh
, void *p
);
316 extern void osl_pktlist_remove(osl_t
*osh
, void *p
);
317 extern char *osl_pktlist_dump(osl_t
*osh
, char *buf
);
318 #endif /* BCMDBG_PKT */
320 /* Convert a native(OS) packet to driver packet.
321 * In the process, native packet is destroyed, there is no copying
322 * Also, a packettag is zeroed out
325 osl_pkt_frmnative(osl_pubinfo_t
*osh
, struct sk_buff
*skb
)
327 struct sk_buff
*nskb
;
330 bzero((void*)skb
->cb
, OSL_PKTTAG_SZ
);
332 /* Increment the packet counter */
333 for (nskb
= skb
; nskb
; nskb
= nskb
->next
) {
335 osl_pktlist_add((osl_t
*)osh
, (void *) nskb
);
336 #endif /* BCMDBG_PKT */
342 #define PKTFRMNATIVE(osh, skb) osl_pkt_frmnative(((osl_pubinfo_t *)osh), (struct sk_buff*)(skb))
344 /* Convert a driver packet to native(OS) packet
345 * In the process, packettag is zeroed out before sending up
346 * IP code depends on skb->cb to be setup correctly with various options
347 * In our case, that means it should be 0
349 static INLINE
struct sk_buff
*
350 osl_pkt_tonative(osl_pubinfo_t
*osh
, void *pkt
)
352 struct sk_buff
*nskb
;
355 bzero(((struct sk_buff
*)pkt
)->cb
, OSL_PKTTAG_SZ
);
357 /* Decrement the packet counter */
358 for (nskb
= (struct sk_buff
*)pkt
; nskb
; nskb
= nskb
->next
) {
360 osl_pktlist_remove((osl_t
*)osh
, (void *) nskb
);
361 #endif /* BCMDBG_PKT */
365 return (struct sk_buff
*)pkt
;
367 #define PKTTONATIVE(osh, pkt) osl_pkt_tonative((osl_pubinfo_t *)(osh), (pkt))
369 #define PKTLINK(skb) (((struct sk_buff*)(skb))->prev)
370 #define PKTSETLINK(skb, x) (((struct sk_buff*)(skb))->prev = (struct sk_buff*)(x))
371 #define PKTPRIO(skb) (((struct sk_buff*)(skb))->priority)
372 #define PKTSETPRIO(skb, x) (((struct sk_buff*)(skb))->priority = (x))
373 #define PKTSUMNEEDED(skb) (((struct sk_buff*)(skb))->ip_summed == CHECKSUM_HW)
374 #define PKTSETSUMGOOD(skb, x) (((struct sk_buff*)(skb))->ip_summed = \
375 ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE))
376 /* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because skb->ip_summed is overloaded */
377 #define PKTSHARED(skb) (((struct sk_buff*)(skb))->cloned)
379 extern void *osl_pktget(osl_t
*osh
, uint len
);
380 extern void osl_pktfree(osl_t
*osh
, void *skb
, bool send
);
381 extern void *osl_pktdup(osl_t
*osh
, void *skb
);
387 #define printf(fmt, args...) osl_printf((fmt), ## args)
389 #define sprintf(buf, fmt, args...) osl_sprintf((buf), (fmt), ## args)
391 #define strcmp(s1, s2) osl_strcmp((s1), (s2))
393 #define strncmp(s1, s2, n) osl_strncmp((s1), (s2), (n))
395 #define strlen(s) osl_strlen((s))
397 #define strcpy(d, s) osl_strcpy((d), (s))
399 #define strncpy(d, s, n) osl_strncpy((d), (s), (n))
400 #endif /* LINUX_OSL */
401 extern int osl_printf(const char *format
, ...);
402 extern int osl_sprintf(char *buf
, const char *format
, ...);
403 extern int osl_strcmp(const char *s1
, const char *s2
);
404 extern int osl_strncmp(const char *s1
, const char *s2
, uint n
);
405 extern int osl_strlen(const char *s
);
406 extern char* osl_strcpy(char *d
, const char *s
);
407 extern char* osl_strncpy(char *d
, const char *s
, uint n
);
409 /* register access macros */
410 #if !defined(BCMJTAG)
411 #define R_REG(osh, r) (\
412 sizeof(*(r)) == sizeof(uint8) ? osl_readb((volatile uint8*)(r)) : \
413 sizeof(*(r)) == sizeof(uint16) ? osl_readw((volatile uint16*)(r)) : \
414 osl_readl((volatile uint32*)(r)) \
416 #define W_REG(osh, r, v) do { \
417 switch (sizeof(*(r))) { \
418 case sizeof(uint8): osl_writeb((uint8)(v), (volatile uint8*)(r)); break; \
419 case sizeof(uint16): osl_writew((uint16)(v), (volatile uint16*)(r)); break; \
420 case sizeof(uint32): osl_writel((uint32)(v), (volatile uint32*)(r)); break; \
425 #define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v))
426 #define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v))
427 extern uint8
osl_readb(volatile uint8
*r
);
428 extern uint16
osl_readw(volatile uint16
*r
);
429 extern uint32
osl_readl(volatile uint32
*r
);
430 extern void osl_writeb(uint8 v
, volatile uint8
*r
);
431 extern void osl_writew(uint16 v
, volatile uint16
*r
);
432 extern void osl_writel(uint32 v
, volatile uint32
*r
);
434 /* bcopy, bcmp, and bzero */
435 extern void bcopy(const void *src
, void *dst
, int len
);
436 extern int bcmp(const void *b1
, const void *b2
, int len
);
437 extern void bzero(void *b
, int len
);
439 /* uncached virtual address */
440 #define OSL_UNCACHED(va) osl_uncached((va))
441 extern void *osl_uncached(void *va
);
443 /* get processor cycle count */
444 #define OSL_GETCYCLES(x) ((x) = osl_getcycles())
445 extern uint
osl_getcycles(void);
447 /* dereference an address that may target abort */
448 #define BUSPROBE(val, addr) osl_busprobe(&(val), (addr))
449 extern int osl_busprobe(uint32
*val
, uint32 addr
);
451 /* map/unmap physical to virtual */
452 #define REG_MAP(pa, size) osl_reg_map((pa), (size))
453 #define REG_UNMAP(va) osl_reg_unmap((va))
454 extern void *osl_reg_map(uint32 pa
, uint size
);
455 extern void osl_reg_unmap(void *va
);
457 /* shared (dma-able) memory access macros */
459 #define W_SM(r, v) (*(r) = (v))
460 #define BZERO_SM(r, len) bzero((r), (len))
462 /* packet primitives */
463 #define PKTGET(osh, len, send) osl_pktget((osh), (len))
464 #define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send))
465 #define PKTDATA(osh, skb) osl_pktdata((osh), (skb))
466 #define PKTLEN(osh, skb) osl_pktlen((osh), (skb))
467 #define PKTHEADROOM(osh, skb) osl_pktheadroom((osh), (skb))
468 #define PKTTAILROOM(osh, skb) osl_pkttailroom((osh), (skb))
469 #define PKTNEXT(osh, skb) osl_pktnext((osh), (skb))
470 #define PKTSETNEXT(osh, skb, x) osl_pktsetnext((skb), (x))
471 #define PKTSETLEN(osh, skb, len) osl_pktsetlen((osh), (skb), (len))
472 #define PKTPUSH(osh, skb, bytes) osl_pktpush((osh), (skb), (bytes))
473 #define PKTPULL(osh, skb, bytes) osl_pktpull((osh), (skb), (bytes))
474 #define PKTDUP(osh, skb) osl_pktdup((osh), (skb))
475 #define PKTTAG(skb) osl_pkttag((skb))
476 #define PKTFRMNATIVE(osh, skb) osl_pkt_frmnative((osh), (struct sk_buff*)(skb))
477 #define PKTTONATIVE(osh, pkt) osl_pkt_tonative((osh), (pkt))
478 #define PKTLINK(skb) osl_pktlink((skb))
479 #define PKTSETLINK(skb, x) osl_pktsetlink((skb), (x))
480 #define PKTPRIO(skb) osl_pktprio((skb))
481 #define PKTSETPRIO(skb, x) osl_pktsetprio((skb), (x))
482 #define PKTSHARED(skb) osl_pktshared((skb))
483 #define PKTALLOCED(osh) osl_pktalloced((osh))
485 #define PKTLIST_DUMP(osh, buf) osl_pktlist_dump(osh, buf)
486 #else /* BCMDBG_PKT */
487 #define PKTLIST_DUMP(osh, buf)
488 #endif /* BCMDBG_PKT */
490 extern void *osl_pktget(osl_t
*osh
, uint len
);
491 extern void osl_pktfree(osl_t
*osh
, void *skb
, bool send
);
492 extern uchar
*osl_pktdata(osl_t
*osh
, void *skb
);
493 extern uint
osl_pktlen(osl_t
*osh
, void *skb
);
494 extern uint
osl_pktheadroom(osl_t
*osh
, void *skb
);
495 extern uint
osl_pkttailroom(osl_t
*osh
, void *skb
);
496 extern void *osl_pktnext(osl_t
*osh
, void *skb
);
497 extern void osl_pktsetnext(void *skb
, void *x
);
498 extern void osl_pktsetlen(osl_t
*osh
, void *skb
, uint len
);
499 extern uchar
*osl_pktpush(osl_t
*osh
, void *skb
, int bytes
);
500 extern uchar
*osl_pktpull(osl_t
*osh
, void *skb
, int bytes
);
501 extern void *osl_pktdup(osl_t
*osh
, void *skb
);
502 extern void *osl_pkttag(void *skb
);
503 extern void *osl_pktlink(void *skb
);
504 extern void osl_pktsetlink(void *skb
, void *x
);
505 extern uint
osl_pktprio(void *skb
);
506 extern void osl_pktsetprio(void *skb
, uint x
);
507 extern void *osl_pkt_frmnative(osl_t
*osh
, struct sk_buff
*skb
);
508 extern struct sk_buff
*osl_pkt_tonative(osl_t
*osh
, void *pkt
);
509 extern bool osl_pktshared(void *skb
);
510 extern uint
osl_pktalloced(osl_t
*osh
);
512 #ifdef BCMDBG_PKT /* pkt logging for debugging */
513 extern char *osl_pktlist_dump(osl_t
*osh
, char *buf
);
514 extern void osl_pktlist_add(osl_t
*osh
, void *p
);
515 extern void osl_pktlist_remove(osl_t
*osh
, void *p
);
516 #endif /* BCMDBG_PKT */
520 #define OSL_ERROR(bcmerror) osl_error(bcmerror)
521 extern int osl_error(int bcmerror
);
523 /* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */
524 #define PKTBUFSZ 2048 /* largest reasonable packet buffer, driver uses for ethernet MTU */
526 #endif /* _linux_osl_h_ */