/*-
- * Copyright (c) 2016 Solarflare Communications Inc.
+ * BSD LICENSE
+ *
+ * Copyright (c) 2016-2017 Solarflare Communications Inc.
* All rights reserved.
*
* This software was jointly developed between OKTET Labs (under contract
uint8_t *mbuf_data;
- if ((rxq->flags & SFC_RXQ_RSS_HASH) == 0)
+ if ((rxq->flags & SFC_RXQ_FLAG_RSS_HASH) == 0)
return;
mbuf_data = rte_pktmbuf_mtod(m, uint8_t *);
boolean_t discard_next = B_FALSE;
struct rte_mbuf *scatter_pkt = NULL;
- if (unlikely((rxq->state & SFC_RXQ_RUNNING) == 0))
+ if (unlikely((rxq->flags & SFC_RXQ_FLAG_RUNNING) == 0))
return 0;
sfc_ev_qpoll(rxq->evq);
SFC_ASSERT(sw_index < sa->rxq_count);
rxq = sa->rxq_info[sw_index].rxq;
- if (rxq == NULL || (rxq->state & SFC_RXQ_RUNNING) == 0)
+ if (rxq == NULL || (rxq->flags & SFC_RXQ_FLAG_RUNNING) == 0)
return 0;
sfc_ev_qpoll(rxq->evq);
int
sfc_rx_qdesc_done(struct sfc_rxq *rxq, unsigned int offset)
{
- if ((rxq->state & SFC_RXQ_RUNNING) == 0)
+ if ((rxq->flags & SFC_RXQ_FLAG_RUNNING) == 0)
return 0;
sfc_ev_qpoll(rxq->evq);
sfc_rx_qpurge(rxq);
}
+static int
+sfc_rx_default_rxq_set_filter(struct sfc_adapter *sa, struct sfc_rxq *rxq)
+{
+ boolean_t rss = (sa->rss_channels > 1) ? B_TRUE : B_FALSE;
+ struct sfc_port *port = &sa->port;
+ int rc;
+
+ /*
+ * If promiscuous or all-multicast mode has been requested, setting
+ * filter for the default Rx queue might fail, in particular, while
+ * running over PCI function which is not a member of corresponding
+ * privilege groups; if this occurs, few iterations will be made to
+ * repeat this step without promiscuous and all-multicast flags set
+ */
+retry:
+ rc = efx_mac_filter_default_rxq_set(sa->nic, rxq->common, rss);
+ if (rc == 0)
+ return 0;
+ else if (rc != EOPNOTSUPP)
+ return rc;
+
+ if (port->promisc) {
+ sfc_warn(sa, "promiscuous mode has been requested, "
+ "but the HW rejects it");
+ sfc_warn(sa, "promiscuous mode will be disabled");
+
+ port->promisc = B_FALSE;
+ rc = sfc_set_rx_mode(sa);
+ if (rc != 0)
+ return rc;
+
+ goto retry;
+ }
+
+ if (port->allmulti) {
+ sfc_warn(sa, "all-multicast mode has been requested, "
+ "but the HW rejects it");
+ sfc_warn(sa, "all-multicast mode will be disabled");
+
+ port->allmulti = B_FALSE;
+ rc = sfc_set_rx_mode(sa);
+ if (rc != 0)
+ return rc;
+
+ goto retry;
+ }
+
+ return rc;
+}
+
int
sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
{
rxq->pending = rxq->completed = rxq->added = rxq->pushed = 0;
- rxq->state |= (SFC_RXQ_STARTED | SFC_RXQ_RUNNING);
+ rxq->state |= SFC_RXQ_STARTED;
+ rxq->flags |= SFC_RXQ_FLAG_STARTED | SFC_RXQ_FLAG_RUNNING;
sfc_rx_qrefill(rxq);
if (sw_index == 0) {
- rc = efx_mac_filter_default_rxq_set(sa->nic, rxq->common,
- (sa->rss_channels > 1) ?
- B_TRUE : B_FALSE);
+ rc = sfc_rx_default_rxq_set_filter(sa, rxq);
if (rc != 0)
goto fail_mac_filter_default_rxq_set;
}
sa->eth_dev->data->rx_queue_state[sw_index] =
RTE_ETH_QUEUE_STATE_STOPPED;
- rxq->state &= ~SFC_RXQ_RUNNING;
+ rxq->flags &= ~SFC_RXQ_FLAG_RUNNING;
if (sw_index == 0)
efx_mac_filter_default_rxq_clear(sa->nic);
sfc_rx_qflush(sa, sw_index);
+ rxq->flags &= ~SFC_RXQ_FLAG_STARTED;
rxq->state = SFC_RXQ_INITIALIZED;
efx_rx_qdestroy(rxq->common);
#if EFSYS_OPT_RX_SCALE
if (sa->hash_support == EFX_RX_HASH_AVAILABLE)
- rxq->flags |= SFC_RXQ_RSS_HASH;
+ rxq->flags |= SFC_RXQ_FLAG_RSS_HASH;
#endif
rxq->state = SFC_RXQ_INITIALIZED;