Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146629058
D753.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D753.diff
View Options
Index: sys/dev/cxgbe/common/t4_regs.h
===================================================================
--- sys/dev/cxgbe/common/t4_regs.h
+++ sys/dev/cxgbe/common/t4_regs.h
@@ -1073,9 +1073,9 @@
#define A_SGE_FL_BUFFER_SIZE0 0x1044
#define S_SIZE 4
-#define M_SIZE 0xfffffffU
+#define CXGBE_M_SIZE 0xfffffffU
#define V_SIZE(x) ((x) << S_SIZE)
-#define G_SIZE(x) (((x) >> S_SIZE) & M_SIZE)
+#define G_SIZE(x) (((x) >> S_SIZE) & CXGBE_M_SIZE)
#define A_SGE_FL_BUFFER_SIZE1 0x1048
#define A_SGE_FL_BUFFER_SIZE2 0x104c
Index: sys/sys/mbuf.h
===================================================================
--- sys/sys/mbuf.h
+++ sys/sys/mbuf.h
@@ -843,29 +843,50 @@
} while (0)
/*
+ * Return the address of the start of the buffer associated with an mbuf,
+ * handling external storage, packet-header mbufs, and regular data mbufs.
+ */
+#define M_START(m) \
+ (((m)->m_flags & M_EXT) ? (m)->m_ext.ext_buf : \
+ ((m)->m_flags & M_PKTHDR) ? &(m)->m_pktdat[0] : \
+ &(m)->m_dat[0])
+
+/*
+ * Return the size of the buffer associated with an mbuf, handling external
+ * storage, packet-buffer mbufs, and regular data mbufs.
+ */
+#define M_SIZE(m) \
+ (((m)->m_flags & M_EXT) ? (m)->m_ext.ext_size : \
+ ((m)->m_flags & M_PKTHDR) ? MHLEN : \
+ MLEN)
+
+/*
* Compute the amount of space available before the current start of data in
* an mbuf.
*
* The M_WRITABLE() is a temporary, conservative safety measure: the burden
* of checking writability of the mbuf data area rests solely with the caller.
+ *
+ * NB: In previous versions, M_LEADINGSPACE() would only check M_WRITABLE()
+ * for mbufs with external storage. We now allow mbuf-embedded data to be
+ * read-only as well.
*/
#define M_LEADINGSPACE(m) \
- ((m)->m_flags & M_EXT ? \
- (M_WRITABLE(m) ? (m)->m_data - (m)->m_ext.ext_buf : 0): \
- (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
- (m)->m_data - (m)->m_dat)
+ (M_WRITABLE(m) ? ((m)->m_data - M_START(m)) : 0)
/*
* Compute the amount of space available after the end of data in an mbuf.
*
* The M_WRITABLE() is a temporary, conservative safety measure: the burden
* of checking writability of the mbuf data area rests solely with the caller.
+ *
+ * NB: In previous versions, M_TRAILINGSPACE() would only check M_WRITABLE()
+ * for mbufs with external storage. We now allow mbuf-embedded data to be
+ * read-only as well.
*/
#define M_TRAILINGSPACE(m) \
- ((m)->m_flags & M_EXT ? \
- (M_WRITABLE(m) ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size \
- - ((m)->m_data + (m)->m_len) : 0) : \
- &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
+ (M_WRITABLE(m) ? \
+ ((M_START(m) + M_SIZE(m)) - ((m)->m_data + (m)->m_len)) : 0)
/*
* Arrange to prepend space of size plen to mbuf m. If a new mbuf must be
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 5, 6:09 AM (11 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29274163
Default Alt Text
D753.diff (2 KB)
Attached To
Mode
D753: Add M_START(), M_SIZE() mbuf macros; update M_LEADINGSPACE(), M_TRAILINGSPACE() to use them
Attached
Detach File
Event Timeline
Log In to Comment