Skip to content

Commit

Permalink
netdev-dpdk: Do not attempt to initialise flow control for 'dpdkr' ports
Browse files Browse the repository at this point in the history
Only 'dpdk' ports support flow control. This patch stops 'dpdkr' ports
from attempting to initialise this feature as this port type does not
support it.

Fixes: 9fd3937 ("netdev-dpdk: Add Flow Control support.")
Signed-off-by: Ciara Loftus <[email protected]>
Acked-by: Daniele Di Proietto <[email protected]>
  • Loading branch information
cloftus authored and ddiproietto committed Aug 15, 2016
1 parent 7cd1261 commit c3d062a
Showing 1 changed file with 40 additions and 21 deletions.
61 changes: 40 additions & 21 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,34 +1061,53 @@ netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)
return 0;
}

static int
netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args)
static void
dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args)
{
struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
int new_n_rxq;

ovs_mutex_lock(&dev->mutex);
new_n_rxq = MAX(smap_get_int(args, "n_rxq", dev->requested_n_rxq), 1);
if (new_n_rxq != dev->requested_n_rxq) {
dev->requested_n_rxq = new_n_rxq;
netdev_request_reconfigure(netdev);
netdev_request_reconfigure(&dev->up);
}
}

static int
netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args)
{
struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);

ovs_mutex_lock(&dev->mutex);

dpdk_set_rxq_config(dev, args);

/* Flow control support is only available for DPDK Ethernet ports. */
bool rx_fc_en = false;
bool tx_fc_en = false;
enum rte_eth_fc_mode fc_mode_set[2][2] =
{{RTE_FC_NONE, RTE_FC_TX_PAUSE},
{RTE_FC_RX_PAUSE, RTE_FC_FULL}
};
rx_fc_en = smap_get_bool(args, "rx-flow-ctrl", false);
tx_fc_en = smap_get_bool(args, "tx-flow-ctrl", false);
dev->fc_conf.autoneg = smap_get_bool(args, "flow-ctrl-autoneg", false);
dev->fc_conf.mode = fc_mode_set[tx_fc_en][rx_fc_en];

dpdk_eth_flow_ctrl_setup(dev);

/* Flow control configuration for DPDK Ethernet ports. */
if (dev->type == DPDK_DEV_ETH) {
bool rx_fc_en = false;
bool tx_fc_en = false;
enum rte_eth_fc_mode fc_mode_set[2][2] =
{{RTE_FC_NONE, RTE_FC_TX_PAUSE},
{RTE_FC_RX_PAUSE, RTE_FC_FULL}
};
rx_fc_en = smap_get_bool(args, "rx-flow-ctrl", false);
tx_fc_en = smap_get_bool(args, "tx-flow-ctrl", false);
dev->fc_conf.autoneg = smap_get_bool(args, "flow-ctrl-autoneg", false);
dev->fc_conf.mode = fc_mode_set[tx_fc_en][rx_fc_en];

dpdk_eth_flow_ctrl_setup(dev);
}
ovs_mutex_unlock(&dev->mutex);

return 0;
}

static int
netdev_dpdk_ring_set_config(struct netdev *netdev, const struct smap *args)
{
struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);

ovs_mutex_lock(&dev->mutex);
dpdk_set_rxq_config(dev, args);
ovs_mutex_unlock(&dev->mutex);

return 0;
Expand Down Expand Up @@ -3513,7 +3532,7 @@ static const struct netdev_class dpdk_ring_class =
NULL,
netdev_dpdk_ring_construct,
netdev_dpdk_destruct,
netdev_dpdk_set_config,
netdev_dpdk_ring_set_config,
netdev_dpdk_set_tx_multiq,
netdev_dpdk_ring_send,
netdev_dpdk_get_carrier,
Expand Down

0 comments on commit c3d062a

Please sign in to comment.