/* Return the maximum number of SG elements in a SG list.  */
u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
/* Return the maximum number of SG elements in a SG list.  */
u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
{
	i2o_status_block *sb = c->status_block.virt;
	u16 sg_count =
	    (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) -
	    body_size;
	if (c->pae_support) {
		sg_count -= 2;
		sg_count /= 3;
	} else
		sg_count /= 2;
	if (c->short_req && (sg_count > 8))
		sg_count = 8;
	return sg_count;
}