From 26314ca06c238d85debf6d08d5a38acb93e5a017 Mon Sep 17 00:00:00 2001 From: Qiuwen Lu Date: Tue, 9 Jun 2020 15:44:51 +0800 Subject: 增加读入硬件CRC剥离的开关并在网卡初始化时设置。 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/include/sc_phydev.h | 5 ++++- service/src/phydev.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/service/include/sc_phydev.h b/service/include/sc_phydev.h index 1fe7644..4795626 100644 --- a/service/include/sc_phydev.h +++ b/service/include/sc_phydev.h @@ -64,7 +64,7 @@ struct phydev_info unsigned int en_promisc; /* VLAN选项 */ - unsigned int en_vlan_strip;; + unsigned int en_vlan_strip; unsigned int en_vlan_filter; unsigned int en_drop; @@ -72,6 +72,9 @@ struct phydev_info enum pvidmode pvidmode; unsigned int pvid; + /* CRC Strip */ + unsigned int en_hw_strip_crc; + /* VLAN Filter详细配置 */ unsigned int nr_vlan_filter_allow_ids; unsigned int nr_vlan_filter_deny_ids; diff --git a/service/src/phydev.c b/service/src/phydev.c index f9fbc6b..350ffca 100644 --- a/service/src/phydev.c +++ b/service/src/phydev.c @@ -191,6 +191,8 @@ static int gen_phydev_ethconf(struct phydev * dev, struct rte_eth_conf * out_eth // 配置VLAN相关功能 eth_conf.rxmode.hw_vlan_filter = dev->info.en_vlan_filter; eth_conf.rxmode.hw_vlan_strip = dev->info.en_vlan_strip; + eth_conf.rxmode.hw_strip_crc = dev->info.en_hw_strip_crc; + dev->en_vlan_strip = eth_conf.rxmode.hw_vlan_strip; dev->en_vlan_filter = eth_conf.rxmode.hw_vlan_filter; @@ -574,6 +576,8 @@ void phydev_config_by_g_cfg(struct phydev * phydev, const char * cfg) MESA_load_profile_uint_def(cfg, str_section, "max_rx_pkt_len", &phydev_info->max_rx_pkt_len, 0); // Clear Flags MESA_load_profile_uint_def(cfg, str_section, "clear_tx_flags", &phydev_info->clear_tx_flags, 0); + // 硬件CRC剥离 + MESA_load_profile_uint_def(cfg, str_section, "hw_strip_crc", &phydev_info->en_hw_strip_crc, 0); // 读MTU,网卡自适应。 MESA_load_profile_short_def(cfg, str_section, "mtu", (short *) &phydev->mtu, (short) phydev->mtu); // 读混杂模式 -- cgit v1.2.3