david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[linda] Add support for QLogic 7220-based Infiniband HCAs

These cards very nearly support our current IB Verbs model.  There is
one minor difference: multicast packets will always be delivered by
the hardware to QP0, so the driver has to redirect them to the
appropriate QP.  This means that QP owners may see receive completions
for buffers that they never posted.  Nothing in our current codebase
will break because of this.
This commit is contained in:
Michael Brown 2008-11-07 08:47:21 +00:00
parent 9e5fd8ec59
commit 125c6d66a8
8 changed files with 5805 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,253 @@
#ifndef _LINDA_H
#define _LINDA_H
/**
* @file
*
* QLogic Linda Infiniband HCA
*
*/
#define BITOPS_LITTLE_ENDIAN
#include <gpxe/bitops.h>
#include "qib_7220_regs.h"
struct ib_device;
/** A Linda GPIO register */
struct QIB_7220_GPIO_pb {
pseudo_bit_t GPIO[16];
pseudo_bit_t Reserved[48];
};
struct QIB_7220_GPIO {
PSEUDO_BIT_STRUCT ( struct QIB_7220_GPIO_pb );
};
/** A Linda general scalar register */
struct QIB_7220_scalar_pb {
pseudo_bit_t Value[64];
};
struct QIB_7220_scalar {
PSEUDO_BIT_STRUCT ( struct QIB_7220_scalar_pb );
};
/** Linda send per-buffer control word */
struct QIB_7220_SendPbc_pb {
pseudo_bit_t LengthP1_toibc[11];
pseudo_bit_t Reserved1[4];
pseudo_bit_t LengthP1_trigger[11];
pseudo_bit_t Reserved2[3];
pseudo_bit_t TestEbp[1];
pseudo_bit_t Test[1];
pseudo_bit_t Intr[1];
pseudo_bit_t Reserved3[31];
pseudo_bit_t VL15[1];
};
struct QIB_7220_SendPbc {
PSEUDO_BIT_STRUCT ( struct QIB_7220_SendPbc_pb );
};
/** Linda send buffer availability */
struct QIB_7220_SendBufAvail_pb {
pseudo_bit_t InUseCheck[144][2];
pseudo_bit_t Reserved[32];
};
struct QIB_7220_SendBufAvail {
PSEUDO_BIT_STRUCT ( struct QIB_7220_SendBufAvail_pb );
};
/** DMA alignment for send buffer availability */
#define LINDA_SENDBUFAVAIL_ALIGN 64
/** A Linda eager receive descriptor */
struct QIB_7220_RcvEgr_pb {
pseudo_bit_t Addr[37];
pseudo_bit_t BufSize[3];
pseudo_bit_t Reserved[24];
};
struct QIB_7220_RcvEgr {
PSEUDO_BIT_STRUCT ( struct QIB_7220_RcvEgr_pb );
};
/** Linda receive header flags */
struct QIB_7220_RcvHdrFlags_pb {
pseudo_bit_t PktLen[11];
pseudo_bit_t RcvType[3];
pseudo_bit_t SoftB[1];
pseudo_bit_t SoftA[1];
pseudo_bit_t EgrIndex[12];
pseudo_bit_t Reserved1[3];
pseudo_bit_t UseEgrBfr[1];
pseudo_bit_t RcvSeq[4];
pseudo_bit_t HdrqOffset[11];
pseudo_bit_t Reserved2[8];
pseudo_bit_t IBErr[1];
pseudo_bit_t MKErr[1];
pseudo_bit_t TIDErr[1];
pseudo_bit_t KHdrErr[1];
pseudo_bit_t MTUErr[1];
pseudo_bit_t LenErr[1];
pseudo_bit_t ParityErr[1];
pseudo_bit_t VCRCErr[1];
pseudo_bit_t ICRCErr[1];
};
struct QIB_7220_RcvHdrFlags {
PSEUDO_BIT_STRUCT ( struct QIB_7220_RcvHdrFlags_pb );
};
/** Linda memory BAR size */
#define LINDA_BAR0_SIZE 0x400000
/** Linda I2C SCL line GPIO number */
#define LINDA_GPIO_SCL 0
/** Linda I2C SDA line GPIO number */
#define LINDA_GPIO_SDA 1
/** GUID offset within EEPROM */
#define LINDA_EEPROM_GUID_OFFSET 3
/** GUID size within EEPROM */
#define LINDA_EEPROM_GUID_SIZE 8
/** Board serial number offset within EEPROM */
#define LINDA_EEPROM_SERIAL_OFFSET 12
/** Board serial number size within EEPROM */
#define LINDA_EEPROM_SERIAL_SIZE 12
/** Maximum number of send buffers used
*
* This is a policy decision. Must be less than or equal to the total
* number of send buffers supported by the hardware (128).
*/
#define LINDA_MAX_SEND_BUFS 32
/** Linda send buffer size */
#define LINDA_SEND_BUF_SIZE 4096
/** Number of contexts (including kernel context)
*
* This is a policy decision. Must be 5, 9 or 17.
*/
#define LINDA_NUM_CONTEXTS 5
/** PortCfg values for different numbers of contexts */
enum linda_portcfg {
LINDA_PORTCFG_5CTX = 0,
LINDA_PORTCFG_9CTX = 1,
LINDA_PORTCFG_17CTX = 2,
};
/** PortCfg values for different numbers of contexts */
#define LINDA_EAGER_ARRAY_SIZE_5CTX_0 2048
#define LINDA_EAGER_ARRAY_SIZE_5CTX_OTHER 4096
#define LINDA_EAGER_ARRAY_SIZE_9CTX_0 2048
#define LINDA_EAGER_ARRAY_SIZE_9CTX_OTHER 2048
#define LINDA_EAGER_ARRAY_SIZE_17CTX_0 2048
#define LINDA_EAGER_ARRAY_SIZE_17CTX_OTHER 1024
/** Eager buffer required alignment */
#define LINDA_EAGER_BUFFER_ALIGN 2048
/** Eager buffer size encodings */
enum linda_eager_buffer_size {
LINDA_EAGER_BUFFER_NONE = 0,
LINDA_EAGER_BUFFER_2K = 1,
LINDA_EAGER_BUFFER_4K = 2,
LINDA_EAGER_BUFFER_8K = 3,
LINDA_EAGER_BUFFER_16K = 4,
LINDA_EAGER_BUFFER_32K = 5,
LINDA_EAGER_BUFFER_64K = 6,
};
/** Number of RX headers per context
*
* This is a policy decision.
*/
#define LINDA_RECV_HEADER_COUNT 8
/** Maximum size of each RX header
*
* This is a policy decision. Must be divisible by 4.
*/
#define LINDA_RECV_HEADER_SIZE 96
/** Total size of an RX header ring */
#define LINDA_RECV_HEADERS_SIZE \
( LINDA_RECV_HEADER_SIZE * LINDA_RECV_HEADER_COUNT )
/** RX header alignment */
#define LINDA_RECV_HEADERS_ALIGN 64
/** RX payload size
*
* This is a policy decision. Must be a valid eager buffer size.
*/
#define LINDA_RECV_PAYLOAD_SIZE 2048
/** QPN used for Infinipath Packets
*
* This is a policy decision. Must have bit 0 clear. Must not be a
* QPN that we will use.
*/
#define LINDA_QP_IDETH 0xdead0
/** Maximum time for wait for external parallel bus request, in us */
#define LINDA_EPB_REQUEST_MAX_WAIT_US 500
/** Maximum time for wait for external parallel bus transaction, in us */
#define LINDA_EPB_XACT_MAX_WAIT_US 500
/** Linda external parallel bus chip selects */
#define LINDA_EPB_CS_SERDES 1
#define LINDA_EPB_CS_8051 2
/** Linda external parallel bus read/write operations */
#define LINDA_EPB_WRITE 0
#define LINDA_EPB_READ 1
/** Linda external parallel bus register addresses */
#define LINDA_EPB_ADDRESS( _channel, _element, _reg ) \
( (_element) | ( (_channel) << 4 ) | ( (_reg) << 9 ) )
#define LINDA_EPB_ADDRESS_CHANNEL( _address ) ( ( (_address) >> 4 ) & 0x1f )
#define LINDA_EPB_ADDRESS_ELEMENT( _address ) ( ( (_address) >> 0 ) & 0x0f )
#define LINDA_EPB_ADDRESS_REG( _address ) ( ( (_address) >> 9 ) & 0x3f )
/** Linda external parallel bus locations
*
* The location is used by the driver to encode both the chip select
* and the EPB address.
*/
#define LINDA_EPB_LOC( _cs, _channel, _element, _reg) \
( ( (_cs) << 16 ) | LINDA_EPB_ADDRESS ( _channel, _element, _reg ) )
#define LINDA_EPB_LOC_ADDRESS( _loc ) ( (_loc) & 0xffff )
#define LINDA_EPB_LOC_CS( _loc ) ( (_loc) >> 16 )
/** Linda external parallel bus 8051 microcontroller register addresses */
#define LINDA_EPB_UC_CHANNEL 6
#define LINDA_EPB_UC_LOC( _reg ) \
LINDA_EPB_LOC ( LINDA_EPB_CS_8051, LINDA_EPB_UC_CHANNEL, 0, (_reg) )
#define LINDA_EPB_UC_CTL LINDA_EPB_UC_LOC ( 0 )
#define LINDA_EPB_UC_CTL_WRITE 1
#define LINDA_EPB_UC_CTL_READ 2
#define LINDA_EPB_UC_ADDR_LO LINDA_EPB_UC_LOC ( 2 )
#define LINDA_EPB_UC_ADDR_HI LINDA_EPB_UC_LOC ( 3 )
#define LINDA_EPB_UC_DATA LINDA_EPB_UC_LOC ( 4 )
#define LINDA_EPB_UC_CHUNK_SIZE 64
extern uint8_t linda_ib_fw[8192];
/** Maximum time to wait for "trim done" signal, in ms */
#define LINDA_TRIM_DONE_MAX_WAIT_MS 1000
/** Linda link states */
enum linda_link_state {
LINDA_LINK_STATE_DOWN = 0,
LINDA_LINK_STATE_INIT = 1,
LINDA_LINK_STATE_ARM = 2,
LINDA_LINK_STATE_ACTIVE = 3,
LINDA_LINK_STATE_ACT_DEFER = 4,
};
#endif /* _LINDA_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
#!/usr/bin/perl -w
use strict;
use warnings;
my $offsets = {};
my $structures = {};
my $structure = "";
while ( <> ) {
chomp;
if ( /^\#define (\S+)_OFFS (\S+)$/ ) {
$structure = $1;
$offsets->{$structure} = $2;
} elsif ( /^\#define ${structure}_(\S+)_LSB (\S+)$/ ) {
$structures->{$structure}->{$1}->{LSB} = $2;
} elsif ( /^\#define ${structure}_(\S+)_RMASK (\S+)$/ ) {
$structures->{$structure}->{$1}->{RMASK} = $2;
} elsif ( /^\s*$/ ) {
# Do nothing
} else {
print "$_\n";
}
}
my $data = [ map { { name => $_, offset => $offsets->{$_} }; }
sort { hex ( $offsets->{$a} ) <=> hex ( $offsets->{$b} ) }
keys %$offsets ];
foreach my $datum ( @$data ) {
next unless exists $structures->{$datum->{name}};
$structure = $structures->{$datum->{name}};
my $fields = [ map { { name => $_, lsb => $structure->{$_}->{LSB},
rmask => $structure->{$_}->{RMASK} }; }
sort { hex ( $structure->{$a}->{LSB} ) <=>
hex ( $structure->{$b}->{LSB} ) }
keys %$structure ];
$datum->{fields} = $fields;
}
print "\n/* This file has been further processed by $0 */\n\n\n";
foreach my $datum ( @$data ) {
printf "#define %s_offset 0x%08xUL\n",
$datum->{name}, hex ( $datum->{offset} );
if ( exists $datum->{fields} ) {
my $lsb = 0;
my $reserved_idx = 0;
printf "struct %s_pb {\n", $datum->{name};
foreach my $field ( @{$datum->{fields}} ) {
my $pad_width = ( hex ( $field->{lsb} ) - $lsb );
die "Inconsistent LSB/RMASK in $datum->{name}\n" if $pad_width < 0;
printf "\tpseudo_bit_t _unused_%u[%u];\n", $reserved_idx++, $pad_width
if $pad_width;
# Damn Perl can't cope with 64-bit hex constants
my $width = 0;
my $rmask = $field->{rmask};
while ( $rmask =~ /^(0x.+)f$/i ) {
$width += 4;
$rmask = $1;
}
$rmask = hex ( $rmask );
while ( $rmask ) {
$width++;
$rmask >>= 1;
}
printf "\tpseudo_bit_t %s[%u];\n", $field->{name}, $width;
$lsb += $width;
}
my $pad_width = ( 64 - $lsb );
die "Inconsistent LSB/RMASK in $datum->{name}\n" if $pad_width < 0;
printf "\tpseudo_bit_t _unused_%u[%u];\n", $reserved_idx++, $pad_width
if $pad_width;
printf "};\n";
printf "struct %s {\n\tPSEUDO_BIT_STRUCT ( struct %s_pb );\n};\n",
$datum->{name}, $datum->{name};
}
print "\n";
}

228
src/include/gpxe/bitops.h Normal file
View File

@ -0,0 +1,228 @@
#ifndef _GPXE_BITOPS_H
#define _GPXE_BITOPS_H
/*
* Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* @file
*
* Bit operations
*
*/
#include <stdint.h>
#include <byteswap.h>
/* Endianness selection.
*
* This is a property of the NIC, not a property of the host CPU.
*/
#ifdef BITOPS_LITTLE_ENDIAN
#define cpu_to_BIT64 cpu_to_le64
#define cpu_to_BIT32 cpu_to_le32
#define BIT64_to_cpu le64_to_cpu
#define BIT32_to_cpu le32_to_cpu
#endif
#ifdef BITOPS_BIG_ENDIAN
#define cpu_to_BIT64 cpu_to_be64
#define cpu_to_BIT32 cpu_to_be32
#define BIT64_to_cpu be64_to_cpu
#define BIT32_to_cpu be32_to_cpu
#endif
/** Datatype used to represent a bit in the pseudo-structures */
typedef unsigned char pseudo_bit_t;
/**
* Wrapper structure for pseudo_bit_t structures
*
* This structure provides a wrapper around pseudo_bit_t structures.
* It has the correct size, and also encapsulates type information
* about the underlying pseudo_bit_t-based structure, which allows the
* BIT_FILL() etc. macros to work without requiring explicit type
* information.
*/
#define PSEUDO_BIT_STRUCT( _structure ) \
union { \
uint8_t bytes[ sizeof ( _structure ) / 8 ]; \
uint32_t dwords[ sizeof ( _structure ) / 32 ]; \
uint64_t qwords[ sizeof ( _structure ) / 64 ]; \
_structure *dummy[0]; \
} u
/** Get pseudo_bit_t structure type from wrapper structure pointer */
#define PSEUDO_BIT_STRUCT_TYPE( _ptr ) \
typeof ( *((_ptr)->u.dummy[0]) )
/** Bit offset of a field within a pseudo_bit_t structure */
#define BIT_OFFSET( _ptr, _field ) \
offsetof ( PSEUDO_BIT_STRUCT_TYPE ( _ptr ), _field )
/** Bit width of a field within a pseudo_bit_t structure */
#define BIT_WIDTH( _ptr, _field ) \
sizeof ( ( ( PSEUDO_BIT_STRUCT_TYPE ( _ptr ) * ) NULL )->_field )
/** Qword offset of a field within a pseudo_bit_t structure */
#define QWORD_OFFSET( _ptr, _field ) \
( BIT_OFFSET ( _ptr, _field ) / 64 )
/** Qword bit offset of a field within a pseudo_bit_t structure */
#define QWORD_BIT_OFFSET( _ptr, _index, _field ) \
( BIT_OFFSET ( _ptr, _field ) - ( 64 * (_index) ) )
/** Bit mask for a field within a pseudo_bit_t structure */
#define BIT_MASK( _ptr, _field ) \
( ( ~( ( uint64_t ) 0 ) ) >> \
( 64 - BIT_WIDTH ( _ptr, _field ) ) )
/*
* Assemble native-endian qword from named fields and values
*
*/
#define BIT_ASSEMBLE_1( _ptr, _index, _field, _value ) \
( ( ( uint64_t) (_value) ) << \
QWORD_BIT_OFFSET ( _ptr, _index, _field ) )
#define BIT_ASSEMBLE_2( _ptr, _index, _field, _value, ... ) \
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_1 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_3( _ptr, _index, _field, _value, ... ) \
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_2 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_4( _ptr, _index, _field, _value, ... ) \
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_3 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_5( _ptr, _index, _field, _value, ... ) \
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_4 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_6( _ptr, _index, _field, _value, ... ) \
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_5 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_7( _ptr, _index, _field, _value, ... ) \
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_6 ( _ptr, _index, __VA_ARGS__ ) )
/*
* Build native-endian (positive) qword bitmasks from named fields
*
*/
#define BIT_MASK_1( _ptr, _index, _field ) \
( BIT_MASK ( _ptr, _field ) << \
QWORD_BIT_OFFSET ( _ptr, _index, _field ) )
#define BIT_MASK_2( _ptr, _index, _field, ... ) \
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_1 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_MASK_3( _ptr, _index, _field, ... ) \
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_2 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_MASK_4( _ptr, _index, _field, ... ) \
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_3 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_MASK_5( _ptr, _index, _field, ... ) \
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_4 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_MASK_6( _ptr, _index, _field, ... ) \
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_5 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_MASK_7( _ptr, _index, _field, ... ) \
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_6 ( _ptr, _index, __VA_ARGS__ ) )
/*
* Populate little-endian qwords from named fields and values
*
*/
#define BIT_FILL( _ptr, _index, _assembled ) do { \
uint64_t *__ptr = &(_ptr)->u.qwords[(_index)]; \
uint64_t __assembled = (_assembled); \
*__ptr = cpu_to_BIT64 ( __assembled ); \
} while ( 0 )
#define BIT_FILL_1( _ptr, _field1, ... ) \
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_1 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_FILL_2( _ptr, _field1, ... ) \
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_2 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_FILL_3( _ptr, _field1, ... ) \
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_3 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_FILL_4( _ptr, _field1, ... ) \
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_4 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_FILL_5( _ptr, _field1, ... ) \
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_5 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_FILL_6( _ptr, _field1, ... ) \
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_6 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
/** Extract value of named field */
#define BIT_GET64( _ptr, _field ) \
( { \
unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
uint64_t __value = BIT64_to_cpu ( *__ptr ); \
__value >>= \
QWORD_BIT_OFFSET ( _ptr, __index, _field ); \
__value &= BIT_MASK ( _ptr, _field ); \
__value; \
} )
/** Extract value of named field (for fields up to the size of a long) */
#define BIT_GET( _ptr, _field ) \
( ( unsigned long ) BIT_GET64 ( _ptr, _field ) )
#define BIT_SET( _ptr, _field, _value ) do { \
unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
unsigned int __shift = \
QWORD_BIT_OFFSET ( _ptr, __index, _field ); \
uint64_t __value = (_value); \
*__ptr &= cpu_to_BIT64 ( ~( BIT_MASK ( _ptr, _field ) << \
__shift ) ); \
*__ptr |= cpu_to_BIT64 ( __value << __shift ); \
} while ( 0 )
#endif /* _GPXE_BITOPS_H */

View File

@ -111,6 +111,7 @@
#define ERRFILE_scsi ( ERRFILE_DRIVER | 0x00700000 )
#define ERRFILE_arbel ( ERRFILE_DRIVER | 0x00710000 )
#define ERRFILE_hermon ( ERRFILE_DRIVER | 0x00720000 )
#define ERRFILE_linda ( ERRFILE_DRIVER | 0x00730000 )
#define ERRFILE_aoe ( ERRFILE_NET | 0x00000000 )
#define ERRFILE_arp ( ERRFILE_NET | 0x00010000 )

View File

@ -181,6 +181,24 @@ static inline size_t iob_tailroom ( struct io_buffer *iobuf ) {
return ( iobuf->end - iobuf->tail );
}
/**
* Create a temporary I/O buffer
*
* @v iobuf I/O buffer
* @v data Data buffer
* @v len Length of data
* @v max_len Length of buffer
*
* It is sometimes useful to use the iob_xxx() methods on temporary
* data buffers.
*/
static inline void iob_populate ( struct io_buffer *iobuf,
void *data, size_t len, size_t max_len ) {
iobuf->head = iobuf->data = data;
iobuf->tail = ( data + len );
iobuf->end = ( data + max_len );
}
extern struct io_buffer * __malloc alloc_iob ( size_t len );
extern void free_iob ( struct io_buffer *iobuf );
extern void iob_pad ( struct io_buffer *iobuf, size_t min_len );