| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mbuf.h,v 1.186 2018/04/15 07:35:49 maxv Exp $ */ | | 1 | /* $NetBSD: mbuf.h,v 1.187 2018/04/15 17:26:39 maxv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center and Matt Thomas of 3am Software Foundry. | | 9 | * NASA Ames Research Center and Matt Thomas of 3am Software Foundry. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -244,75 +244,76 @@ struct pkthdr { | | | @@ -244,75 +244,76 @@ struct pkthdr { |
244 | | | 244 | |
245 | #define M_CSUM_DATA_IPv6_HL(x) ((x) >> 16) | | 245 | #define M_CSUM_DATA_IPv6_HL(x) ((x) >> 16) |
246 | #define M_CSUM_DATA_IPv6_HL_SET(x, v) (x) = ((x) & 0xffff) | ((v) << 16) | | 246 | #define M_CSUM_DATA_IPv6_HL_SET(x, v) (x) = ((x) & 0xffff) | ((v) << 16) |
247 | #define M_CSUM_DATA_IPv6_OFFSET(x) ((x) & 0xffff) | | 247 | #define M_CSUM_DATA_IPv6_OFFSET(x) ((x) & 0xffff) |
248 | | | 248 | |
249 | /* | | 249 | /* |
250 | * Max # of pages we can attach to m_ext. This is carefully chosen | | 250 | * Max # of pages we can attach to m_ext. This is carefully chosen |
251 | * to be able to handle SOSEND_LOAN_CHUNK with our minimum sized page. | | 251 | * to be able to handle SOSEND_LOAN_CHUNK with our minimum sized page. |
252 | */ | | 252 | */ |
253 | #ifdef MIN_PAGE_SIZE | | 253 | #ifdef MIN_PAGE_SIZE |
254 | #define M_EXT_MAXPAGES ((65536 / MIN_PAGE_SIZE) + 1) | | 254 | #define M_EXT_MAXPAGES ((65536 / MIN_PAGE_SIZE) + 1) |
255 | #endif | | 255 | #endif |
256 | | | 256 | |
257 | /* description of external storage mapped into mbuf, valid if M_EXT set */ | | 257 | /* |
| | | 258 | * Description of external storage mapped into mbuf, valid if M_EXT set. |
| | | 259 | */ |
258 | struct _m_ext_storage { | | 260 | struct _m_ext_storage { |
259 | unsigned int ext_refcnt; | | 261 | unsigned int ext_refcnt; |
260 | int ext_flags; | | 262 | int ext_flags; |
261 | char *ext_buf; /* start of buffer */ | | 263 | char *ext_buf; /* start of buffer */ |
262 | void (*ext_free) /* free routine if not the usual */ | | 264 | void (*ext_free) /* free routine if not the usual */ |
263 | (struct mbuf *, void *, size_t, void *); | | 265 | (struct mbuf *, void *, size_t, void *); |
264 | void *ext_arg; /* argument for ext_free */ | | 266 | void *ext_arg; /* argument for ext_free */ |
265 | size_t ext_size; /* size of buffer, for ext_free */ | | 267 | size_t ext_size; /* size of buffer, for ext_free */ |
| | | 268 | |
266 | union { | | 269 | union { |
267 | paddr_t extun_paddr; /* physical address (M_EXT_CLUSTER) */ | | 270 | /* M_EXT_CLUSTER: physical address */ |
268 | /* pages (M_EXT_PAGES) */ | | 271 | paddr_t extun_paddr; |
269 | /* | | | |
270 | * XXX This is gross, but it doesn't really matter; this is | | | |
271 | * XXX overlaid on top of the mbuf data area. | | | |
272 | */ | | | |
273 | #ifdef M_EXT_MAXPAGES | | 272 | #ifdef M_EXT_MAXPAGES |
| | | 273 | /* M_EXT_PAGES: pages */ |
274 | struct vm_page *extun_pgs[M_EXT_MAXPAGES]; | | 274 | struct vm_page *extun_pgs[M_EXT_MAXPAGES]; |
275 | #endif | | 275 | #endif |
276 | } ext_un; | | 276 | } ext_un; |
277 | #define ext_paddr ext_un.extun_paddr | | 277 | #define ext_paddr ext_un.extun_paddr |
278 | #define ext_pgs ext_un.extun_pgs | | 278 | #define ext_pgs ext_un.extun_pgs |
| | | 279 | |
279 | #ifdef DEBUG | | 280 | #ifdef DEBUG |
280 | const char *ext_ofile; | | 281 | const char *ext_ofile; |
281 | const char *ext_nfile; | | 282 | const char *ext_nfile; |
282 | int ext_oline; | | 283 | int ext_oline; |
283 | int ext_nline; | | 284 | int ext_nline; |
284 | #endif | | 285 | #endif |
285 | }; | | 286 | }; |
286 | | | 287 | |
287 | struct _m_ext { | | 288 | struct _m_ext { |
288 | struct mbuf *ext_ref; | | 289 | struct mbuf *ext_ref; |
289 | struct _m_ext_storage ext_storage; | | 290 | struct _m_ext_storage ext_storage; |
290 | }; | | 291 | }; |
291 | | | 292 | |
292 | #define M_PADDR_INVALID POOL_PADDR_INVALID | | 293 | #define M_PADDR_INVALID POOL_PADDR_INVALID |
293 | | | 294 | |
294 | /* | | 295 | /* |
295 | * Definition of "struct mbuf". | | 296 | * Definition of "struct mbuf". |
296 | * Don't change this without understanding how MHLEN/MLEN are defined. | | 297 | * Don't change this without understanding how MHLEN/MLEN are defined. |
297 | */ | | 298 | */ |
298 | #define MBUF_DEFINE(name, mhlen, mlen) \ | | 299 | #define MBUF_DEFINE(name, mhlen, mlen) \ |
299 | struct name { \ | | 300 | struct name { \ |
300 | struct m_hdr m_hdr; \ | | 301 | struct m_hdr m_hdr; \ |
301 | union { \ | | 302 | union { \ |
302 | struct { \ | | 303 | struct { \ |
303 | struct pkthdr MH_pkthdr; \ | | 304 | struct pkthdr MH_pkthdr; \ |
304 | union { \ | | 305 | union { \ |
305 | struct _m_ext MH_ext; \ | | 306 | struct _m_ext MH_ext; \ |
306 | char MH_databuf[(mhlen)]; \ | | 307 | char MH_databuf[(mhlen)]; \ |
307 | } MH_dat; \ | | 308 | } MH_dat; \ |
308 | } MH; \ | | 309 | } MH; \ |
309 | char M_databuf[(mlen)]; \ | | 310 | char M_databuf[(mlen)]; \ |
310 | } M_dat; \ | | 311 | } M_dat; \ |
311 | } | | 312 | } |
312 | #define m_next m_hdr.mh_next | | 313 | #define m_next m_hdr.mh_next |
313 | #define m_len m_hdr.mh_len | | 314 | #define m_len m_hdr.mh_len |
314 | #define m_data m_hdr.mh_data | | 315 | #define m_data m_hdr.mh_data |
315 | #define m_owner m_hdr.mh_owner | | 316 | #define m_owner m_hdr.mh_owner |
316 | #define m_type m_hdr.mh_type | | 317 | #define m_type m_hdr.mh_type |
317 | #define m_flags m_hdr.mh_flags | | 318 | #define m_flags m_hdr.mh_flags |
318 | #define m_nextpkt m_hdr.mh_nextpkt | | 319 | #define m_nextpkt m_hdr.mh_nextpkt |