pull request: sfc-next 2012-02-16
Subsystems (3)
The following changes since commit eb40d89276705a35c9a2e05793ae63411ae357eb:
mlx4: add unicast steering entries to resource_tracker (2012-02-14 14:11:59 -0500)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next.git for-davem
(commit cd2d5b529cdb9bd274f3e4bc68d37d4d63b7f383)
The main change here is the addition of SR-IOV support.
Ben.
Ben Hutchings (18):
sfc: Skip RX end-of-batch work on channels without an RX queue
sfc: Do not retry hardware probe if it schedules a reset
sfc: Replace some literal constants with EFX_PAGE_SIZE/EFX_BUF_SIZE
sfc: Warn if unable to create MTDs
sfc: Add support for configuring RX unicast/multicast default filters
sfc: Add support for TX MAC filters
sfc: Correct MAC filter bitfield definitions
sfc: Generalise driver event generation
sfc: Generate RX fill events based on RX queues, not channels
sfc: Leave interrupts and event queues enabled whenever we can
sfc: Use proper function to test for RX channel in efx_poll()
sfc: Generalise event generation to cover VF-owned event queues
sfc: Make buffer table indices and counts consistently unsigned
sfc: Make all CPU/IRQ/channel/queue counts unsigned
sfc: Add support for 'extra' channel types
sfc: Pass NIC structure into efx_wanted_parallelism()
sfc: Allocate SRAM between buffer table and descriptor caches at init time
sfc: Add SR-IOV back-end support for SFC9000 family
Steve Hodgson (1):
sfc: Disable flow control during flushes
drivers/net/ethernet/sfc/Kconfig | 8 + drivers/net/ethernet/sfc/Makefile | 1 + drivers/net/ethernet/sfc/efx.c | 685 ++++++++------ drivers/net/ethernet/sfc/efx.h | 1 + drivers/net/ethernet/sfc/ethtool.c | 62 +- drivers/net/ethernet/sfc/falcon.c | 12 +- drivers/net/ethernet/sfc/filter.c | 255 +++++- drivers/net/ethernet/sfc/filter.h | 20 +- drivers/net/ethernet/sfc/mcdi.c | 34 + drivers/net/ethernet/sfc/mcdi.h | 2 + drivers/net/ethernet/sfc/mcdi_mac.c | 4 +- drivers/net/ethernet/sfc/mtd.c | 2 +- drivers/net/ethernet/sfc/net_driver.h | 123 ++- drivers/net/ethernet/sfc/nic.c | 524 ++++++----- drivers/net/ethernet/sfc/nic.h | 102 ++- drivers/net/ethernet/sfc/regs.h | 20 +- drivers/net/ethernet/sfc/rx.c | 7 +- drivers/net/ethernet/sfc/siena.c | 14 +- drivers/net/ethernet/sfc/siena_sriov.c | 1642 ++++++++++++++++++++++++++++++++ drivers/net/ethernet/sfc/tx.c | 2 +- drivers/net/ethernet/sfc/vfdi.h | 254 +++++ 21 files changed, 3170 insertions(+), 604 deletions(-) create mode 100644 drivers/net/ethernet/sfc/siena_sriov.c create mode 100644 drivers/net/ethernet/sfc/vfdi.h
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 1/19 sfc: Skip RX end-of-batch work on channels without an RX queue
The code in efx_process_channel() to update the RX queue after each batch of RX completions works out as a no-op on a TX-only channel where the RX queue structure is set to all-zeroes, but
(1) efx_channel_get_rx_queue() will BUG() if DEBUG is defined, and
(2) it's a waste of time.
--- drivers/net/ethernet/sfc/efx.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-)
drivers/net/ethernet/sfc/efx.c +11 -10
@@ -224,19 +224,20 @@ static int efx_process_channel(struct efx_channel *channel, int budget)return 0 ; spent =efx_nic_process_eventq (channel, budget); -if (spent ==0 ) -return 0 ; +if (spent &&efx_channel_has_rx_queue (channel)) { +struct efx_rx_queue *rx_queue = +efx_channel_get_rx_queue (channel); + +/* Deliver last RX packet. */ +if (channel->rx_pkt) { +__efx_rx_packet (channel, channel->rx_pkt); + channel->rx_pkt =NULL ; + } -/* Deliver last RX packet. */ -if (channel->rx_pkt) { -__efx_rx_packet (channel, channel->rx_pkt); - channel->rx_pkt =NULL ; +efx_rx_strategy (channel); +efx_fast_push_rx_descriptors (rx_queue); } -efx_rx_strategy (channel); - -efx_fast_push_rx_descriptors (efx_channel_get_rx_queue (channel)); -return spent; }
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 2/19 sfc: Do not retry hardware probe if it schedules a reset
In reply to Ben HutchingsIf efx_pci_probe_main() schedules an INVISIBLE or ALL reset (but nothing more drastic), we retry it up to 5 times. So far as I'm aware, this was a workaround for bugs in Falcon A0 which were fixed in production silicon. Remove the retry.
--- drivers/net/ethernet/sfc/efx.c | 50 ++++++++++++--------------------------- 1 files changed, 16 insertions(+), 34 deletions(-)
drivers/net/ethernet/sfc/efx.c +16 -34
@@ -2440,7 +2440,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,const struct efx_nic_type *type = (const struct efx_nic_type *) entry->driver_data;struct net_device *net_dev;struct efx_nic *efx; -int i, rc; +int rc;/* Allocate and initialise a struct net_device and struct efx_nic */ net_dev = alloc_etherdev_mqs(sizeof(*efx), EFX_MAX_CORE_TX_QUEUES,
@@ -2473,39 +2473,22 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,if (rc) goto fail2; -/* No serialisation is required with the reset path because -* we're in STATE_INIT. */ -for (i =0 ; i <5 ; i++) { - rc =efx_pci_probe_main (efx); - -/* Serialise against efx_reset(). No more resets will be -* scheduled since efx_stop_all() has been called, and we -* have not and never have been registered with either -* the rtnetlink or driverlink layers. */ -cancel_work_sync (&efx->reset_work); - -if (rc ==0 ) { -if (efx->reset_pending) { -/* If there was a scheduled reset during -* probe, the NIC is probably hosed anyway */ -efx_pci_remove_main (efx); - rc = -EIO ; - }else { -break ; - } - } + rc =efx_pci_probe_main (efx); -/* Retry if a recoverably reset event has been scheduled */ -if (efx->reset_pending & - ~(1 <<RESET_TYPE_INVISIBLE |1 <<RESET_TYPE_ALL ) || - !efx->reset_pending) - goto fail3; +/* Serialise against efx_reset(). No more resets will be +* scheduled since efx_stop_all() has been called, and we have +* not and never have been registered. +*/ +cancel_work_sync (&efx->reset_work); - efx->reset_pending =0 ; - } +if (rc) + goto fail3; -if (rc) { -netif_err (efx, probe, efx->net_dev,"Could not reset NIC\n" ); +/* If there was a scheduled reset during probe, the NIC is +* probably hosed anyway. +*/ +if (efx->reset_pending) { + rc = -EIO ; goto fail4; }
@@ -2515,7 +2498,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, rc =efx_register_netdev (efx);if (rc) - goto fail5; + goto fail4;netif_dbg (efx, probe, efx->net_dev,"initialisation successful\n" );
@@ -2524,9 +2507,8 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,rtnl_unlock ();return 0 ; - fail5: -efx_pci_remove_main (efx); fail4: +efx_pci_remove_main (efx); fail3:efx_fini_io (efx); fail2:
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 3/19 sfc: Replace some literal constants with EFX_PAGE_SIZE/EFX_BUF_SIZE
In reply to Ben HutchingsThe 'page size' for PCIe DMA, i.e. the alignment of boundaries at which DMA must be broken, is 4KB. Name this value as EFX_PAGE_SIZE and use it in efx_max_tx_len(). Redefine EFX_BUF_SIZE as EFX_PAGE_SIZE since its value is also a result of that requirement, and use it in efx_init_special_buffer().
--- drivers/net/ethernet/sfc/nic.c | 5 +---- drivers/net/ethernet/sfc/nic.h | 5 +++++ drivers/net/ethernet/sfc/tx.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/sfc/nic.c +1 -4
@@ -54,9 +54,6 @@#define EFX_FLUSH_INTERVAL 10#define EFX_FLUSH_POLL_COUNT 100 -/* Size and alignment of special buffers (4KB) */ -#define EFX_BUF_SIZE 4096 -/* Depth of RX flush request fifo */ #define EFX_RX_FLUSH_COUNT 4
@@ -196,7 +193,7 @@ efx_init_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer)/* Write buffer descriptors to NIC */ for (i =0 ; i < buffer->entries; i++) { index = buffer->index + i; - dma_addr = buffer->dma_addr + (i *4096 ); + dma_addr = buffer->dma_addr + (i *EFX_BUF_SIZE );netif_dbg (efx, probe, efx->net_dev,"mapping special buffer %d at %llx\n" , index, (unsigned long long )dma_addr);
drivers/net/ethernet/sfc/nic.h +5 -0
@@ -65,6 +65,11 @@ enum {#define FALCON_GMAC_LOOPBACKS \ (1 << LOOPBACK_GMAC) +/* Alignment of PCIe DMA boundaries (4KB) */ +#define EFX_PAGE_SIZE 4096 +/* Size and alignment of buffer table entries (same) */ +#define EFX_BUF_SIZE EFX_PAGE_SIZE +/** * struct falcon_board_type - board operations and type information * @id: Board type id, as found in NVRAM
drivers/net/ethernet/sfc/tx.c +1 -1
@@ -110,7 +110,7 @@ efx_max_tx_len(struct efx_nic *efx, dma_addr_t dma_addr)* little benefit from using descriptors that cross those * boundaries and we keep things simple by not doing so. */ -unsigned len = (~dma_addr &0xfff ) +1 ; +unsigned len = (~dma_addr & (EFX_PAGE_SIZE -1 )) +1 ;/* Work around hardware bug for unaligned buffers. */ if (EFX_WORKAROUND_5391 (efx) && (dma_addr &0xf ))
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 4/19 sfc: Warn if unable to create MTDs
In reply to Ben HutchingsLog an explicit warning if we are unable to create MTDs for a net device. Also correct the comment about why mtd_device_register() may fail; there is no longer an MTD table to fill up.
--- drivers/net/ethernet/sfc/efx.c | 7 ++++++- drivers/net/ethernet/sfc/mtd.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/sfc/efx.c +6 -1
@@ -2502,9 +2502,14 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,netif_dbg (efx, probe, efx->net_dev,"initialisation successful\n" ); +/* Try to create MTDs, but allow this to fail */ rtnl_lock (); -efx_mtd_probe (efx);/* allowed to fail */ + rc =efx_mtd_probe (efx);rtnl_unlock (); +if (rc) +netif_warn (efx, probe, efx->net_dev, +"failed to create MTDs (%d)\n" , rc); +return 0 ; fail4:
drivers/net/ethernet/sfc/mtd.c +1 -1
@@ -280,7 +280,7 @@ fail: --part;efx_mtd_remove_partition (part); } -/* mtd_device_register() returns 1 if the MTD table is full */ +/* Failure is unlikely here, but probably means we're out of memory */ return -ENOMEM ; }
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 5/19 sfc: Add support for configuring RX unicast/multicast default filters
In reply to Ben HutchingsOn Siena all received packets that don't match a more specific filter will match the unicast or multicast default filter. Currently we leave these set to the default values (RSS with base queue number of 0). Allow them to be reconfigured to select a single RX queue.
These default filters are programmed through the FILTER_CTL register, but we represent them internally as an additional table of size 2.
--- drivers/net/ethernet/sfc/ethtool.c | 59 ++++++++--- drivers/net/ethernet/sfc/filter.c | 196 ++++++++++++++++++++++++++++++------ drivers/net/ethernet/sfc/filter.h | 6 + 3 files changed, 214 insertions(+), 47 deletions(-)
drivers/net/ethernet/sfc/ethtool.c +42 -17
@@ -808,11 +808,16 @@ static int efx_ethtool_reset(struct net_device *net_dev, u32 *flags)return efx_reset (efx, rc); } +/* MAC address mask including only MC flag */ +static const u8 mac_addr_mc_mask[ETH_ALEN ] = {0x01 ,0 ,0 ,0 ,0 ,0 }; +static int efx_ethtool_get_class_rule (struct efx_nic *efx,struct ethtool_rx_flow_spec *rule) {struct ethtool_tcpip4_spec *ip_entry = &rule->h_u.tcp_ip4_spec;struct ethtool_tcpip4_spec *ip_mask = &rule->m_u.tcp_ip4_spec; +struct ethhdr *mac_entry = &rule->h_u.ether_spec; +struct ethhdr *mac_mask = &rule->m_u.ether_spec;struct efx_filter_spec spec;u16 vid;u8 proto;
@@ -828,11 +833,18 @@ static int efx_ethtool_get_class_rule(struct efx_nic *efx,else rule->ring_cookie = spec.dmaq_id; - rc =efx_filter_get_eth_local (&spec, &vid, - rule->h_u.ether_spec.h_dest); +if (spec.type ==EFX_FILTER_MC_DEF || spec.type ==EFX_FILTER_UC_DEF ) { + rule->flow_type =ETHER_FLOW ; +memcpy (mac_mask->h_dest, mac_addr_mc_mask,ETH_ALEN ); +if (spec.type ==EFX_FILTER_MC_DEF ) +memcpy (mac_entry->h_dest, mac_addr_mc_mask,ETH_ALEN ); +return 0 ; + } + + rc =efx_filter_get_eth_local (&spec, &vid, mac_entry->h_dest);if (rc ==0 ) { rule->flow_type =ETHER_FLOW ; -memset (rule->m_u.ether_spec.h_dest, ~0 ,ETH_ALEN ); +memset (mac_mask->h_dest, ~0 ,ETH_ALEN );if (vid !=EFX_FILTER_VID_UNSPEC ) { rule->flow_type |=FLOW_EXT ; rule->h_ext.vlan_tci =htons (vid);
@@ -1001,27 +1013,40 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx, }case ETHER_FLOW |FLOW_EXT : -/* Must match all or none of VID */ -if (rule->m_ext.vlan_tci !=htons (0xfff ) && - rule->m_ext.vlan_tci !=0 ) -return -EINVAL ; -case ETHER_FLOW : -/* Must match all of destination */ -if (!is_broadcast_ether_addr (mac_mask->h_dest)) -return -EINVAL ; -/* and nothing else */ +case ETHER_FLOW : { +u16 vlan_tag_mask = (rule->flow_type &FLOW_EXT ? +ntohs (rule->m_ext.vlan_tci) :0 ); + +/* Must not match on source address or Ethertype */ if (!is_zero_ether_addr (mac_mask->h_source) || mac_mask->h_proto)return -EINVAL ; - rc =efx_filter_set_eth_local ( - &spec, - (rule->flow_type &FLOW_EXT && rule->m_ext.vlan_tci) ? -ntohs (rule->h_ext.vlan_tci) :EFX_FILTER_VID_UNSPEC , - mac_entry->h_dest); +/* Is it a default UC or MC filter? */ +if (!compare_ether_addr (mac_mask->h_dest, mac_addr_mc_mask) && + vlan_tag_mask ==0 ) { +if (is_multicast_ether_addr (mac_entry->h_dest)) + rc =efx_filter_set_mc_def (&spec); +else + rc =efx_filter_set_uc_def (&spec); + } +/* Otherwise, it must match all of destination and all +* or none of VID. +*/ +else if (is_broadcast_ether_addr (mac_mask->h_dest) && + (vlan_tag_mask ==0xfff || vlan_tag_mask ==0 )) { + rc =efx_filter_set_eth_local ( + &spec, + vlan_tag_mask ? +ntohs (rule->h_ext.vlan_tci) :EFX_FILTER_VID_UNSPEC , + mac_entry->h_dest); + }else { + rc = -EINVAL ; + }if (rc)return rc;break ; + }default :return -EINVAL ;
drivers/net/ethernet/sfc/filter.c +166 -30
318 lines not on this page · raw message
drivers/net/ethernet/sfc/filter.h +6 -0
@@ -20,6 +20,8 @@* @EFX_FILTER_UDP_WILD: Matching UDP/IPv4 destination (host, port) * @EFX_FILTER_MAC_FULL: Matching Ethernet destination MAC address, VID * @EFX_FILTER_MAC_WILD: Matching Ethernet destination MAC address +* @EFX_FILTER_UC_DEF: Matching all otherwise unmatched unicast +* @EFX_FILTER_MC_DEF: Matching all otherwise unmatched multicast * @EFX_FILTER_UNSPEC: Match type is unspecified * * Falcon NICs only support the TCP/IPv4 and UDP/IPv4 filter types.
@@ -31,6 +33,8 @@ enum efx_filter_type {EFX_FILTER_UDP_WILD ,EFX_FILTER_MAC_FULL =4 ,EFX_FILTER_MAC_WILD , +EFX_FILTER_UC_DEF =8 , +EFX_FILTER_MC_DEF ,EFX_FILTER_TYPE_COUNT ,/* number of specific types */ EFX_FILTER_UNSPEC = 0xf, };
@@ -117,6 +121,8 @@ extern int efx_filter_set_eth_local(struct efx_filter_spec *spec, u16 vid, const u8 *addr);extern int efx_filter_get_eth_local (const struct efx_filter_spec *spec,u16 *vid,u8 *addr); +extern int efx_filter_set_uc_def (struct efx_filter_spec *spec); +extern int efx_filter_set_mc_def (struct efx_filter_spec *spec);enum {EFX_FILTER_VID_UNSPEC =0xffff , };
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 6/19 sfc: Add support for TX MAC filters
In reply to Ben HutchingsOn Siena each TX queue can be configured to send only packets for which there is a TX MAC filter that matches the source MAC address, queue ID, and optionally VID. This will be used to implement the 'spoofchk' feature for SR-IOV virtual functions.
--- drivers/net/ethernet/sfc/filter.c | 63 ++++++++++++++++++++++++++++++++++-- drivers/net/ethernet/sfc/filter.h | 14 +++++++- 2 files changed, 72 insertions(+), 5 deletions(-)
drivers/net/ethernet/sfc/filter.c +59 -4
@@ -36,6 +36,7 @@ enum efx_filter_table_id {EFX_FILTER_TABLE_RX_IP =0 ,EFX_FILTER_TABLE_RX_MAC ,EFX_FILTER_TABLE_RX_DEF , +EFX_FILTER_TABLE_TX_MAC , EFX_FILTER_TABLE_COUNT, };
@@ -97,8 +98,9 @@ efx_filter_spec_table_id(const struct efx_filter_spec *spec)BUILD_BUG_ON (EFX_FILTER_TABLE_RX_IP != (EFX_FILTER_UDP_WILD >>2 ));BUILD_BUG_ON (EFX_FILTER_TABLE_RX_MAC != (EFX_FILTER_MAC_FULL >>2 ));BUILD_BUG_ON (EFX_FILTER_TABLE_RX_MAC != (EFX_FILTER_MAC_WILD >>2 )); +BUILD_BUG_ON (EFX_FILTER_TABLE_TX_MAC !=EFX_FILTER_TABLE_RX_MAC +2 );EFX_BUG_ON_PARANOID (spec->type ==EFX_FILTER_UNSPEC ); -return spec->type >>2 ; +return (spec->type >>2 ) + ((spec->flags &EFX_FILTER_FLAG_TX ) ?2 :0 ); } static struct efx_filter_table *
@@ -179,6 +181,29 @@ static void efx_filter_push_rx_config(struct efx_nic *efx)efx_writeo (efx, &filter_ctl,FR_BZ_RX_FILTER_CTL ); } +static void efx_filter_push_tx_limits (struct efx_nic *efx) +{ +struct efx_filter_state *state = efx->filter_state; +struct efx_filter_table *table; +efx_oword_t tx_cfg; + +efx_reado (efx, &tx_cfg,FR_AZ_TX_CFG ); + + table = &state->table[EFX_FILTER_TABLE_TX_MAC ]; +if (table->size) { +EFX_SET_OWORD_FIELD ( + tx_cfg,FRF_CZ_TX_ETH_FILTER_FULL_SEARCH_RANGE , + table->search_depth[EFX_FILTER_MAC_FULL ] + +FILTER_CTL_SRCH_FUDGE_FULL ); +EFX_SET_OWORD_FIELD ( + tx_cfg,FRF_CZ_TX_ETH_FILTER_WILD_SEARCH_RANGE , + table->search_depth[EFX_FILTER_MAC_WILD ] + +FILTER_CTL_SRCH_FUDGE_WILD ); + } + +efx_writeo (efx, &tx_cfg,FR_AZ_TX_CFG ); +} +static inline void __efx_filter_set_ipv4 (struct efx_filter_spec *spec,__be32 host1,__be16 port1,__be32 host2,__be16 port2)
@@ -333,7 +358,8 @@ int efx_filter_get_ipv4_full(const struct efx_filter_spec *spec,int efx_filter_set_eth_local (struct efx_filter_spec *spec,u16 vid,const u8 *addr) { -EFX_BUG_ON_PARANOID (!(spec->flags &EFX_FILTER_FLAG_RX )); +EFX_BUG_ON_PARANOID (!(spec->flags & + (EFX_FILTER_FLAG_RX |EFX_FILTER_FLAG_TX )));/* This cannot currently be combined with other filtering */ if (spec->type !=EFX_FILTER_UNSPEC )
@@ -471,6 +497,18 @@ static u32 efx_filter_build(efx_oword_t *filter, struct efx_filter_spec *spec)break ; } +case EFX_FILTER_TABLE_TX_MAC : { +bool is_wild = spec->type ==EFX_FILTER_MAC_WILD ; +EFX_POPULATE_OWORD_5 (*filter, +FRF_CZ_TMFT_TXQ_ID , spec->dmaq_id, +FRF_CZ_TMFT_WILDCARD_MATCH , is_wild, +FRF_CZ_TMFT_SRC_MAC_HI , spec->data[2 ], +FRF_CZ_TMFT_SRC_MAC_LO , spec->data[1 ], +FRF_CZ_TMFT_VLAN_ID , spec->data[0 ]); + data3 = is_wild | spec->dmaq_id <<1 ; +break ; + } +default :BUG (); }
@@ -485,6 +523,10 @@ static bool efx_filter_equal(const struct efx_filter_spec *left, memcmp(left->data, right->data, sizeof(left->data)))return false; +if (left->flags &EFX_FILTER_FLAG_TX && + left->dmaq_id != right->dmaq_id) +return false; +return true; }
@@ -581,8 +623,11 @@ static inline u8 efx_filter_id_flags(u32 id)if (match_pri <EFX_FILTER_MATCH_PRI_NORMAL_BASE )return EFX_FILTER_FLAG_RX |EFX_FILTER_FLAG_RX_OVERRIDE_IP ; -else +else if (match_pri <= +EFX_FILTER_MATCH_PRI_NORMAL_BASE +EFX_FILTER_TABLE_RX_DEF )return EFX_FILTER_FLAG_RX ; +else +return EFX_FILTER_FLAG_TX ; }u32 efx_filter_get_rx_id_limit (struct efx_nic *efx)
@@ -660,7 +705,10 @@ s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec, }else {if (table->search_depth[spec->type] < depth) { table->search_depth[spec->type] = depth; -efx_filter_push_rx_config (efx); +if (spec->flags &EFX_FILTER_FLAG_TX ) +efx_filter_push_tx_limits (efx); +else +efx_filter_push_rx_config (efx); } efx_writeo(efx, &filter,
@@ -918,6 +966,7 @@ void efx_restore_filters(struct efx_nic *efx) }efx_filter_push_rx_config (efx); +efx_filter_push_tx_limits (efx);spin_unlock_bh (&state->lock); }
@@ -960,6 +1009,12 @@ int efx_probe_filters(struct efx_nic *efx) table = &state->table[EFX_FILTER_TABLE_RX_DEF ]; table->id =EFX_FILTER_TABLE_RX_DEF ; table->size =EFX_FILTER_SIZE_RX_DEF ; + + table = &state->table[EFX_FILTER_TABLE_TX_MAC ]; + table->id =EFX_FILTER_TABLE_TX_MAC ; + table->offset =FR_CZ_TX_MAC_FILTER_TBL0 ; + table->size =FR_CZ_TX_MAC_FILTER_TBL0_ROWS ; + table->step =FR_CZ_TX_MAC_FILTER_TBL0_STEP ; }for (table_id =0 ; table_id <EFX_FILTER_TABLE_COUNT ; table_id++) {
drivers/net/ethernet/sfc/filter.h +13 -1
@@ -43,7 +43,8 @@ enum efx_filter_type {* enum efx_filter_priority - priority of a hardware filter specification * @EFX_FILTER_PRI_HINT: Performance hint * @EFX_FILTER_PRI_MANUAL: Manually configured filter -* @EFX_FILTER_PRI_REQUIRED: Required for correct behaviour +* @EFX_FILTER_PRI_REQUIRED: Required for correct behaviour (user-level +* networking and SR-IOV) */ enum efx_filter_priority {EFX_FILTER_PRI_HINT =0 ,
@@ -64,12 +65,14 @@ enum efx_filter_priority {* any IP filter that matches the same packet. By default, IP * filters take precedence. * @EFX_FILTER_FLAG_RX: Filter is for RX +* @EFX_FILTER_FLAG_TX: Filter is for TX */ enum efx_filter_flags {EFX_FILTER_FLAG_RX_RSS =0x01 ,EFX_FILTER_FLAG_RX_SCATTER =0x02 ,EFX_FILTER_FLAG_RX_OVERRIDE_IP =0x04 ,EFX_FILTER_FLAG_RX =0x08 , +EFX_FILTER_FLAG_TX =0x10 , };/**
@@ -107,6 +110,15 @@ static inline void efx_filter_init_rx(struct efx_filter_spec *spec, spec->dmaq_id = rxq_id; } +static inline void efx_filter_init_tx (struct efx_filter_spec *spec, +unsigned txq_id) +{ + spec->type =EFX_FILTER_UNSPEC ; + spec->priority =EFX_FILTER_PRI_REQUIRED ; + spec->flags =EFX_FILTER_FLAG_TX ; + spec->dmaq_id = txq_id; +} +extern int efx_filter_set_ipv4_local (struct efx_filter_spec *spec,u8 proto,__be32 host,__be16 port); extern int efx_filter_get_ipv4_local(const struct efx_filter_spec *spec,
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 7/19 sfc: Correct MAC filter bitfield definitions
In reply to Ben HutchingsThe RMFT_DEST_MAC and TMFT_SRC_MAC register fields were previously documented as 44 bits wide, whereas a MAC address has 48 bits. Thankfully the hardware uses the correct width and the driver has used separate definitions that divide each of these into 32-bit and 16-bit fields.
Fix the initial definitions for these fields and rewrite the latter definitions to use them.
--- drivers/net/ethernet/sfc/regs.h | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/ethernet/sfc/regs.h +10 -10
@@ -2446,8 +2446,8 @@#define FRF_CZ_RMFT_RXQ_ID_WIDTH 12#define FRF_CZ_RMFT_WILDCARD_MATCH_LBN 60#define FRF_CZ_RMFT_WILDCARD_MATCH_WIDTH 1 -#define FRF_CZ_RMFT_DEST_MAC_LBN 16 -#define FRF_CZ_RMFT_DEST_MAC_WIDTH 44 +#define FRF_CZ_RMFT_DEST_MAC_LBN 12 +#define FRF_CZ_RMFT_DEST_MAC_WIDTH 48#define FRF_CZ_RMFT_VLAN_ID_LBN 0#define FRF_CZ_RMFT_VLAN_ID_WIDTH 12
@@ -2523,8 +2523,8 @@#define FRF_CZ_TMFT_TXQ_ID_WIDTH 12#define FRF_CZ_TMFT_WILDCARD_MATCH_LBN 60#define FRF_CZ_TMFT_WILDCARD_MATCH_WIDTH 1 -#define FRF_CZ_TMFT_SRC_MAC_LBN 16 -#define FRF_CZ_TMFT_SRC_MAC_WIDTH 44 +#define FRF_CZ_TMFT_SRC_MAC_LBN 12 +#define FRF_CZ_TMFT_SRC_MAC_WIDTH 48#define FRF_CZ_TMFT_VLAN_ID_LBN 0#define FRF_CZ_TMFT_VLAN_ID_WIDTH 12
@@ -2895,17 +2895,17 @@/* RX_MAC_FILTER_TBL0 */ /* RMFT_DEST_MAC is wider than 32 bits */ -#define FRF_CZ_RMFT_DEST_MAC_LO_LBN 12 +#define FRF_CZ_RMFT_DEST_MAC_LO_LBN FRF_CZ_RMFT_DEST_MAC_LBN#define FRF_CZ_RMFT_DEST_MAC_LO_WIDTH 32 -#define FRF_CZ_RMFT_DEST_MAC_HI_LBN 44 -#define FRF_CZ_RMFT_DEST_MAC_HI_WIDTH 16 +#define FRF_CZ_RMFT_DEST_MAC_HI_LBN (FRF_CZ_RMFT_DEST_MAC_LBN + 32) +#define FRF_CZ_RMFT_DEST_MAC_HI_WIDTH (FRF_CZ_RMFT_DEST_MAC_WIDTH - 32)/* TX_MAC_FILTER_TBL0 */ /* TMFT_SRC_MAC is wider than 32 bits */ -#define FRF_CZ_TMFT_SRC_MAC_LO_LBN 12 +#define FRF_CZ_TMFT_SRC_MAC_LO_LBN FRF_CZ_TMFT_SRC_MAC_LBN#define FRF_CZ_TMFT_SRC_MAC_LO_WIDTH 32 -#define FRF_CZ_TMFT_SRC_MAC_HI_LBN 44 -#define FRF_CZ_TMFT_SRC_MAC_HI_WIDTH 16 +#define FRF_CZ_TMFT_SRC_MAC_HI_LBN (FRF_CZ_TMFT_SRC_MAC_LBN + 32) +#define FRF_CZ_TMFT_SRC_MAC_HI_WIDTH (FRF_CZ_TMFT_SRC_MAC_WIDTH - 32)/* TX_PACE_TBL */ /* Values >20 are documented as reserved, but will result in a queue going
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 8/19 sfc: Generalise driver event generation
In reply to Ben Hutchings--- drivers/net/ethernet/sfc/nic.c | 51 +++++++++++++++++++++------------------ 1 files changed, 27 insertions(+), 24 deletions(-)
drivers/net/ethernet/sfc/nic.c +27 -24
@@ -57,13 +57,17 @@/* Depth of RX flush request fifo */ #define EFX_RX_FLUSH_COUNT 4 -/* Generated event code for efx_generate_test_event() */ -#define EFX_CHANNEL_MAGIC_TEST (_channel) \ - (0x00010100 + (_channel)->channel) +/* Driver generated events */ +#define _EFX_CHANNEL_MAGIC_TEST 0x000101 +#define _EFX_CHANNEL_MAGIC_FILL 0x000102 -/* Generated event code for efx_generate_fill_event() */ -#define EFX_CHANNEL_MAGIC_FILL (_channel) \ - (0x00010200 + (_channel)->channel) +#define _EFX_CHANNEL_MAGIC (_code, _data) ((_code) << 8 | (_data)) +#define _EFX_CHANNEL_MAGIC_CODE (_magic) ((_magic) >> 8) + +#define EFX_CHANNEL_MAGIC_TEST (_channel) \ + _EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_TEST, (_channel)->channel) +#define EFX_CHANNEL_MAGIC_FILL (_channel) \ + _EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_FILL, (_channel)->channel)/************************************************************************** *
@@ -693,6 +697,16 @@ static void efx_generate_event(struct efx_channel *channel, efx_qword_t *event)efx_writeo (channel->efx, &drv_ev_reg,FR_AZ_DRV_EV ); } +static void efx_magic_event (struct efx_channel *channel,u32 magic) +{ +efx_qword_t event; + +EFX_POPULATE_QWORD_2 (event,FSF_AZ_EV_CODE , +FSE_AZ_EV_CODE_DRV_GEN_EV , +FSF_AZ_DRV_GEN_EV_MAGIC , magic); +efx_generate_event (channel, &event); +} +/* Handle a transmit completion event * * The NIC batches TX completion events; the message we receive is of
@@ -898,12 +912,13 @@ static void efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event) { struct efx_nic *efx = channel->efx; -unsigned code; +unsigned magic; - code =EFX_QWORD_FIELD (*event,FSF_AZ_DRV_GEN_EV_MAGIC ); -if (code ==EFX_CHANNEL_MAGIC_TEST (channel)) + magic =EFX_QWORD_FIELD (*event,FSF_AZ_DRV_GEN_EV_MAGIC ); + +if (magic ==EFX_CHANNEL_MAGIC_TEST (channel)) ;/* ignore */ -else if (code ==EFX_CHANNEL_MAGIC_FILL (channel)) +else if (magic ==EFX_CHANNEL_MAGIC_FILL (channel))/* The queue must be empty, so we won't receive any rx * events, so efx_process_channel() won't refill the * queue. Refill it here */
@@ -1132,24 +1147,12 @@ void efx_nic_remove_eventq(struct efx_channel *channel)void efx_nic_generate_test_event (struct efx_channel *channel) { -unsigned int magic =EFX_CHANNEL_MAGIC_TEST (channel); -efx_qword_t test_event; - -EFX_POPULATE_QWORD_2 (test_event,FSF_AZ_EV_CODE , -FSE_AZ_EV_CODE_DRV_GEN_EV , -FSF_AZ_DRV_GEN_EV_MAGIC , magic); -efx_generate_event (channel, &test_event); +efx_magic_event (channel,EFX_CHANNEL_MAGIC_TEST (channel)); }void efx_nic_generate_fill_event (struct efx_channel *channel) { -unsigned int magic =EFX_CHANNEL_MAGIC_FILL (channel); -efx_qword_t test_event; - -EFX_POPULATE_QWORD_2 (test_event,FSF_AZ_EV_CODE , -FSE_AZ_EV_CODE_DRV_GEN_EV , -FSF_AZ_DRV_GEN_EV_MAGIC , magic); -efx_generate_event (channel, &test_event); +efx_magic_event (channel,EFX_CHANNEL_MAGIC_FILL (channel)); }/**************************************************************************
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 9/19 sfc: Generate RX fill events based on RX queues, not channels
In reply to Ben HutchingsThis makes it harder to accidentally send such events to TX-only channels.
--- drivers/net/ethernet/sfc/nic.c | 17 +++++++++++------ drivers/net/ethernet/sfc/nic.h | 2 +- drivers/net/ethernet/sfc/rx.c | 3 +-- 3 files changed, 13 insertions(+), 9 deletions(-)
drivers/net/ethernet/sfc/nic.c +11 -6
@@ -66,8 +66,9 @@#define EFX_CHANNEL_MAGIC_TEST (_channel) \ _EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_TEST, (_channel)->channel) -#define EFX_CHANNEL_MAGIC_FILL (_channel) \ - _EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_FILL, (_channel)->channel) +#define EFX_CHANNEL_MAGIC_FILL (_rx_queue) \ + _EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_FILL, \ + efx_rx_queue_index(_rx_queue))/************************************************************************** *
@@ -912,17 +913,20 @@ static void efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event) { struct efx_nic *efx = channel->efx; +struct efx_rx_queue *rx_queue = +efx_channel_has_rx_queue (channel) ? +efx_channel_get_rx_queue (channel) :NULL ;unsigned magic; magic =EFX_QWORD_FIELD (*event,FSF_AZ_DRV_GEN_EV_MAGIC );if (magic ==EFX_CHANNEL_MAGIC_TEST (channel)) ;/* ignore */ -else if (magic ==EFX_CHANNEL_MAGIC_FILL (channel)) +else if (rx_queue && magic ==EFX_CHANNEL_MAGIC_FILL (rx_queue))/* The queue must be empty, so we won't receive any rx * events, so efx_process_channel() won't refill the * queue. Refill it here */ -efx_fast_push_rx_descriptors (efx_channel_get_rx_queue (channel)); +efx_fast_push_rx_descriptors (rx_queue); else netif_dbg(efx, hw, efx->net_dev, "channel %d received " "generated event "EFX_QWORD_FMT"\n",
@@ -1150,9 +1154,10 @@ void efx_nic_generate_test_event(struct efx_channel *channel)efx_magic_event (channel,EFX_CHANNEL_MAGIC_TEST (channel)); } -void efx_nic_generate_fill_event (struct efx_channel *channel) +void efx_nic_generate_fill_event (struct efx_rx_queue *rx_queue) { -efx_magic_event (channel,EFX_CHANNEL_MAGIC_FILL (channel)); +efx_magic_event (efx_rx_queue_channel (rx_queue), +EFX_CHANNEL_MAGIC_FILL (rx_queue)); }/**************************************************************************
drivers/net/ethernet/sfc/nic.h +1 -1
@@ -195,6 +195,7 @@ extern void efx_nic_init_rx(struct efx_rx_queue *rx_queue);extern void efx_nic_fini_rx (struct efx_rx_queue *rx_queue);extern void efx_nic_remove_rx (struct efx_rx_queue *rx_queue);extern void efx_nic_notify_rx_desc (struct efx_rx_queue *rx_queue); +extern void efx_nic_generate_fill_event (struct efx_rx_queue *rx_queue);/* Event data path */ extern int efx_nic_probe_eventq (struct efx_channel *channel);
@@ -216,7 +217,6 @@ extern void falcon_update_stats_xmac(struct efx_nic *efx);extern int efx_nic_init_interrupt (struct efx_nic *efx);extern void efx_nic_enable_interrupts (struct efx_nic *efx);extern void efx_nic_generate_test_event (struct efx_channel *channel); -extern void efx_nic_generate_fill_event (struct efx_channel *channel);extern void efx_nic_generate_interrupt (struct efx_nic *efx);extern void efx_nic_disable_interrupts (struct efx_nic *efx);extern void efx_nic_fini_interrupt (struct efx_nic *efx);
drivers/net/ethernet/sfc/rx.c +1 -2
@@ -405,10 +405,9 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue)void efx_rx_slow_fill (unsigned long context) {struct efx_rx_queue *rx_queue = (struct efx_rx_queue *)context; -struct efx_channel *channel =efx_rx_queue_channel (rx_queue);/* Post an event to cause NAPI to run and refill the queue */ -efx_nic_generate_fill_event (channel); +efx_nic_generate_fill_event (rx_queue); ++rx_queue->slow_fill_count; }
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 10/19 sfc: Leave interrupts and event queues enabled whenever we can
In reply to Ben HutchingsWhen SR-IOV is enabled we may receive FLR (Function-Level Reset) events, associated queue flush events and requests from VF drivers at any time. Therefore we need to keep event queues and interrupts enabled whenever possible.
Currently we stop interrupt-driven event processing before flushing RX and TX queues; efx_nic_flush_queues() then polls event queues for flush events and discards any others it finds. Change it to work with the regular event handling functions.
Currently efx_start_channel() fills RX queues synchronously when a device is brought up. This could now race with NAPI, so change it to send fill events.
This was almost entirely written by Steve Hodgson, formerly [email protected].
--- drivers/net/ethernet/sfc/efx.c | 237 ++++++++++------------ drivers/net/ethernet/sfc/net_driver.h | 36 ++-- drivers/net/ethernet/sfc/nic.c | 349 +++++++++++++++++---------------- drivers/net/ethernet/sfc/rx.c | 4 + 4 files changed, 308 insertions(+), 318 deletions(-)
drivers/net/ethernet/sfc/efx.c +109 -128
@@ -186,6 +186,8 @@ MODULE_PARM_DESC(debug, "Bitmapped debugging message enable value");* *************************************************************************/ +static void efx_start_interrupts (struct efx_nic *efx); +static void efx_stop_interrupts (struct efx_nic *efx);static void efx_remove_channels (struct efx_nic *efx);static void efx_remove_port (struct efx_nic *efx);static void efx_init_napi (struct efx_nic *efx);
@@ -217,10 +219,9 @@ static void efx_stop_all(struct efx_nic *efx);*/ static int efx_process_channel (struct efx_channel *channel,int budget) { -struct efx_nic *efx = channel->efx;int spent; -if (unlikely (efx->reset_pending || !channel->enabled)) +if (unlikely (!channel->enabled))return 0 ; spent =efx_nic_process_eventq (channel, budget);
@@ -233,9 +234,10 @@ static int efx_process_channel(struct efx_channel *channel, int budget)__efx_rx_packet (channel, channel->rx_pkt); channel->rx_pkt =NULL ; } - -efx_rx_strategy (channel); -efx_fast_push_rx_descriptors (rx_queue); +if (rx_queue->enabled) { +efx_rx_strategy (channel); +efx_fast_push_rx_descriptors (rx_queue); + } }return spent;
@@ -387,6 +389,34 @@ static void efx_init_eventq(struct efx_channel *channel)efx_nic_init_eventq (channel); } +/* Enable event queue processing and NAPI */ +static void efx_start_eventq (struct efx_channel *channel) +{ +netif_dbg (channel->efx, ifup, channel->efx->net_dev, +"chan %d start event queue\n" , channel->channel); + +/* The interrupt handler for this channel may set work_pending +* as soon as we enable it. Make sure it's cleared before +* then. Similarly, make sure it sees the enabled flag set. +*/ + channel->work_pending = false; + channel->enabled = true; +smp_wmb (); + +napi_enable (&channel->napi_str); +efx_nic_eventq_read_ack (channel); +} + +/* Disable event queue processing and NAPI */ +static void efx_stop_eventq (struct efx_channel *channel) +{ +if (!channel->enabled) +return ; + +napi_disable (&channel->napi_str); + channel->enabled = false; +} +static void efx_fini_eventq (struct efx_channel *channel) { netif_dbg(channel->efx, drv, channel->efx->net_dev,
@@ -556,7 +586,7 @@ fail:* to propagate configuration changes (mtu, checksum offload), or * to clear hardware error conditions */ -static void efx_init_channels (struct efx_nic *efx) +static void efx_start_datapath (struct efx_nic *efx) {struct efx_tx_queue *tx_queue;struct efx_rx_queue *rx_queue;
@@ -575,68 +605,26 @@ static void efx_init_channels(struct efx_nic *efx)/* Initialise the channels */ efx_for_each_channel (channel, efx) { -netif_dbg (channel->efx, drv, channel->efx->net_dev, -"init chan %d\n" , channel->channel); - -efx_init_eventq (channel); -efx_for_each_channel_tx_queue (tx_queue, channel)efx_init_tx_queue (tx_queue);/* The rx buffer allocation strategy is MTU dependent */ efx_rx_strategy (channel); -efx_for_each_channel_rx_queue (rx_queue, channel) +efx_for_each_channel_rx_queue (rx_queue, channel) {efx_init_rx_queue (rx_queue); +efx_nic_generate_fill_event (rx_queue); + }WARN_ON (channel->rx_pkt !=NULL );efx_rx_strategy (channel); } -} - -/* This enables event queue processing and packet transmission. -* -* Note that this function is not allowed to fail, since that would -* introduce too much complexity into the suspend/resume path. -*/ -static void efx_start_channel (struct efx_channel *channel) -{ -struct efx_rx_queue *rx_queue; - -netif_dbg (channel->efx, ifup, channel->efx->net_dev, -"starting chan %d\n" , channel->channel); - -/* The interrupt handler for this channel may set work_pending -* as soon as we enable it. Make sure it's cleared before -* then. Similarly, make sure it sees the enabled flag set. */ - channel->work_pending = false; - channel->enabled = true; -smp_wmb (); - -/* Fill the queues before enabling NAPI */ -efx_for_each_channel_rx_queue (rx_queue, channel) -efx_fast_push_rx_descriptors (rx_queue); - -napi_enable (&channel->napi_str); -} -/* This disables event queue processing and packet transmission. -* This function does not guarantee that all queue processing -* (e.g. RX refill) is complete. -*/ -static void efx_stop_channel (struct efx_channel *channel) -{ -if (!channel->enabled) -return ; - -netif_dbg (channel->efx, ifdown, channel->efx->net_dev, -"stop chan %d\n" , channel->channel); - - channel->enabled = false; -napi_disable (&channel->napi_str); +if (netif_device_present (efx->net_dev)) +netif_tx_wake_all_queues (efx->net_dev); } -static void efx_fini_channels (struct efx_nic *efx) +static void efx_stop_datapath (struct efx_nic *efx) {struct efx_channel *channel;struct efx_tx_queue *tx_queue;
@@ -663,14 +651,21 @@ static void efx_fini_channels(struct efx_nic *efx) }efx_for_each_channel (channel, efx) { -netif_dbg (channel->efx, drv, channel->efx->net_dev, -"shut down chan %d\n" , channel->channel); +/* RX packet processing is pipelined, so wait for the +* NAPI handler to complete. At least event queue 0 +* might be kept active by non-data events, so don't +* use napi_synchronize() but actually disable NAPI +* temporarily. +*/ +if (efx_channel_has_rx_queue (channel)) { +efx_stop_eventq (channel); +efx_start_eventq (channel); + }efx_for_each_channel_rx_queue (rx_queue, channel)efx_fini_rx_queue (rx_queue);efx_for_each_possible_channel_tx_queue (tx_queue, channel)efx_fini_tx_queue (tx_queue); -efx_fini_eventq (channel); } }
@@ -706,7 +701,7 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)int rc;efx_stop_all (efx); -efx_fini_channels (efx); +efx_stop_interrupts (efx);/* Clone channels */ memset (other_channel,0 ,sizeof (other_channel));
@@ -746,7 +741,7 @@ out:for (i =0 ; i < efx->n_channels; i++)kfree (other_channel[i]); -efx_init_channels (efx); +efx_start_interrupts (efx);efx_start_all (efx);return rc;
@@ -1246,6 +1241,44 @@ static int efx_probe_interrupts(struct efx_nic *efx)return 0 ; } +/* Enable interrupts, then probe and start the event queues */ +static void efx_start_interrupts (struct efx_nic *efx) +{ +struct efx_channel *channel; + +if (efx->legacy_irq) + efx->legacy_irq_enabled = true; +efx_nic_enable_interrupts (efx); + +efx_for_each_channel (channel, efx) { +efx_init_eventq (channel); +efx_start_eventq (channel); + } + +efx_mcdi_mode_event (efx); +} + +static void efx_stop_interrupts (struct efx_nic *efx) +{ +struct efx_channel *channel; + +efx_mcdi_mode_poll (efx); + +efx_nic_disable_interrupts (efx); +if (efx->legacy_irq) { +synchronize_irq (efx->legacy_irq); + efx->legacy_irq_enabled = false; + } + +efx_for_each_channel (channel, efx) { +if (channel->irq) +synchronize_irq (channel->irq); + +efx_stop_eventq (channel); +efx_fini_eventq (channel); + } +} +static void efx_remove_interrupts (struct efx_nic *efx) {struct efx_channel *channel;
@@ -1371,15 +1404,13 @@ static int efx_probe_all(struct efx_nic *efx)return rc; } -/* Called after previous invocation(s) of efx_stop_all, restarts the -* port, kernel transmit queue, NAPI processing and hardware interrupts, -* and ensures that the port is scheduled to be reconfigured. -* This function is safe to call multiple times when the NIC is in any -* state. */ +/* Called after previous invocation(s) of efx_stop_all, restarts the port, +* kernel transmit queues and NAPI processing, and ensures that the port is +* scheduled to be reconfigured. This function is safe to call multiple +* times when the NIC is in any state. +*/ static void efx_start_all (struct efx_nic *efx) { -struct efx_channel *channel; -EFX_ASSERT_RESET_SERIALISED (efx);/* Check that it is appropriate to restart the interface. All
@@ -1391,28 +1422,8 @@ static void efx_start_all(struct efx_nic *efx)if (!netif_running (efx->net_dev))return ; -/* Mark the port as enabled so port reconfigurations can start, then -* restart the transmit interface early so the watchdog timer stops */ efx_start_port (efx); - -if (netif_device_present (efx->net_dev)) -netif_tx_wake_all_queues (efx->net_dev); - -efx_for_each_channel (channel, efx) -efx_start_channel (channel); - -if (efx->legacy_irq) - efx->legacy_irq_enabled = true; -efx_nic_enable_interrupts (efx); - -/* Switch to event based MCDI completions after enabling interrupts. -* If a reset has been scheduled, then we need to stay in polled mode. -* Rather than serialising efx_mcdi_mode_event() [which sleeps] and -* reset_pending [modified from an atomic context], we instead guarantee -* that efx_mcdi_mode_poll() isn't reverted erroneously */ -efx_mcdi_mode_event (efx); -if (efx->reset_pending) -efx_mcdi_mode_poll (efx); +efx_start_datapath (efx);/* Start the hardware monitor if there is one. Otherwise (we're link * event driven), we have to poll the PHY because after an event queue
@@ -1448,8 +1459,6 @@ static void efx_flush_all(struct efx_nic *efx)* taking locks. */ static void efx_stop_all (struct efx_nic *efx) { -struct efx_channel *channel; -EFX_ASSERT_RESET_SERIALISED (efx);/* port_enabled can be read safely under the rtnl lock */
@@ -1457,28 +1466,6 @@ static void efx_stop_all(struct efx_nic *efx)return ; efx->type->stop_stats (efx); - -/* Switch to MCDI polling on Siena before disabling interrupts */ -efx_mcdi_mode_poll (efx); - -/* Disable interrupts and wait for ISR to complete */ -efx_nic_disable_interrupts (efx); -if (efx->legacy_irq) { -synchronize_irq (efx->legacy_irq); - efx->legacy_irq_enabled = false; - } -efx_for_each_channel (channel, efx) { -if (channel->irq) -synchronize_irq (channel->irq); - } - -/* Stop all NAPI processing and synchronous rx refills */ -efx_for_each_channel (channel, efx) -efx_stop_channel (channel); - -/* Stop all asynchronous port reconfigurations. Since all -* event processing has already been stopped, there is no -* window to loose phy events */ efx_stop_port (efx);/* Flush efx_mac_work(), refill_workqueue, monitor_work */
@@ -1486,9 +1473,9 @@ static void efx_stop_all(struct efx_nic *efx)/* Stop the kernel transmit interface late, so the watchdog * timer isn't ticking over the flush */ -netif_tx_stop_all_queues (efx->net_dev); -netif_tx_lock_bh (efx->net_dev); -netif_tx_unlock_bh (efx->net_dev); +netif_tx_disable (efx->net_dev); + +efx_stop_datapath (efx); }static void efx_remove_all (struct efx_nic *efx)
@@ -1731,8 +1718,6 @@ static int efx_net_stop(struct net_device *net_dev)if (efx->state !=STATE_DISABLED ) {/* Stop the device and flush all the channels */ efx_stop_all (efx); -efx_fini_channels (efx); -efx_init_channels (efx); }return 0 ;
@@ -1803,8 +1788,6 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu)netif_dbg (efx, drv, efx->net_dev,"changing MTU to %d\n" , new_mtu); -efx_fini_channels (efx); -mutex_lock (&efx->mac_lock);/* Reconfigure the MAC before enabling the dma queues so that * the RX buffers don't overflow */
@@ -1812,8 +1795,6 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) efx->type->reconfigure_mac (efx);mutex_unlock (&efx->mac_lock); -efx_init_channels (efx); -efx_start_all (efx);return 0 ; }
@@ -2030,7 +2011,7 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method)efx_stop_all (efx);mutex_lock (&efx->mac_lock); -efx_fini_channels (efx); +efx_stop_interrupts (efx);if (efx->port_initialized && method !=RESET_TYPE_INVISIBLE ) efx->phy_op->fini (efx); efx->type->fini (efx);
@@ -2067,7 +2048,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) efx->type->reconfigure_mac (efx); -efx_init_channels (efx); +efx_start_interrupts (efx);efx_restore_filters (efx);mutex_unlock (&efx->mac_lock);
@@ -2273,6 +2254,7 @@ static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type, efx->phy_op = &efx_dummy_phy_operations; efx->mdio.dev = net_dev;INIT_WORK (&efx->mac_work, efx_mac_work); +init_waitqueue_head (&efx->flush_wq);for (i =0 ; i <EFX_MAX_CHANNELS ; i++) { efx->channel[i] =efx_alloc_channel (efx, i,NULL );
@@ -2330,8 +2312,8 @@ static void efx_pci_remove_main(struct efx_nic *efx)free_irq_cpu_rmap (efx->net_dev->rx_cpu_rmap); efx->net_dev->rx_cpu_rmap =NULL ;#endif +efx_stop_interrupts (efx);efx_nic_fini_interrupt (efx); -efx_fini_channels (efx);efx_fini_port (efx); efx->type->fini (efx);efx_fini_napi (efx);
@@ -2357,6 +2339,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev)/* Allow any queued efx_resets() to complete */ rtnl_unlock (); +efx_stop_interrupts (efx);efx_unregister_netdev (efx);efx_mtd_remove (efx);
@@ -2405,16 +2388,14 @@ static int efx_pci_probe_main(struct efx_nic *efx) goto fail4; } -efx_init_channels (efx); - rc =efx_nic_init_interrupt (efx);if (rc) goto fail5; +efx_start_interrupts (efx);return 0 ; fail5: -efx_fini_channels (efx);efx_fini_port (efx); fail4: efx->type->fini (efx);
@@ -2534,7 +2515,7 @@ static int efx_pm_freeze(struct device *dev)netif_device_detach (efx->net_dev);efx_stop_all (efx); -efx_fini_channels (efx); +efx_stop_interrupts (efx);return 0 ; }
@@ -2545,7 +2526,7 @@ static int efx_pm_thaw(struct device *dev) efx->state =STATE_INIT ; -efx_init_channels (efx); +efx_start_interrupts (efx);mutex_lock (&efx->mac_lock); efx->phy_op->reconfigure (efx);
drivers/net/ethernet/sfc/net_driver.h +17 -19
@@ -85,13 +85,6 @@ struct efx_special_buffer {int entries; }; -enum efx_flush_state { -FLUSH_NONE , -FLUSH_PENDING , -FLUSH_FAILED , -FLUSH_DONE , -}; -/** * struct efx_tx_buffer - An Efx TX buffer * @skb: The associated socket buffer.
@@ -138,7 +131,6 @@ struct efx_tx_buffer {* @txd: The hardware descriptor ring * @ptr_mask: The size of the ring minus 1. * @initialised: Has hardware queue been initialised? -* @flushed: Used when handling queue flushing * @read_count: Current read pointer. * This is the number of buffers that have been removed from both rings. * @old_write_count: The value of @write_count when last checked.
@@ -181,7 +173,6 @@ struct efx_tx_queue {struct efx_special_buffer txd;unsigned int ptr_mask;bool initialised; -enum efx_flush_state flushed;/* Members used mainly on the completion path */ unsigned int read_count____cacheline_aligned_in_smp ;
@@ -249,6 +240,9 @@ struct efx_rx_page_state {* @buffer: The software buffer ring * @rxd: The hardware descriptor ring * @ptr_mask: The size of the ring minus 1. +* @enabled: Receive queue enabled indicator. +* @flush_pending: Set when a RX flush is pending. Has the same lifetime as +* @rxq_flush_pending. * @added_count: Number of buffers added to the receive queue. * @notified_count: Number of buffers given to NIC (<= @added_count). * @removed_count: Number of buffers removed from the receive queue.
@@ -263,13 +257,14 @@ struct efx_rx_page_state {* @alloc_page_count: RX allocation strategy counter. * @alloc_skb_count: RX allocation strategy counter. * @slow_fill: Timer used to defer efx_nic_generate_fill_event(). -* @flushed: Use when handling queue flushing */ struct efx_rx_queue {struct efx_nic *efx;struct efx_rx_buffer *buffer;struct efx_special_buffer rxd;unsigned int ptr_mask; +bool enabled; +bool flush_pending;int added_count;int notified_count;
@@ -283,8 +278,6 @@ struct efx_rx_queue {unsigned int alloc_skb_count;struct timer_list slow_fill;unsigned int slow_fill_count; - -enum efx_flush_state flushed; };/**
@@ -681,6 +674,13 @@ struct efx_filter_state;* @loopback_mode: Loopback status * @loopback_modes: Supported loopback mode bitmask * @loopback_selftest: Offline self-test private state +* @drain_pending: Count of RX and TX queues that haven't been flushed and drained. +* @rxq_flush_pending: Count of number of receive queues that need to be flushed. +* Decremented when the efx_flush_rx_queue() is called. +* @rxq_flush_outstanding: Count of number of RX flushes started but not yet +* completed (either success or failure). Not used when MCDI is used to +* flush receive queues. +* @flush_wq: wait queue used by efx_nic_flush_queues() to wait for flush completions. * @monitor_work: Hardware monitor workitem * @biu_lock: BIU (bus interface unit) lock * @last_irq_cpu: Last CPU to handle a possible test interrupt. This
@@ -778,6 +778,11 @@ struct efx_nic {struct efx_filter_state *filter_state; +atomic_t drain_pending; +atomic_t rxq_flush_pending; +atomic_t rxq_flush_outstanding; +wait_queue_head_t flush_wq; +/* The following fields may be written more often */ struct delayed_work monitor_work____cacheline_aligned_in_smp ;
@@ -956,13 +961,6 @@ static inline bool efx_tx_queue_used(struct efx_tx_queue *tx_queue) _tx_queue < (_channel)->tx_queue +EFX_TXQ_TYPES ; \ _tx_queue++) -static inline struct efx_rx_queue * -efx_get_rx_queue (struct efx_nic *efx,unsigned index) -{ -EFX_BUG_ON_PARANOID (index >= efx->n_rx_channels); -return &efx->channel[index]->rx_queue; -} -static inline bool efx_channel_has_rx_queue (struct efx_channel *channel) {return channel->channel < channel->efx->n_rx_channels;
drivers/net/ethernet/sfc/nic.c +178 -171
469 lines not on this page · raw message
drivers/net/ethernet/sfc/rx.c +4 -0
@@ -705,6 +705,7 @@ void efx_init_rx_queue(struct efx_rx_queue *rx_queue) rx_queue->fast_fill_limit = limit;/* Set up RX descriptor ring */ + rx_queue->enabled = true;efx_nic_init_rx (rx_queue); }
@@ -716,6 +717,9 @@ void efx_fini_rx_queue(struct efx_rx_queue *rx_queue)netif_dbg (rx_queue->efx, drv, rx_queue->efx->net_dev,"shutting down RX queue %d\n" ,efx_rx_queue_index (rx_queue)); +/* A flush failure might have left rx_queue->enabled */ + rx_queue->enabled = false; +del_timer_sync (&rx_queue->slow_fill);efx_nic_fini_rx (rx_queue);
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 11/19 sfc: Use proper function to test for RX channel in efx_poll()
In reply to Ben Hutchings--- drivers/net/ethernet/sfc/efx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/sfc/efx.c +1 -1
@@ -279,7 +279,7 @@ static int efx_poll(struct napi_struct *napi, int budget) spent =efx_process_channel (channel, budget);if (spent < budget) { -if (channel->channel < efx->n_rx_channels && +if (efx_channel_has_rx_queue (channel) && efx->irq_rx_adaptive &&unlikely (++channel->irq_count ==1000 )) { if (unlikely(channel->irq_mod_score <
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 12/19 sfc: Generalise event generation to cover VF-owned event queues
In reply to Ben HutchingsFor SR-IOV we will need to send events to event queues that belong to VFs serviced by other drivers. Change the parameters of efx_generate_event() to allow this and declare it extern.
While we're at it, remove the existing declaration under the wrong name efx_nic_generate_event().
--- drivers/net/ethernet/sfc/nic.c | 9 +++++---- drivers/net/ethernet/sfc/nic.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/sfc/nic.c +5 -4
@@ -754,7 +754,8 @@ void efx_nic_eventq_read_ack(struct efx_channel *channel) }/* Use HW to insert a SW defined event */ -static void efx_generate_event (struct efx_channel *channel,efx_qword_t *event) +void efx_generate_event (struct efx_nic *efx,unsigned int evq, +efx_qword_t *event) {efx_oword_t drv_ev_reg;
@@ -764,8 +765,8 @@ static void efx_generate_event(struct efx_channel *channel, efx_qword_t *event) drv_ev_reg.u32[1 ] = event->u32[1 ]; drv_ev_reg.u32[2 ] =0 ; drv_ev_reg.u32[3 ] =0 ; -EFX_SET_OWORD_FIELD (drv_ev_reg,FRF_AZ_DRV_EV_QID , channel->channel); -efx_writeo (channel->efx, &drv_ev_reg,FR_AZ_DRV_EV ); +EFX_SET_OWORD_FIELD (drv_ev_reg,FRF_AZ_DRV_EV_QID , evq); +efx_writeo (efx, &drv_ev_reg,FR_AZ_DRV_EV ); }static void efx_magic_event (struct efx_channel *channel,u32 magic)
@@ -775,7 +776,7 @@ static void efx_magic_event(struct efx_channel *channel, u32 magic)EFX_POPULATE_QWORD_2 (event,FSF_AZ_EV_CODE ,FSE_AZ_EV_CODE_DRV_GEN_EV ,FSF_AZ_DRV_GEN_EV_MAGIC , magic); -efx_generate_event (channel, &event); +efx_generate_event (channel->efx, channel->channel, &event); }/* Handle a transmit completion event
drivers/net/ethernet/sfc/nic.h +2 -2
@@ -283,8 +283,8 @@ extern void efx_nic_get_regs(struct efx_nic *efx, void *buf);#define MAC_DATA_LBN 0#define MAC_DATA_WIDTH 32 -extern void efx_nic_generate_event (struct efx_channel *channel, -efx_qword_t *event); +extern void efx_generate_event (struct efx_nic *efx,unsigned int evq, +efx_qword_t *event);extern void falcon_poll_xmac (struct efx_nic *efx);
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 13/19 sfc: Disable flow control during flushes
In reply to Ben HutchingsFrom: Steve Hodgson <[email protected]>
The TX DMA engine issues upstream read requests when there is room in the TX FIFO for the completion. However, the fetches for the rest of the packet might be delayed by any back pressure. Since a flush must wait for an EOP, the entire flush may be delayed by back pressure.
Mitigate this by disabling flow control before the flushes are started. Since PF and VF flushes run in parallel introduce fc_disable, a reference count of the number of flushes outstanding.
The same principle could be applied to Falcon, but that would bring with it its own testing.
--- drivers/net/ethernet/sfc/mcdi_mac.c | 2 ++ drivers/net/ethernet/sfc/net_driver.h | 4 ++++ drivers/net/ethernet/sfc/nic.c | 3 +++ 3 files changed, 9 insertions(+), 0 deletions(-)
drivers/net/ethernet/sfc/mcdi_mac.c +2 -0
@@ -44,6 +44,8 @@ static int efx_mcdi_set_mac(struct efx_nic *efx) }if (efx->wanted_fc &EFX_FC_AUTO ) fcntl =MC_CMD_FCNTL_AUTO ; +if (efx->fc_disable) + fcntl =MC_CMD_FCNTL_OFF ;MCDI_SET_DWORD (cmdbytes,SET_MAC_IN_FCNTL , fcntl);
drivers/net/ethernet/sfc/net_driver.h +4 -0
@@ -670,6 +670,9 @@ struct efx_filter_state;* @promiscuous: Promiscuous flag. Protected by netif_tx_lock. * @multicast_hash: Multicast hash table * @wanted_fc: Wanted flow control flags +* @fc_disable: When non-zero flow control is disabled. Typically used to +* ensure that network back pressure doesn't delay dma queue flushes. +* Serialised by the rtnl lock. * @mac_work: Work item for changing MAC promiscuity and multicast hash * @loopback_mode: Loopback status * @loopback_modes: Supported loopback mode bitmask
@@ -769,6 +772,7 @@ struct efx_nic {bool promiscuous;union efx_multicast_hash multicast_hash;u8 wanted_fc; +unsigned fc_disable;atomic_t rx_reset;enum efx_loopback_mode loopback_mode;
drivers/net/ethernet/sfc/nic.c +3 -0
@@ -677,6 +677,7 @@ int efx_nic_flush_queues(struct efx_nic *efx)struct efx_tx_queue *tx_queue;int rc =0 ; + efx->fc_disable++; efx->type->prepare_flush (efx);efx_for_each_channel (channel, efx) {
@@ -727,6 +728,8 @@ int efx_nic_flush_queues(struct efx_nic *efx)atomic_set (&efx->rxq_flush_outstanding,0 ); } + efx->fc_disable--; +return rc; }
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 14/19 sfc: Make buffer table indices and counts consistently unsigned
In reply to Ben Hutchings--- drivers/net/ethernet/sfc/net_driver.h | 4 ++-- drivers/net/ethernet/sfc/nic.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/sfc/net_driver.h +2 -2
@@ -81,8 +81,8 @@ struct efx_special_buffer {void *addr;dma_addr_t dma_addr;unsigned int len; -int index; -int entries; +unsigned int index; +unsigned int entries; };/**
drivers/net/ethernet/sfc/nic.c +1 -1
@@ -192,7 +192,7 @@ static void efx_init_special_buffer(struct efx_nic *efx, struct efx_special_buffer *buffer) { efx_qword_t buf_desc; -int index; +unsigned int index;dma_addr_t dma_addr;int i;
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 15/19 sfc: Make all CPU/IRQ/channel/queue counts unsigned
In reply to Ben Hutchings--- drivers/net/ethernet/sfc/efx.c | 18 ++++++++++-------- drivers/net/ethernet/sfc/net_driver.h | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/net/ethernet/sfc/efx.c +10 -8
@@ -1104,10 +1104,10 @@ static void efx_fini_io(struct efx_nic *efx)pci_disable_device (efx->pci_dev); } -static int efx_wanted_parallelism (void ) +static unsigned int efx_wanted_parallelism (void ) {cpumask_var_t thread_mask; -int count; +unsigned int count;int cpu;if (rss_cpus)
@@ -1136,7 +1136,8 @@ static int efx_init_rx_cpu_rmap(struct efx_nic *efx, struct msix_entry *xentries) { #ifdef CONFIG_RFS_ACCEL - int i, rc; + unsigned int i; +int rc; efx->net_dev->rx_cpu_rmap =alloc_irq_cpu_rmap (efx->n_rx_channels);if (!efx->net_dev->rx_cpu_rmap)
@@ -1159,13 +1160,14 @@ efx_init_rx_cpu_rmap(struct efx_nic *efx, struct msix_entry *xentries)*/ static int efx_probe_interrupts (struct efx_nic *efx) { -int max_channels = -min_t (int, efx->type->phys_addr_channels,EFX_MAX_CHANNELS ); -int rc, i; +unsigned int max_channels = +min (efx->type->phys_addr_channels,EFX_MAX_CHANNELS ); +unsigned int i; +int rc;if (efx->interrupt_mode ==EFX_INT_MODE_MSIX ) {struct msix_entry xentries[EFX_MAX_CHANNELS ]; -int n_channels; +unsigned int n_channels; n_channels =efx_wanted_parallelism ();if (separate_tx_channels)
@@ -1178,7 +1180,7 @@ static int efx_probe_interrupts(struct efx_nic *efx)if (rc >0 ) {netif_err (efx, drv, efx->net_dev,"WARNING: Insufficient MSI-X vectors" -" available (%d < %d).\n" , rc, n_channels); +" available (%d < %u).\n" , rc, n_channels);netif_err (efx, drv, efx->net_dev,"WARNING: Performance may be reduced.\n" );EFX_BUG_ON_PARANOID (rc >= n_channels);
drivers/net/ethernet/sfc/net_driver.h +1 -1
@@ -52,7 +52,7 @@* **************************************************************************/ -#define EFX_MAX_CHANNELS 32 +#define EFX_MAX_CHANNELS 32U#define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS/* Checksum generation is a per-queue option in hardware, so each
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 16/19 sfc: Add support for 'extra' channel types
In reply to Ben HutchingsAbstract some of the channel operations to allow for 'extra' channels that do not have RX or TX queues.
- Try to assign a channel to each extra channel type that is enabled for the NIC, but gracefully degrade if we can't allocate sufficient MSI-X vectors
- Allow each extra channel type to generate its own channel name
- Allow channel types to disable reallocation and reinitialisation of their channels
--- drivers/net/ethernet/sfc/efx.c | 312 +++++++++++++++++++++------------ drivers/net/ethernet/sfc/efx.h | 1 + drivers/net/ethernet/sfc/net_driver.h | 34 ++++ 3 files changed, 239 insertions(+), 108 deletions(-)
drivers/net/ethernet/sfc/efx.c +204 -108
@@ -186,11 +186,13 @@ MODULE_PARM_DESC(debug, "Bitmapped debugging message enable value");* *************************************************************************/ -static void efx_start_interrupts (struct efx_nic *efx); -static void efx_stop_interrupts (struct efx_nic *efx); +static void efx_start_interrupts (struct efx_nic *efx,bool may_keep_eventq); +static void efx_stop_interrupts (struct efx_nic *efx,bool may_keep_eventq); +static void efx_remove_channel (struct efx_channel *channel);static void efx_remove_channels (struct efx_nic *efx); +static const struct efx_channel_type efx_default_channel_type;static void efx_remove_port (struct efx_nic *efx); -static void efx_init_napi (struct efx_nic *efx); +static void efx_init_napi_channel (struct efx_channel *channel);static void efx_fini_napi (struct efx_nic *efx);static void efx_fini_napi_channel (struct efx_channel *channel);static void efx_fini_struct (struct efx_nic *efx);
@@ -439,8 +441,7 @@ static void efx_remove_eventq(struct efx_channel *channel)* *************************************************************************/ -/* Allocate and initialise a channel structure, optionally copying -* parameters (but not resources) from an old channel structure. */ +/* Allocate and initialise a channel structure. */ static struct efx_channel *efx_alloc_channel (struct efx_nic *efx,int i,struct efx_channel *old_channel) {
@@ -449,45 +450,60 @@ efx_alloc_channel(struct efx_nic *efx, int i, struct efx_channel *old_channel)struct efx_tx_queue *tx_queue;int j; -if (old_channel) { - channel =kmalloc (sizeof (*channel),GFP_KERNEL ); -if (!channel) -return NULL ; + channel =kzalloc (sizeof (*channel),GFP_KERNEL ); +if (!channel) +return NULL ; - *channel = *old_channel; + channel->efx = efx; + channel->channel = i; + channel->type = &efx_default_channel_type; - channel->napi_dev =NULL ; -memset (&channel->eventq,0 ,sizeof (channel->eventq)); +for (j =0 ; j <EFX_TXQ_TYPES ; j++) { + tx_queue = &channel->tx_queue[j]; + tx_queue->efx = efx; + tx_queue->queue = i *EFX_TXQ_TYPES + j; + tx_queue->channel = channel; + } - rx_queue = &channel->rx_queue; - rx_queue->buffer =NULL ; -memset (&rx_queue->rxd,0 ,sizeof (rx_queue->rxd)); + rx_queue = &channel->rx_queue; + rx_queue->efx = efx; +setup_timer (&rx_queue->slow_fill, efx_rx_slow_fill, + (unsigned long )rx_queue); -for (j =0 ; j <EFX_TXQ_TYPES ; j++) { - tx_queue = &channel->tx_queue[j]; -if (tx_queue->channel) - tx_queue->channel = channel; - tx_queue->buffer =NULL ; -memset (&tx_queue->txd,0 ,sizeof (tx_queue->txd)); - } - }else { - channel =kzalloc (sizeof (*channel),GFP_KERNEL ); -if (!channel) -return NULL ; +return channel; +} + +/* Allocate and initialise a channel structure, copying parameters +* (but not resources) from an old channel structure. +*/ +static struct efx_channel * +efx_copy_channel (const struct efx_channel *old_channel) +{ +struct efx_channel *channel; +struct efx_rx_queue *rx_queue; +struct efx_tx_queue *tx_queue; +int j; - channel->efx = efx; - channel->channel = i; + channel =kmalloc (sizeof (*channel),GFP_KERNEL ); +if (!channel) +return NULL ; + + *channel = *old_channel; + + channel->napi_dev =NULL ; +memset (&channel->eventq,0 ,sizeof (channel->eventq)); -for (j =0 ; j <EFX_TXQ_TYPES ; j++) { - tx_queue = &channel->tx_queue[j]; - tx_queue->efx = efx; - tx_queue->queue = i *EFX_TXQ_TYPES + j; +for (j =0 ; j <EFX_TXQ_TYPES ; j++) { + tx_queue = &channel->tx_queue[j]; +if (tx_queue->channel) tx_queue->channel = channel; - } + tx_queue->buffer =NULL ; +memset (&tx_queue->txd,0 ,sizeof (tx_queue->txd)); } rx_queue = &channel->rx_queue; - rx_queue->efx = efx; + rx_queue->buffer =NULL ; +memset (&rx_queue->rxd,0 ,sizeof (rx_queue->rxd));setup_timer (&rx_queue->slow_fill, efx_rx_slow_fill, (unsigned long )rx_queue);
@@ -503,57 +519,62 @@ static int efx_probe_channel(struct efx_channel *channel)netif_dbg (channel->efx, probe, channel->efx->net_dev,"creating channel %d\n" , channel->channel); + rc = channel->type->pre_probe (channel); +if (rc) + goto fail; + rc =efx_probe_eventq (channel);if (rc) - goto fail1; + goto fail;efx_for_each_channel_tx_queue (tx_queue, channel) { rc =efx_probe_tx_queue (tx_queue);if (rc) - goto fail2; + goto fail; }efx_for_each_channel_rx_queue (rx_queue, channel) { rc =efx_probe_rx_queue (rx_queue);if (rc) - goto fail3; + goto fail; } channel->n_rx_frm_trunc =0 ;return 0 ; - fail3: -efx_for_each_channel_rx_queue (rx_queue, channel) -efx_remove_rx_queue (rx_queue); - fail2: -efx_for_each_channel_tx_queue (tx_queue, channel) -efx_remove_tx_queue (tx_queue); - fail1: +fail: +efx_remove_channel (channel);return rc; } +static void +efx_get_channel_name (struct efx_channel *channel,char *buf,size_t len) +{ +struct efx_nic *efx = channel->efx; +const char *type; +int number; + + number = channel->channel; +if (efx->tx_channel_offset ==0 ) { + type ="" ; + }else if (channel->channel < efx->tx_channel_offset) { + type ="-rx" ; + }else { + type ="-tx" ; + number -= efx->tx_channel_offset; + } +snprintf (buf, len,"%s%s-%d" , efx->name, type, number); +}static void efx_set_channel_names (struct efx_nic *efx) {struct efx_channel *channel; -const char *type ="" ; -int number; -efx_for_each_channel (channel, efx) { - number = channel->channel; -if (efx->n_channels > efx->n_rx_channels) { -if (channel->channel < efx->n_rx_channels) { - type ="-rx" ; - }else { - type ="-tx" ; - number -= efx->n_rx_channels; - } - } -snprintf (efx->channel_name[channel->channel], -sizeof (efx->channel_name[0 ]), -"%s%s-%d" , efx->name, type, number); - } +efx_for_each_channel (channel, efx) + channel->type->get_name (channel, + efx->channel_name[channel->channel], +sizeof (efx->channel_name[0 ])); }static int efx_probe_channels (struct efx_nic *efx)
@@ -697,16 +718,40 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) {struct efx_channel *other_channel[EFX_MAX_CHANNELS ], *channel;u32 old_rxq_entries, old_txq_entries; -unsigned i; -int rc; +unsigned i, next_buffer_table =0 ; +int rc =0 ; + +/* Not all channels should be reallocated. We must avoid +* reallocating their buffer table entries. +*/ +efx_for_each_channel (channel, efx) { +struct efx_rx_queue *rx_queue; +struct efx_tx_queue *tx_queue; + +if (channel->type->copy) +continue ; + next_buffer_table =max (next_buffer_table, + channel->eventq.index + + channel->eventq.entries); +efx_for_each_channel_rx_queue (rx_queue, channel) + next_buffer_table =max (next_buffer_table, + rx_queue->rxd.index + + rx_queue->rxd.entries); +efx_for_each_channel_tx_queue (tx_queue, channel) + next_buffer_table =max (next_buffer_table, + tx_queue->txd.index + + tx_queue->txd.entries); + }efx_stop_all (efx); -efx_stop_interrupts (efx); +efx_stop_interrupts (efx, true); -/* Clone channels */ +/* Clone channels (where possible) */ memset (other_channel,0 ,sizeof (other_channel));for (i =0 ; i < efx->n_channels; i++) { - channel =efx_alloc_channel (efx, i, efx->channel[i]); + channel = efx->channel[i]; +if (channel->type->copy) + channel = channel->type->copy (channel);if (!channel) { rc = -ENOMEM ; goto out;
@@ -725,23 +770,31 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) other_channel[i] = channel; } - rc =efx_probe_channels (efx); -if (rc) - goto rollback; - -efx_init_napi (efx); +/* Restart buffer table allocation */ + efx->next_buffer_table = next_buffer_table; -/* Destroy old channels */ for (i =0 ; i < efx->n_channels; i++) { -efx_fini_napi_channel (other_channel[i]); -efx_remove_channel (other_channel[i]); + channel = efx->channel[i]; +if (!channel->type->copy) +continue ; + rc =efx_probe_channel (channel); +if (rc) + goto rollback; +efx_init_napi_channel (efx->channel[i]); } + out: -/* Free unused channel structures */ -for (i =0 ; i < efx->n_channels; i++) -kfree (other_channel[i]); +/* Destroy unused channel structures */ +for (i =0 ; i < efx->n_channels; i++) { + channel = other_channel[i]; +if (channel && channel->type->copy) { +efx_fini_napi_channel (channel); +efx_remove_channel (channel); +kfree (channel); + } + } -efx_start_interrupts (efx); +efx_start_interrupts (efx, true);efx_start_all (efx);return rc;
@@ -762,6 +815,18 @@ void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue)mod_timer (&rx_queue->slow_fill, jiffies +msecs_to_jiffies (100 )); } +static const struct efx_channel_type efx_default_channel_type = { + .pre_probe = efx_channel_dummy_op_int, + .get_name = efx_get_channel_name, + .copy = efx_copy_channel, + .keep_eventq = false, +}; + +int efx_channel_dummy_op_int (struct efx_channel *channel) +{ +return 0 ; +} +/************************************************************************** * * Port handling
@@ -1162,9 +1227,14 @@ static int efx_probe_interrupts(struct efx_nic *efx) {unsigned int max_channels =min (efx->type->phys_addr_channels,EFX_MAX_CHANNELS ); -unsigned int i; +unsigned int extra_channels =0 ; +unsigned int i, j;int rc; +for (i =0 ; i <EFX_MAX_EXTRA_CHANNELS ; i++) +if (efx->extra_channel_type[i]) + ++extra_channels; +if (efx->interrupt_mode ==EFX_INT_MODE_MSIX ) {struct msix_entry xentries[EFX_MAX_CHANNELS ];unsigned int n_channels;
@@ -1172,6 +1242,7 @@ static int efx_probe_interrupts(struct efx_nic *efx) n_channels =efx_wanted_parallelism ();if (separate_tx_channels) n_channels *=2 ; + n_channels += extra_channels; n_channels =min (n_channels, max_channels);for (i =0 ; i < n_channels; i++)
@@ -1191,22 +1262,23 @@ static int efx_probe_interrupts(struct efx_nic *efx)if (rc ==0 ) { efx->n_channels = n_channels; +if (n_channels > extra_channels) + n_channels -= extra_channels;if (separate_tx_channels) { - efx->n_tx_channels = -max (efx->n_channels /2 ,1U ); - efx->n_rx_channels = -max (efx->n_channels - - efx->n_tx_channels,1U ); + efx->n_tx_channels =max (n_channels /2 ,1U ); + efx->n_rx_channels =max (n_channels - + efx->n_tx_channels, +1U ); }else { - efx->n_tx_channels = efx->n_channels; - efx->n_rx_channels = efx->n_channels; + efx->n_tx_channels = n_channels; + efx->n_rx_channels = n_channels; } rc =efx_init_rx_cpu_rmap (efx, xentries);if (rc) {pci_disable_msix (efx->pci_dev);return rc; } -for (i =0 ; i < n_channels; i++) +for (i =0 ; i < efx->n_channels; i++)efx_get_channel (efx, i)->irq = xentries[i].vector; }else {
@@ -1240,11 +1312,26 @@ static int efx_probe_interrupts(struct efx_nic *efx) efx->legacy_irq = efx->pci_dev->irq; } +/* Assign extra channels if possible */ + j = efx->n_channels; +for (i =0 ; i <EFX_MAX_EXTRA_CHANNELS ; i++) { +if (!efx->extra_channel_type[i]) +continue ; +if (efx->interrupt_mode !=EFX_INT_MODE_MSIX || + efx->n_channels <= extra_channels) { + efx->extra_channel_type[i]->handle_no_channel (efx); + }else { + --j; +efx_get_channel (efx, j)->type = + efx->extra_channel_type[i]; + } + } +return 0 ; }/* Enable interrupts, then probe and start the event queues */ -static void efx_start_interrupts (struct efx_nic *efx) +static void efx_start_interrupts (struct efx_nic *efx,bool may_keep_eventq) {struct efx_channel *channel;
@@ -1253,14 +1340,15 @@ static void efx_start_interrupts(struct efx_nic *efx)efx_nic_enable_interrupts (efx);efx_for_each_channel (channel, efx) { -efx_init_eventq (channel); +if (!channel->type->keep_eventq || !may_keep_eventq) +efx_init_eventq (channel);efx_start_eventq (channel); }efx_mcdi_mode_event (efx); } -static void efx_stop_interrupts (struct efx_nic *efx) +static void efx_stop_interrupts (struct efx_nic *efx,bool may_keep_eventq) {struct efx_channel *channel;
@@ -1277,7 +1365,8 @@ static void efx_stop_interrupts(struct efx_nic *efx)synchronize_irq (channel->irq);efx_stop_eventq (channel); -efx_fini_eventq (channel); +if (!channel->type->keep_eventq || !may_keep_eventq) +efx_fini_eventq (channel); } }
@@ -1383,21 +1472,22 @@ static int efx_probe_all(struct efx_nic *efx) } efx->rxq_entries = efx->txq_entries =EFX_DEFAULT_DMAQ_SIZE ; - rc =efx_probe_channels (efx); -if (rc) - goto fail3; rc =efx_probe_filters (efx);if (rc) {netif_err (efx, probe, efx->net_dev,"failed to create filter tables\n" ); - goto fail4; + goto fail3; } + rc =efx_probe_channels (efx); +if (rc) + goto fail4; +return 0 ; fail4: -efx_remove_channels (efx); +efx_remove_filters (efx); fail3:efx_remove_port (efx); fail2:
@@ -1482,8 +1572,8 @@ static void efx_stop_all(struct efx_nic *efx)static void efx_remove_all (struct efx_nic *efx) { -efx_remove_filters (efx);efx_remove_channels (efx); +efx_remove_filters (efx);efx_remove_port (efx);efx_remove_nic (efx); }
@@ -1627,15 +1717,21 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)* **************************************************************************/ +static void efx_init_napi_channel (struct efx_channel *channel) +{ +struct efx_nic *efx = channel->efx; + + channel->napi_dev = efx->net_dev; +netif_napi_add (channel->napi_dev, &channel->napi_str, + efx_poll, napi_weight); +} +static void efx_init_napi (struct efx_nic *efx) {struct efx_channel *channel; -efx_for_each_channel (channel, efx) { - channel->napi_dev = efx->net_dev; -netif_napi_add (channel->napi_dev, &channel->napi_str, - efx_poll, napi_weight); - } +efx_for_each_channel (channel, efx) +efx_init_napi_channel (channel); }static void efx_fini_napi_channel (struct efx_channel *channel)
@@ -2013,7 +2109,7 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method)efx_stop_all (efx);mutex_lock (&efx->mac_lock); -efx_stop_interrupts (efx); +efx_stop_interrupts (efx, false);if (efx->port_initialized && method !=RESET_TYPE_INVISIBLE ) efx->phy_op->fini (efx); efx->type->fini (efx);
@@ -2050,7 +2146,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) efx->type->reconfigure_mac (efx); -efx_start_interrupts (efx); +efx_start_interrupts (efx, false);efx_restore_filters (efx);mutex_unlock (&efx->mac_lock);
@@ -2314,7 +2410,7 @@ static void efx_pci_remove_main(struct efx_nic *efx)free_irq_cpu_rmap (efx->net_dev->rx_cpu_rmap); efx->net_dev->rx_cpu_rmap =NULL ;#endif -efx_stop_interrupts (efx); +efx_stop_interrupts (efx, false);efx_nic_fini_interrupt (efx);efx_fini_port (efx); efx->type->fini (efx);
@@ -2341,7 +2437,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev)/* Allow any queued efx_resets() to complete */ rtnl_unlock (); -efx_stop_interrupts (efx); +efx_stop_interrupts (efx, false);efx_unregister_netdev (efx);efx_mtd_remove (efx);
@@ -2393,7 +2489,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) rc =efx_nic_init_interrupt (efx);if (rc) goto fail5; -efx_start_interrupts (efx); +efx_start_interrupts (efx, false);return 0 ;
@@ -2517,7 +2613,7 @@ static int efx_pm_freeze(struct device *dev)netif_device_detach (efx->net_dev);efx_stop_all (efx); -efx_stop_interrupts (efx); +efx_stop_interrupts (efx, false);return 0 ; }
@@ -2528,7 +2624,7 @@ static int efx_pm_thaw(struct device *dev) efx->state =STATE_INIT ; -efx_start_interrupts (efx); +efx_start_interrupts (efx, false);mutex_lock (&efx->mac_lock); efx->phy_op->reconfigure (efx);
drivers/net/ethernet/sfc/efx.h +1 -0
@@ -95,6 +95,7 @@ static inline void efx_filter_rfs_expire(struct efx_channel *channel) {}#endif /* Channels */ +extern int efx_channel_dummy_op_int (struct efx_channel *channel);extern void efx_process_channel_now (struct efx_channel *channel);extern int efx_realloc_channels (struct efx_nic *efx,u32 rxq_entries,u32 txq_entries);
drivers/net/ethernet/sfc/net_driver.h +34 -0
@@ -54,6 +54,7 @@#define EFX_MAX_CHANNELS 32U#define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS +#define EFX_MAX_EXTRA_CHANNELS 0U/* Checksum generation is a per-queue option in hardware, so each * queue visible to the networking core is backed by two hardware TX
@@ -311,6 +312,7 @@ enum efx_rx_alloc_method {* * @efx: Associated Efx NIC * @channel: Channel instance number +* @type: Channel type definition * @enabled: Channel enabled indicator * @irq: IRQ number (MSI and MSI-X only) * @irq_moderation: IRQ moderation value (in hardware ticks)
@@ -341,6 +343,7 @@ enum efx_rx_alloc_method {struct efx_channel {struct efx_nic *efx;int channel; +const struct efx_channel_type *type;bool enabled;int irq;unsigned int irq_moderation;
@@ -379,6 +382,26 @@ struct efx_channel {struct efx_tx_queue tx_queue[EFX_TXQ_TYPES ]; }; +/** +* struct efx_channel_type - distinguishes traffic and extra channels +* @handle_no_channel: Handle failure to allocate an extra channel +* @pre_probe: Set up extra state prior to initialisation +* @post_remove: Tear down extra state after finalisation, if allocated. +* May be called on channels that have not been probed. +* @get_name: Generate the channel's name (used for its IRQ handler) +* @copy: Copy the channel state prior to reallocation. May be %NULL if +* reallocation is not supported. +* @keep_eventq: Flag for whether event queue should be kept initialised +* while the device is stopped +*/ +struct efx_channel_type { +void (*handle_no_channel)(struct efx_nic *); +int (*pre_probe)(struct efx_channel *); +void (*get_name)(struct efx_channel *,char *buf,size_t len); +struct efx_channel *(*copy)(const struct efx_channel *); +bool keep_eventq; +}; +enum efx_led_mode {EFX_LED_OFF =0 ,EFX_LED_ON =1 ,
@@ -631,6 +654,8 @@ struct efx_filter_state;* @rx_queue: RX DMA queues * @channel: Channels * @channel_name: Names for channels and their IRQs +* @extra_channel_types: Types of extra (non-traffic) channels that +* should be allocated for this NIC * @rxq_entries: Size of receive queues requested by user. * @txq_entries: Size of transmit queues requested by user. * @next_buffer_table: First available buffer table id
@@ -723,6 +748,8 @@ struct efx_nic {struct efx_channel *channel[EFX_MAX_CHANNELS ];char channel_name[EFX_MAX_CHANNELS ][IFNAMSIZ +6 ]; +const struct efx_channel_type * + extra_channel_type[EFX_MAX_EXTRA_CHANNELS ];unsigned rxq_entries;unsigned txq_entries;
@@ -921,6 +948,13 @@ efx_get_channel(struct efx_nic *efx, unsigned index) _channel = (_channel->channel + 1 < (_efx)->n_channels) ? \ (_efx)->channel[_channel->channel + 1] : NULL) +/* Iterate over all used channels in reverse */ +#define efx_for_each_channel_rev (_channel, _efx) \ + for (_channel = (_efx)->channel[(_efx)->n_channels - 1]; \ + _channel; \ + _channel = _channel->channel ? \ + (_efx)->channel[_channel->channel - 1] : NULL) +static inline struct efx_tx_queue *efx_get_tx_queue (struct efx_nic *efx,unsigned index,unsigned type) {
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 17/19 sfc: Pass NIC structure into efx_wanted_parallelism()
In reply to Ben HutchingsThis lets us identify the NIC affected in case of failure, and will be necessary to adjust for SR-IOV constraints.
--- drivers/net/ethernet/sfc/efx.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/sfc/efx.c +4 -4
@@ -1169,7 +1169,7 @@ static void efx_fini_io(struct efx_nic *efx)pci_disable_device (efx->pci_dev); } -static unsigned int efx_wanted_parallelism (void ) +static unsigned int efx_wanted_parallelism (struct efx_nic *efx) {cpumask_var_t thread_mask;unsigned int count;
@@ -1179,8 +1179,8 @@ static unsigned int efx_wanted_parallelism(void)return rss_cpus;if (unlikely (!zalloc_cpumask_var (&thread_mask,GFP_KERNEL ))) { -printk (KERN_WARNING -"sfc: RSS disabled due to allocation failure\n" ); +netif_warn (efx, probe, efx->net_dev, +"RSS disabled due to allocation failure\n" );return 1 ; }
@@ -1239,7 +1239,7 @@ static int efx_probe_interrupts(struct efx_nic *efx)struct msix_entry xentries[EFX_MAX_CHANNELS ];unsigned int n_channels; - n_channels =efx_wanted_parallelism (); + n_channels =efx_wanted_parallelism (efx);if (separate_tx_channels) n_channels *=2 ; n_channels += extra_channels;
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 18/19 sfc: Allocate SRAM between buffer table and descriptor caches at init time
In reply to Ben HutchingsEach port has a block of 64-bit SRAM that is divided between buffer table and descriptor cache regions at initialisation time. Currently we use a fixed allocation, but it needs to be changed to support larger numbers of queues.
--- drivers/net/ethernet/sfc/efx.c | 2 ++ drivers/net/ethernet/sfc/falcon.c | 12 ++++++++---- drivers/net/ethernet/sfc/net_driver.h | 13 +++++++++---- drivers/net/ethernet/sfc/nic.c | 23 +++++++++++++++++++---- drivers/net/ethernet/sfc/nic.h | 2 ++ drivers/net/ethernet/sfc/siena.c | 12 ++++++++++-- 6 files changed, 50 insertions(+), 14 deletions(-)
drivers/net/ethernet/sfc/efx.c +2 -0
@@ -1420,6 +1420,8 @@ static int efx_probe_nic(struct efx_nic *efx)if (rc) goto fail; + efx->type->dimension_resources (efx); +if (efx->n_channels >1 )get_random_bytes (&efx->rx_hash_key,sizeof (efx->rx_hash_key));for (i =0 ; i <ARRAY_SIZE (efx->rx_indir_table); i++)
drivers/net/ethernet/sfc/falcon.c +8 -4
@@ -1333,6 +1333,12 @@ out:return rc; } +static void falcon_dimension_resources (struct efx_nic *efx) +{ + efx->rx_dc_base =0x20000 ; + efx->tx_dc_base =0x26000 ; +} +/* Probe all SPI devices on the NIC */ static void falcon_probe_spi_devices (struct efx_nic *efx) {
@@ -1749,6 +1755,7 @@ const struct efx_nic_type falcon_a1_nic_type = { .probe = falcon_probe_nic, .remove = falcon_remove_nic, .init = falcon_init_nic, + .dimension_resources = falcon_dimension_resources, .fini = efx_port_dummy_op_void, .monitor = falcon_monitor, .map_reset_reason = falcon_map_reset_reason,
@@ -1783,8 +1790,6 @@ const struct efx_nic_type falcon_a1_nic_type = { .max_interrupt_mode = EFX_INT_MODE_MSI, .phys_addr_channels = 4, .timer_period_max = 1 << FRF_AB_TC_TIMER_VAL_WIDTH, - .tx_dc_base = 0x130000, - .rx_dc_base = 0x100000, .offload_features = NETIF_F_IP_CSUM, };
@@ -1792,6 +1797,7 @@ const struct efx_nic_type falcon_b0_nic_type = { .probe = falcon_probe_nic, .remove = falcon_remove_nic, .init = falcon_init_nic, + .dimension_resources = falcon_dimension_resources, .fini = efx_port_dummy_op_void, .monitor = falcon_monitor, .map_reset_reason = falcon_map_reset_reason,
@@ -1835,8 +1841,6 @@ const struct efx_nic_type falcon_b0_nic_type = {* interrupt handler only supports 32 * channels */ .timer_period_max = 1 << FRF_AB_TC_TIMER_VAL_WIDTH, - .tx_dc_base = 0x130000, - .rx_dc_base = 0x100000, .offload_features = NETIF_F_IP_CSUM | NETIF_F_RXHASH | NETIF_F_NTUPLE, };
drivers/net/ethernet/sfc/net_driver.h +9 -4
@@ -658,6 +658,9 @@ struct efx_filter_state;* should be allocated for this NIC * @rxq_entries: Size of receive queues requested by user. * @txq_entries: Size of transmit queues requested by user. +* @tx_dc_base: Base qword address in SRAM of TX queue descriptor caches +* @rx_dc_base: Base qword address in SRAM of RX queue descriptor caches +* @sram_lim_qw: Qword address limit of SRAM * @next_buffer_table: First available buffer table id * @n_channels: Number of channels in use * @n_rx_channels: Number of channels used for RX (= number of RX queues)
@@ -753,6 +756,9 @@ struct efx_nic {unsigned rxq_entries;unsigned txq_entries; +unsigned tx_dc_base; +unsigned rx_dc_base; +unsigned sram_lim_qw;unsigned next_buffer_table;unsigned n_channels;unsigned n_rx_channels;
@@ -839,6 +845,8 @@ static inline unsigned int efx_port_num(struct efx_nic *efx)* @probe: Probe the controller * @remove: Free resources allocated by probe() * @init: Initialise the controller +* @dimension_resources: Dimension controller resources (buffer table, +* and VIs once the available interrupt resources are clear) * @fini: Shut down the controller * @monitor: Periodic function for polling link state and hardware monitor * @map_reset_reason: Map ethtool reset reason to a reset method
@@ -878,8 +886,6 @@ static inline unsigned int efx_port_num(struct efx_nic *efx)* @phys_addr_channels: Number of channels with physically addressed * descriptors * @timer_period_max: Maximum period of interrupt timer (in ticks) -* @tx_dc_base: Base address in SRAM of TX queue descriptor caches -* @rx_dc_base: Base address in SRAM of RX queue descriptor caches * @offload_features: net_device feature flags for protocol offload * features implemented in hardware */
@@ -887,6 +893,7 @@ struct efx_nic_type {int (*probe)(struct efx_nic *efx);void (*remove)(struct efx_nic *efx);int (*init)(struct efx_nic *efx); +void (*dimension_resources)(struct efx_nic *efx);void (*fini)(struct efx_nic *efx);void (*monitor)(struct efx_nic *efx);enum reset_type (*map_reset_reason)(enum reset_type reason);
@@ -923,8 +930,6 @@ struct efx_nic_type {unsigned int max_interrupt_mode;unsigned int phys_addr_channels;unsigned int timer_period_max; -unsigned int tx_dc_base; -unsigned int rx_dc_base;netdev_features_t offload_features; };
drivers/net/ethernet/sfc/nic.c +19 -4
@@ -1609,6 +1609,23 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)free_irq (efx->legacy_irq, efx); } +void efx_nic_dimension_resources (struct efx_nic *efx,unsigned sram_lim_qw) +{ +unsigned vi_count, buftbl_min; + +/* Account for the buffer table entries backing the datapath channels +* and the descriptor caches for those channels. +*/ + buftbl_min = ((efx->n_rx_channels *EFX_MAX_DMAQ_SIZE + + efx->n_tx_channels *EFX_TXQ_TYPES *EFX_MAX_DMAQ_SIZE + + efx->n_channels *EFX_MAX_EVQ_SIZE ) + *sizeof (efx_qword_t) /EFX_BUF_SIZE ); + vi_count =max (efx->n_channels, efx->n_tx_channels *EFX_TXQ_TYPES ); + + efx->tx_dc_base = sram_lim_qw - vi_count *TX_DC_ENTRIES ; + efx->rx_dc_base = efx->tx_dc_base - vi_count *RX_DC_ENTRIES ; +} +u32 efx_nic_fpga_ver (struct efx_nic *efx) {efx_oword_t altera_build;
@@ -1621,11 +1638,9 @@ void efx_nic_init_common(struct efx_nic *efx)efx_oword_t temp;/* Set positions of descriptor caches in SRAM. */ -EFX_POPULATE_OWORD_1 (temp,FRF_AZ_SRM_TX_DC_BASE_ADR , - efx->type->tx_dc_base /8 ); +EFX_POPULATE_OWORD_1 (temp,FRF_AZ_SRM_TX_DC_BASE_ADR , efx->tx_dc_base);efx_writeo (efx, &temp,FR_AZ_SRM_TX_DC_CFG ); -EFX_POPULATE_OWORD_1 (temp,FRF_AZ_SRM_RX_DC_BASE_ADR , - efx->type->rx_dc_base /8 ); +EFX_POPULATE_OWORD_1 (temp,FRF_AZ_SRM_RX_DC_BASE_ADR , efx->rx_dc_base);efx_writeo (efx, &temp,FR_AZ_SRM_RX_DC_CFG );/* Set TX descriptor cache size. */
drivers/net/ethernet/sfc/nic.h +2 -0
@@ -230,6 +230,8 @@ extern void falcon_start_nic_stats(struct efx_nic *efx);extern void falcon_stop_nic_stats (struct efx_nic *efx);extern void falcon_setup_xaui (struct efx_nic *efx);extern int falcon_reset_xaui (struct efx_nic *efx); +extern void +efx_nic_dimension_resources (struct efx_nic *efx,unsigned sram_lim_qw);extern void efx_nic_init_common (struct efx_nic *efx);extern void efx_nic_push_rx_indir_table (struct efx_nic *efx);
drivers/net/ethernet/sfc/siena.c +10 -2
@@ -225,6 +225,15 @@ static int siena_probe_nvconfig(struct efx_nic *efx)return rc; } +static void siena_dimension_resources (struct efx_nic *efx) +{ +/* Each port has a small block of internal SRAM dedicated to +* the buffer table and descriptor caches. In theory we can +* map both blocks to one port, but we don't. +*/ +efx_nic_dimension_resources (efx,FR_CZ_BUF_FULL_TBL_ROWS /2 ); +} +static int siena_probe_nic (struct efx_nic *efx) {struct siena_nic_data *nic_data;
@@ -619,6 +628,7 @@ const struct efx_nic_type siena_a0_nic_type = { .probe = siena_probe_nic, .remove = siena_remove_nic, .init = siena_init_nic, + .dimension_resources = siena_dimension_resources, .fini = efx_port_dummy_op_void, .monitor = NULL, .map_reset_reason = siena_map_reset_reason,
@@ -657,8 +667,6 @@ const struct efx_nic_type siena_a0_nic_type = {* interrupt handler only supports 32 * channels */ .timer_period_max = 1 << FRF_CZ_TC_TIMER_VAL_WIDTH, - .tx_dc_base = 0x88000, - .rx_dc_base = 0x68000, .offload_features = (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXHASH | NETIF_F_NTUPLE), };
Signature · 8 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
PATCH 19/19 sfc: Add SR-IOV back-end support for SFC9000 family
In reply to Ben HutchingsOn the SFC9000 family, each port has 1024 Virtual Interfaces (VIs), each with an RX queue, a TX queue, an event queue and a mailbox register. These may be assigned to up to 127 SR-IOV virtual functions per port, with up to 64 VIs per VF.
We allocate an extra channel (IRQ and event queue only) to receive requests from VF drivers.
There is a per-port limit of 4 concurrent RX queue flushes, and queue flushes may be initiated by the MC in response to a Function Level Reset (FLR) of a VF. Therefore, when SR-IOV is in use, we submit all flush requests via the MC.
The RSS indirection table is shared with VFs, so the number of RX queues used in the PF is limited to the number of VIs per VF.
This is almost entirely the work of Steve Hodgson, formerly [email protected].
--- drivers/net/ethernet/sfc/Kconfig | 8 + drivers/net/ethernet/sfc/Makefile | 1 + drivers/net/ethernet/sfc/efx.c | 70 ++- drivers/net/ethernet/sfc/ethtool.c | 3 +- drivers/net/ethernet/sfc/mcdi.c | 34 + drivers/net/ethernet/sfc/mcdi.h | 2 + drivers/net/ethernet/sfc/mcdi_mac.c | 2 +- drivers/net/ethernet/sfc/net_driver.h | 32 +- drivers/net/ethernet/sfc/nic.c | 79 ++- drivers/net/ethernet/sfc/nic.h | 89 ++ drivers/net/ethernet/sfc/siena.c | 2 + drivers/net/ethernet/sfc/siena_sriov.c | 1642 ++++++++++++++++++++++++++++++++ drivers/net/ethernet/sfc/vfdi.h | 254 +++++ 13 files changed, 2192 insertions(+), 26 deletions(-) create mode 100644 drivers/net/ethernet/sfc/siena_sriov.c create mode 100644 drivers/net/ethernet/sfc/vfdi.h
drivers/net/ethernet/sfc/Kconfig +8 -0
@@ -26,3 +26,11 @@ config SFC_MCDI_MON ----help--- This exposes the on-board firmware-managed sensors as a hardware monitor device. +config SFC_SRIOV + bool "Solarflare SFC9000-family SR-IOV support" + depends on SFC && PCI_IOV + default y + ---help--- + This enables support for the SFC9000 I/O Virtualization + features, allowing accelerated network performance in + virtualized environments.
drivers/net/ethernet/sfc/Makefile +1 -0
@@ -4,5 +4,6 @@ sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o filter.o \ tenxpress.o txc43128_phy.o falcon_boards.o \ mcdi.o mcdi_phy.o mcdi_mon.o sfc-$(CONFIG_SFC_MTD) += mtd.o +sfc-$(CONFIG_SFC_SRIOV) += siena_sriov.o obj-$(CONFIG_SFC) += sfc.o
drivers/net/ethernet/sfc/efx.c +55 -15
141 lines not on this page · raw message
drivers/net/ethernet/sfc/ethtool.c +2 -1
@@ -1085,7 +1085,8 @@ static u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev) {struct efx_nic *efx =netdev_priv (net_dev); -return (efx_nic_rev (efx) <EFX_REV_FALCON_B0 ? +return ((efx_nic_rev (efx) <EFX_REV_FALCON_B0 || + efx->n_rx_channels ==1 ) ?0 :ARRAY_SIZE (efx->rx_indir_table)); }
drivers/net/ethernet/sfc/mcdi.c +34 -0
@@ -560,6 +560,9 @@ void efx_mcdi_process_event(struct efx_channel *channel,case MCDI_EVENT_CODE_MAC_STATS_DMA :/* MAC stats are gather lazily. We can ignore this. */ break ; +case MCDI_EVENT_CODE_FLR : +efx_sriov_flr (efx,MCDI_EVENT_FIELD (*event,FLR_VF )); +break ;default : netif_err(efx, hw, efx->net_dev, "Unknown MCDI event 0x%x\n",
@@ -1154,6 +1157,37 @@ fail:return rc; } +int efx_mcdi_flush_rxqs (struct efx_nic *efx) +{ +struct efx_channel *channel; +struct efx_rx_queue *rx_queue; +__le32 *qid; +int rc, count; + + qid =kmalloc (EFX_MAX_CHANNELS *sizeof (*qid),GFP_KERNEL ); +if (qid ==NULL ) +return -ENOMEM ; + + count =0 ; +efx_for_each_channel (channel, efx) { +efx_for_each_channel_rx_queue (rx_queue, channel) { +if (rx_queue->flush_pending) { + rx_queue->flush_pending = false; +atomic_dec (&efx->rxq_flush_pending); + qid[count++] =cpu_to_le32 ( +efx_rx_queue_index (rx_queue)); + } + } + } + + rc =efx_mcdi_rpc (efx,MC_CMD_FLUSH_RX_QUEUES , (u8 *)qid, + count *sizeof (*qid),NULL ,0 ,NULL ); +WARN_ON (rc >0 ); + +kfree (qid); + +return rc; +}int efx_mcdi_wol_filter_reset (struct efx_nic *efx) {
drivers/net/ethernet/sfc/mcdi.h +2 -0
@@ -146,6 +146,8 @@ extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx,extern int efx_mcdi_wol_filter_get_magic (struct efx_nic *efx,int *id_out);extern int efx_mcdi_wol_filter_remove (struct efx_nic *efx,int id);extern int efx_mcdi_wol_filter_reset (struct efx_nic *efx); +extern int efx_mcdi_flush_rxqs (struct efx_nic *efx); +extern int efx_mcdi_set_mac (struct efx_nic *efx);extern int efx_mcdi_mac_stats (struct efx_nic *efx,dma_addr_t dma_addr,u32 dma_len,int enable,int clear);extern int efx_mcdi_mac_reconfigure (struct efx_nic *efx);
drivers/net/ethernet/sfc/mcdi_mac.c +1 -1
@@ -12,7 +12,7 @@#include "mcdi.h" #include "mcdi_pcol.h" -static int efx_mcdi_set_mac (struct efx_nic *efx) +int efx_mcdi_set_mac (struct efx_nic *efx) {u32 reject, fcntl;u8 cmdbytes[MC_CMD_SET_MAC_IN_LEN ];
drivers/net/ethernet/sfc/net_driver.h +31 -1
@@ -24,6 +24,7 @@#include <linux/device.h> #include <linux/highmem.h> #include <linux/workqueue.h> +#include <linux/mutex.h> #include <linux/vmalloc.h> #include <linux/i2c.h>
@@ -54,7 +55,8 @@#define EFX_MAX_CHANNELS 32U#define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS -#define EFX_MAX_EXTRA_CHANNELS 0U +#define EFX_EXTRA_CHANNEL_IOV 0 +#define EFX_MAX_EXTRA_CHANNELS 1U/* Checksum generation is a per-queue option in hardware, so each * queue visible to the networking core is backed by two hardware TX
@@ -629,6 +631,8 @@ union efx_multicast_hash { };struct efx_filter_state ; +struct efx_vf ; +struct vfdi_status ;/** * struct efx_nic - an Efx NIC
@@ -712,6 +716,17 @@ struct efx_filter_state;* completed (either success or failure). Not used when MCDI is used to * flush receive queues. * @flush_wq: wait queue used by efx_nic_flush_queues() to wait for flush completions. +* @vf: Array of &struct efx_vf objects. +* @vf_count: Number of VFs intended to be enabled. +* @vf_init_count: Number of VFs that have been fully initialised. +* @vi_scale: log2 number of vnics per VF. +* @vf_buftbl_base: The zeroth buffer table index used to back VF queues. +* @vfdi_status: Common VFDI status page to be dmad to VF address space. +* @local_addr_list: List of local addresses. Protected by %local_lock. +* @local_page_list: List of DMA addressable pages used to broadcast +* %local_addr_list. Protected by %local_lock. +* @local_lock: Mutex protecting %local_addr_list and %local_page_list. +* @peer_work: Work item to broadcast peer addresses to VMs. * @monitor_work: Hardware monitor workitem * @biu_lock: BIU (bus interface unit) lock * @last_irq_cpu: Last CPU to handle a possible test interrupt. This
@@ -762,6 +777,7 @@ struct efx_nic {unsigned next_buffer_table;unsigned n_channels;unsigned n_rx_channels; +unsigned rss_spread;unsigned tx_channel_offset;unsigned n_tx_channels;unsigned int rx_buffer_len;
@@ -820,6 +836,20 @@ struct efx_nic {atomic_t rxq_flush_outstanding;wait_queue_head_t flush_wq; +#ifdef CONFIG_SFC_SRIOV +struct efx_channel *vfdi_channel; +struct efx_vf *vf; +unsigned vf_count; +unsigned vf_init_count; +unsigned vi_scale; +unsigned vf_buftbl_base; +struct efx_buffer vfdi_status; +struct list_head local_addr_list; +struct list_head local_page_list; +struct mutex local_lock; +struct work_struct peer_work; +#endif +/* The following fields may be written more often */ struct delayed_work monitor_work____cacheline_aligned_in_smp ;
drivers/net/ethernet/sfc/nic.c +71 -8
134 lines not on this page · raw message
drivers/net/ethernet/sfc/nic.h +89 -0
95 lines not on this page · raw message
drivers/net/ethernet/sfc/siena.c +2 -0
@@ -313,6 +313,8 @@ static int siena_probe_nic(struct efx_nic *efx)if (rc) goto fail5; +efx_sriov_probe (efx); +return 0 ; fail5:
drivers/net/ethernet/sfc/siena_sriov.c new file +1642 -0
1,642 lines not on this page · raw message
drivers/net/ethernet/sfc/vfdi.h new file +254 -0
254 lines not on this page · raw message
Signature · 7 lines
1.7.7.6 -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [PATCH net-next 19/19] sfc: Add SR-IOV back-end support for SFC9000 family
Quoted 13 lines · Ben Hutchings
On the SFC9000 family, each port has 1024 Virtual Interfaces (VIs), each with an RX queue, a TX queue, an event queue and a mailbox register. These may be assigned to up to 127 SR-IOV virtual functions per port, with up to 64 VIs per VF.
We allocate an extra channel (IRQ and event queue only) to receive requests from VF drivers.
There is a per-port limit of 4 concurrent RX queue flushes, and queue flushes may be initiated by the MC in response to a Function Level Reset (FLR) of a VF. Therefore, when SR-IOV is in use, we submit all flush requests via the MC.
Quoted 8 lines
The RSS indirection table is shared with VFs, so the number of RX queues used in the PF is limited to the number of VIs per VF.
This is almost entirely the work of Steve Hodgson, formerly [email protected].
Signed-off-by Ben Hutchings <[email protected]>---
Hi Ben,
So how would multiple VIs per VF work? Looks like each VI has a TX/RX pair all bundled under a single netdev with some set of TX MAC filters.
Do you expect users to build tc rules and edit the queue_mapping to get the skb headed at the correct tx queue? Would it be better to model each VI has its own net device.
Thanks,
John
Re: [PATCH net-next 19/19] sfc: Add SR-IOV back-end support for SFC9000 family
Quoted 20 lines · John Fastabend
Quoted 19 lines · Ben Hutchings
On the SFC9000 family, each port has 1024 Virtual Interfaces (VIs), each with an RX queue, a TX queue, an event queue and a mailbox register. These may be assigned to up to 127 SR-IOV virtual functions per port, with up to 64 VIs per VF.
We allocate an extra channel (IRQ and event queue only) to receive requests from VF drivers.
There is a per-port limit of 4 concurrent RX queue flushes, and queue flushes may be initiated by the MC in response to a Function Level Reset (FLR) of a VF. Therefore, when SR-IOV is in use, we submit all flush requests via the MC.
The RSS indirection table is shared with VFs, so the number of RX queues used in the PF is limited to the number of VIs per VF.
This is almost entirely the work of Steve Hodgson, formerly [email protected].
Quoted 7 lines
Quoted 2 lines
Signed-off-by Ben Hutchings <[email protected]>---
Hi Ben,
So how would multiple VIs per VF work? Looks like each VI has a TX/RX pair all bundled under a single netdev with some set of TX MAC filters.
They can be used to provide a multiqueue net device for use in multi- processor guests.
Quoted 3 lines
Do you expect users to build tc rules and edit the
queue_mappingto get the skb headed at the correct tx queue? Would it be better to model each VI has its own net device.
No, we expect users to assign the VF into the guest.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [PATCH net-next 19/19] sfc: Add SR-IOV back-end support for SFC9000 family
Quoted 24 lines · Ben Hutchings
Quoted 23 lines · John Fastabend
Quoted 21 lines · Ben Hutchings
On the SFC9000 family, each port has 1024 Virtual Interfaces (VIs), each with an RX queue, a TX queue, an event queue and a mailbox register. These may be assigned to up to 127 SR-IOV virtual functions per port, with up to 64 VIs per VF.
We allocate an extra channel (IRQ and event queue only) to receive requests from VF drivers.
There is a per-port limit of 4 concurrent RX queue flushes, and queue flushes may be initiated by the MC in response to a Function Level Reset (FLR) of a VF. Therefore, when SR-IOV is in use, we submit all flush requests via the MC.
The RSS indirection table is shared with VFs, so the number of RX queues used in the PF is limited to the number of VIs per VF.
This is almost entirely the work of Steve Hodgson, formerly [email protected].
Signed-off-by Ben Hutchings <[email protected]>---
Quoted 7 lines
Quoted 4 lines
Hi Ben,
So how would multiple VIs per VF work? Looks like each VI has a TX/RX pair all bundled under a single netdev with some set of TX MAC filters.
They can be used to provide a multiqueue net device for use in multi- processor guests.
OK thanks its really just a multiqueue VF then. Calling it a virtual interface seems a bit confusing here. For example it doesn't resemble a VSI (Virtual Station Interface) per 802.1Q spec at all.
I'm guessing using this with a TX MAC/VLAN filter looks something like Intel's VMDQ solutions.
Quoted 7 lines
Quoted 4 lines
Do you expect users to build tc rules and edit the
queue_mappingto get the skb headed at the correct tx queue? Would it be better to model each VI has its own net device.No, we expect users to assign the VF into the guest.
Got it.
.John
Re: [PATCH net-next 19/19] sfc: Add SR-IOV back-end support for SFC9000 family
Quoted 27 lines · John Fastabend
Quoted 26 lines · Ben Hutchings
Quoted 25 lines · John Fastabend
Quoted 13 lines · Ben Hutchings
On the SFC9000 family, each port has 1024 Virtual Interfaces (VIs), each with an RX queue, a TX queue, an event queue and a mailbox register. These may be assigned to up to 127 SR-IOV virtual functions per port, with up to 64 VIs per VF.
We allocate an extra channel (IRQ and event queue only) to receive requests from VF drivers.
There is a per-port limit of 4 concurrent RX queue flushes, and queue flushes may be initiated by the MC in response to a Function Level Reset (FLR) of a VF. Therefore, when SR-IOV is in use, we submit all flush requests via the MC.
Quoted 8 lines
The RSS indirection table is shared with VFs, so the number of RX queues used in the PF is limited to the number of VIs per VF.
This is almost entirely the work of Steve Hodgson, formerly [email protected].
Signed-off-by Ben Hutchings <[email protected]>---
Hi Ben,
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
So how would multiple VIs per VF work? Looks like each VI has a TX/RX pair all bundled under a single netdev with some set of TX MAC filters.
They can be used to provide a multiqueue net device for use in multi- processor guests.
OK thanks its really just a multiqueue VF then. Calling it a virtual interface seems a bit confusing here.
The Falcon architecture was designed around the needs of user-level networking, so that we could give each process a Virtual Interface consisting of one RX, one TX and one event queue by mapping one page of MMIO space into the process. This term is now used to refer to a set of queues accessible through a single page - but there is no hard-wired connection between them or with other resources like filters.
Quoted 2 lines
For example it doesn't resemble
a VSI (Virtual Station Interface) per 802.1Q spec at all.
Right. Also, Solarflare documentation uses the term 'VNIC' instead of 'VI', while it's not what is usually meant by 'vNIC' now, either. But Solarflare and its predecessors were using these terms well before networking virtualisation was cool. ;-)
Quoted 2 lines
I'm guessing using this with a TX MAC/VLAN filter looks something like Intel's VMDQ solutions.
Possibly; I haven't compared.
Ben.
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Do you expect users to build tc rules and edit the
queue_mappingto get the skb headed at the correct tx queue? Would it be better to model each VI has its own net device.No, we expect users to assign the VF into the guest.
Got it.
.John
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
David Miller
maintainerFrom: Ben Hutchings <[email protected]>
Date: Thu, 16 Feb 2012 00:42:18 +0000
Quoted 10 lines
The following changes since commit
eb40d89276705a35c9a2e05793ae63411ae357eb:mlx4: add unicast steering entries to
resource_tracker(2012-02-14 14:11:59 -0500)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc-next.gitfor-davem(commit
cd2d5b529cdb9bd274f3e4bc68d37d4d63b7f383)The main change here is the addition of SR-IOV support.
Pulled, thanks Ben.