summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsongyanchao <[email protected]>2022-04-12 22:31:04 -0400
committersongyanchao <[email protected]>2022-04-12 22:31:04 -0400
commit0fe6ba8867e8cfc141c22c8a2f9d6479b2b137e7 (patch)
tree9f95a60c9246622f36939cec122b60fca6a65706
parentd9c07e3a7a177586e20a00786798f38848b5ebbb (diff)
🎈 perf(TSG-10204): 完善SmartOffload功能开关v4.5.1-20220413
完善SmartOffload功能开关 https://jira.geedge.net/browse/TSG-10204?filter=-1
-rw-r--r--service/src/core.c8
-rw-r--r--service/src/phydev.c16
2 files changed, 13 insertions, 11 deletions
diff --git a/service/src/core.c b/service/src/core.c
index 35906fe..55e202d 100644
--- a/service/src/core.c
+++ b/service/src/core.c
@@ -356,7 +356,7 @@ static void sc_eal_init(struct sc_main * sc, const char * cmd)
char * eal_argv[MR_SERVICE_MAX_EAL_ARGC];
unsigned int eal_argc = 0;
int ret = 0;
- struct phydev_whitelist * phydev_wh_iter;
+ struct phydev_whitelist * phydev_wh_iter = NULL;
WRITE_ARG(cmd);
@@ -369,9 +369,9 @@ static void sc_eal_init(struct sc_main * sc, const char * cmd)
unsigned int main_core = 0;
MESA_load_profile_uint_def(sc->local_cfgfile, "service", "main_core", &main_core, 0);
- nr_io_cores = MESA_load_profile_uint_range(sc->local_cfgfile,
+ nr_io_cores = MESA_load_profile_uint_range(sc->local_cfgfile,
"service", "iocore", RTE_DIM(io_cores), io_cores);
- nr_smartoffload_cores = MESA_load_profile_uint_range(sc->local_cfgfile,
+ nr_smartoffload_cores = MESA_load_profile_uint_range(sc->local_cfgfile,
"service", "offload_core", RTE_DIM(smartoffload_cores), smartoffload_cores);
if (nr_io_cores < 0)
@@ -1141,7 +1141,7 @@ int main(int argc, char * argv[])
{
if (!CPU_ISSET(lcore_id, &cpu_set_service))
continue;
-
+
ret = rte_service_lcore_start(lcore_id);
fprintf(stderr, "---- debug --- : start lcore %d\n", lcore_id);
diff --git a/service/src/phydev.c b/service/src/phydev.c
index fe4fd04..92edbed 100644
--- a/service/src/phydev.c
+++ b/service/src/phydev.c
@@ -462,14 +462,16 @@ static int phydev_setup(struct sc_main * sc, struct phydev_main * ctx, struct ph
Check this NIC can support hairpin or not.
The SmartOffload can not use when hairpin mode is unavailable.
*/
-
- struct rte_eth_hairpin_cap hairpin_cap = {};
- retval = rte_eth_dev_hairpin_capability_get(dev->port_id, &hairpin_cap);
- if (unlikely(retval != 0))
+ if (dev->en_smartoffload )
{
- MR_ERROR("device %s hairpin mode is unavliable, SmartOffload can not be enabled: retval = %d, %s", dev->symbol,
- retval, rte_strerror(retval));
- return RT_ERR;
+ struct rte_eth_hairpin_cap hairpin_cap = {};
+ retval = rte_eth_dev_hairpin_capability_get(dev->port_id, &hairpin_cap);
+ if (unlikely(retval != 0))
+ {
+ MR_ERROR("device %s hairpin mode is unavliable, SmartOffload can not be enabled: retval = %d, %s", dev->symbol,
+ retval, rte_strerror(retval));
+ return RT_ERR;
+ }
}
/*