Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/pktio/dpdk.c
line 67
@@ -93,6 +95,56 @@ void refer_constructors(void)
 }
 #endif
 
+static void lookup_opt(config_setting_t *default_opt, config_setting_t 
*drv_opt,
+                      const char *opt, int *val)
+{
+       /* Default option */
+       config_setting_lookup_int(default_opt, opt, val);
+
+       /* Driver option overwrites default option */
+       if (drv_opt)
+               config_setting_lookup_int(drv_opt, opt, val);
+}
+
+static void init_options(pktio_entry_t *pktio_entry,
+                        const struct rte_eth_dev_info *dev_info)
+{
+       dpdk_opt_t *opt = &pktio_entry->s.pkt_dpdk.opt;
+       config_setting_t *default_opt;
+       config_setting_t *drv_opt;
+
+       /* Default values. Update 'config/odp-linux.conf' if modified. */
+       opt->num_rx_desc = DPDK_NM_RX_DESC;
+       opt->num_tx_desc = DPDK_NM_TX_DESC;
+       opt->rx_drop_en = 0;
+
+       default_opt = _odp_libconfig_lookup("pktio_dpdk");
+       if (!default_opt) {
+               ODP_DBG("No DPDK pktio options found\n");
+               goto done;
+       }
+
+       /* config_lookup_from() was renamed to config_setting_lookup() in
+        * libconfig 1.5.0 */
+#if (LIBCONFIG_VER_MAJOR <= 1 && LIBCONFIG_VER_MINOR < 5)
+       drv_opt = config_lookup_from(default_opt, dev_info->driver_name);
+#else
+       drv_opt = config_setting_lookup(default_opt, dev_info->driver_name);
+#endif
+
+       /* Read options from config file */
+       lookup_opt(default_opt, drv_opt, "num_rx_desc", &opt->num_rx_desc);
+       lookup_opt(default_opt, drv_opt, "num_tx_desc", &opt->num_tx_desc);
+       lookup_opt(default_opt, drv_opt, "rx_drop_en", &opt->rx_drop_en);
+
+done:
+       printf("DPDK interface (%s): %" PRIu16 "\n", dev_info->driver_name,
+              pktio_entry->s.pkt_dpdk.port_id);
+       printf("  num_rx_desc: %d\n", opt->num_rx_desc);
+       printf("  num_tx_desc: %d\n", opt->num_tx_desc);
+       printf("  rx_drop_en: %d\n", opt->rx_drop_en);


Comment:
Do we really want to print this unconditionally? In any event shouldn't this be 
`ODP_LOG()` here rather than `printf()`?

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> According to the [libconfig 
> changelog](https://github.com/hyperrealm/libconfig/blob/master/ChangeLog) 
> there are versions pre-1.0 (e.g., 0.9) which would fail this test. This needs 
> to be reversed so that you use the newer form for v1.5 and higher levels:
> ```
> #if (LIBCONFIG_VER_MAJOR > 1 || (LIBCONFIG_VER_MAJOR == 1 && 
> LIBCONFIG_VER_MINOR >= 5)) ...
> ```


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> Does this have to be a hard dependency? Can we have this feature be omitted 
>> (hardcoded defaults are used) if libconfig is not available?


https://github.com/Linaro/odp/pull/499#discussion_r170353045
updated_at 2018-02-23 20:00:18

Reply via email to