@@ -634,6 +634,67 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
return diag;
}
+static void
+dpdk_eth_parse_flow_ctrl(struct netdev_dpdk *dev,
+ const struct smap *args,
+ struct rte_eth_fc_conf *fc_conf)
+ OVS_REQUIRES(dev->mutex)
Minor: the other thread safety annotations are not aligned with the parameters, but are just indented four spaces.
[Sugesh] Sorry, Will correct it.
+{
+ int ret = 0;
+ int rx_fc_en = 0;
+ int tx_fc_en = 0;
+ const char *rx_flow_mode;
+ const char *tx_flow_mode;
+ const char *flow_autoneg;
+ enum rte_eth_fc_mode fc_mode_set[2][2] = {{RTE_FC_NONE, RTE_FC_TX_PAUSE},
+ {RTE_FC_RX_PAUSE, RTE_FC_FULL}
+ };
+
+ ret = rte_eth_dev_flow_ctrl_get(dev->port_id, fc_conf);
+ if (ret != 0) {
+ VLOG_DBG("cannot get flow control parameters on port=%d, err=%s",
+ dev->port_id, rte_strerror(ret));
I'm not sure, do we need to change 'ret' sign before passing it to rte_strerror()?
[Sugesh] : Either I can change it to rte_strerror(abs(ret)), or print the error code as is.
All the existing ‘flow_ctrl_get’ driver implementation doesn’t return any error code in DPDK. It returns ‘0’ always. So I think its OK to just print the error code as it is. What do you think?
+ return;
+ }
+ rx_flow_mode = smap_get(args, "rx-flow-ctrl");
+ tx_flow_mode = smap_get(args, "tx-flow-ctrl");
+ flow_autoneg = smap_get(args, "flow-ctrl-autoneg");
+ if (rx_flow_mode) {
+ if (!strcmp(rx_flow_mode, "on")) {
+ rx_fc_en = 1;
+ }
+ else if (!strcmp(rx_flow_mode, "off")) {
+ rx_fc_en = 0;
+ }
+ }
+ if (tx_flow_mode) {
+ if (!strcmp(tx_flow_mode, "on")) {
+ tx_fc_en =1;
+ }
+ else if (!strcmp(tx_flow_mode, "off")) {
+ tx_fc_en =0;
+ }
+ }
+ if (flow_autoneg) {
+ if (!strcmp(flow_autoneg, "on")) {
+ fc_conf->autoneg = 1;
+ }
+ else if (!strcmp(flow_autoneg, "off")) {
+ fc_conf->autoneg = 0;
+ }
+ }
+ fc_conf->mode = fc_mode_set[tx_fc_en][rx_fc_en];
+}
+
+static void
+dpdk_eth_flow_ctrl_config(struct netdev_dpdk *dev,
+ struct rte_eth_fc_conf *fc_conf)