/* NIC has two interlinked PCI functions for the same port. */ staticinlinebool ef4_nic_is_dual_func(struct ef4_nic *efx)
{ return ef4_nic_rev(efx) < EF4_REV_FALCON_B0;
}
/* Read the current event from the event queue */ staticinline ef4_qword_t *ef4_event(struct ef4_channel *channel, unsignedint index)
{ return ((ef4_qword_t *) (channel->eventq.buf.addr)) +
(index & channel->eventq_mask);
}
/* See if an event is present * * We check both the high and low dword of the event for all ones. We * wrote all ones when we cleared the event, and no valid event can * have all ones in either its high or low dwords. This approach is * robust against reordering. * * Note that using a single 64-bit comparison is incorrect; even * though the CPU read will be atomic, the DMA write may not be.
*/ staticinlineint ef4_event_present(ef4_qword_t *event)
{ return !(EF4_DWORD_IS_ALL_ONES(event->dword[0]) |
EF4_DWORD_IS_ALL_ONES(event->dword[1]));
}
/* Returns a pointer to the specified transmit descriptor in the TX * descriptor queue belonging to the specified channel.
*/ staticinline ef4_qword_t *
ef4_tx_desc(struct ef4_tx_queue *tx_queue, unsignedint index)
{ return ((ef4_qword_t *) (tx_queue->txd.buf.addr)) + index;
}
/* Get partner of a TX queue, seen as part of the same net core queue */ staticinlinestruct ef4_tx_queue *ef4_tx_queue_partner(struct ef4_tx_queue *tx_queue)
{ if (tx_queue->queue & EF4_TXQ_TYPE_OFFLOAD) return tx_queue - EF4_TXQ_TYPE_OFFLOAD; else return tx_queue + EF4_TXQ_TYPE_OFFLOAD;
}
/* Report whether this TX queue would be empty for the given write_count. * May return false negative.
*/ staticinlinebool __ef4_nic_tx_is_empty(struct ef4_tx_queue *tx_queue, unsignedint write_count)
{ unsignedint empty_read_count = READ_ONCE(tx_queue->empty_read_count);
/* Decide whether to push a TX descriptor to the NIC vs merely writing * the doorbell. This can reduce latency when we are adding a single * descriptor to an empty queue, but is otherwise pointless. Further, * Falcon and Siena have hardware bugs (SF bug 33851) that may be * triggered if we don't check this. * We use the write_count used for the last doorbell push, to get the * NIC's view of the tx queue.
*/ staticinlinebool ef4_nic_may_push_tx_desc(struct ef4_tx_queue *tx_queue, unsignedint write_count)
{ bool was_empty = __ef4_nic_tx_is_empty(tx_queue, write_count);
/** * struct falcon_board_type - board operations and type information * @id: Board type id, as found in NVRAM * @init: Allocate resources and initialise peripheral hardware * @init_phy: Do board-specific PHY initialisation * @fini: Shut down hardware and free resources * @set_id_led: Set state of identifying LED or revert to automatic function * @monitor: Board-specific health check function
*/ struct falcon_board_type {
u8 id; int (*init) (struct ef4_nic *nic); void (*init_phy) (struct ef4_nic *efx); void (*fini) (struct ef4_nic *nic); void (*set_id_led) (struct ef4_nic *efx, enum ef4_led_mode mode); int (*monitor) (struct ef4_nic *nic);
};
/** * struct falcon_board - board information * @type: Type of board * @major: Major rev. ('A', 'B' ...) * @minor: Minor rev. (0, 1, ...) * @i2c_adap: I2C adapter for on-board peripherals * @i2c_data: Data for bit-banging algorithm * @hwmon_client: I2C client for hardware monitor * @ioexp_client: I2C client for power/port control
*/ struct falcon_board { conststruct falcon_board_type *type; int major; int minor; struct i2c_adapter i2c_adap; struct i2c_algo_bit_data i2c_data; struct i2c_client *hwmon_client, *ioexp_client;
};
/** * struct falcon_spi_device - a Falcon SPI (Serial Peripheral Interface) device * @device_id: Controller's id for the device * @size: Size (in bytes) * @addr_len: Number of address bytes in read/write commands * @munge_address: Flag whether addresses should be munged. * Some devices with 9-bit addresses (e.g. AT25040A EEPROM) * use bit 3 of the command byte as address bit A8, rather * than having a two-byte address. If this flag is set, then * commands should be munged in this way. * @erase_command: Erase command (or 0 if sector erase not needed). * @erase_size: Erase sector size (in bytes) * Erase commands affect sectors with this size and alignment. * This must be a power of two. * @block_size: Write block size (in bytes). * Write commands are limited to blocks with this size and alignment.
*/ struct falcon_spi_device { int device_id; unsignedint size; unsignedint addr_len; unsignedint munge_address:1;
u8 erase_command; unsignedint erase_size; unsignedint block_size;
};
/* Some statistics are computed as A - B where A and B each increase * linearly with some hardware counter(s) and the counters are read * asynchronously. If the counters contributing to B are always read * after those contributing to A, the computed value may be lower than * the true value by some variable amount, and may decrease between * subsequent computations. * * We should never allow statistics to decrease or to exceed the true * value. Since the computed value will never be greater than the * true value, we can achieve this by only storing the computed value * when it increases.
*/ staticinlinevoid ef4_update_diff_stat(u64 *stat, u64 diff)
{ if ((s64)(diff - *stat) > 0)
*stat = diff;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.