The overhead induced by the HTX format was set to the HTX structure itself
and two HTX blocks. It was set this way to optimize zero-copy during
transfers. This value may (and will) be used at different places. Thus we
now use a macro, called HTX_BUF_OVERHEAD.
#undef _
}
+/* Overhead induced by HTX on buffers during transfers. In addition to the size
+ * of the HTX structure itself, and meta data for one block, another block is
+ * accounted to favored zero-copy xfer.
+ */
+#define HTX_BUF_OVERHEAD (sizeof(struct htx) + 2 * sizeof(struct htx_blk))
+
/* HTX flags.
* Please also update the htx_show_flags() function below in case of changes.
*/
size_t room;
room = b_room(buf);
- if (room <= sizeof(struct htx) + 2 * sizeof(struct htx_blk))
+ if (room <= HTX_BUF_OVERHEAD)
room = 0;
else
- room -= sizeof(struct htx) + 2 * sizeof(struct htx_blk);
+ room -= HTX_BUF_OVERHEAD;
return room;
}