K 10 svn:author V 5 andre K 8 svn:date V 27 2013-10-20T09:51:36.170316Z K 7 svn:log V 1915 Give ext_free way more latitude in handling of external mbuf storage and associated refcounts. The behavior is managed by using the m_ext.ext_flags to signal various combinations of external storage and refcount management. At every step (*ext_free) can capture the whole mbuf freeing process by using the return values EXT_FREE_CONT or EXT_FREE_DONE. With EXT_FLAG_EMBREF no external refcount storage is allocated by the mbuf system and a pointer must be supplied by the m_extadd() caller. The location of the refcount storage must be inside the attached external memory. It is managed as usual by incrementing/decrementing the value at the location. With EXT_FLAG_EXTREF no external refcount storage is allocated by the mbuf system and a pointer must be supplied by the m_extadd() caller. The location of the refcount storage can be anywhere within KVM. It must not disappear until after the associated external storage has been freed. It is managed as usual by incrementing/decrementing the value at the location. With EXT_FLAG_REFCNT no external refcount storage is alloced by the mbuf system. No pointer needs to be supplied. Every in/decrement of the refcount is done through (*m_ext_free) and the new parameters EXT_FREE_REFINC, EXT_FREE_REFDEC, and EXT_FREE_REFDEL. The previous mbuf type EXT_EXTREF is removed and the m_ext.ext_flags are used instead. As long as the new features are not used the behavior remains the same as before. NB: This is API and implementation is still subject to changes and refinements. Other changes: Simplify m_free() by removing m_tag_delete_chain() which is done in the zone_mbuf dtor anyways. Add typedef ext_free_t for (*)(struct mbuf *, void *, void *, int). m_extadd() gains two more parameters: u_int refcnt, int ext_flags. Users of the m_extadd()/MEXTADD() APIs in the generic kernel are adjusted. Within modules there is some fallout not yet fixed. END