-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dpdk/hw_offload: add support for vlan stripping - v3 #12008
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,7 @@ static void DPDKDerefConfig(void *conf); | |
#define DPDK_CONFIG_DEFAULT_MULTICAST_MODE 1 | ||
#define DPDK_CONFIG_DEFAULT_CHECKSUM_VALIDATION 1 | ||
#define DPDK_CONFIG_DEFAULT_CHECKSUM_VALIDATION_OFFLOAD 1 | ||
#define DPDK_CONFIG_DEFAULT_VLAN_STRIP 0 | ||
#define DPDK_CONFIG_DEFAULT_COPY_MODE "none" | ||
#define DPDK_CONFIG_DEFAULT_COPY_INTERFACE "none" | ||
|
||
|
@@ -136,6 +137,7 @@ DPDKIfaceConfigAttributes dpdk_yaml = { | |
.checksum_checks = "checksum-checks", | ||
.checksum_checks_offload = "checksum-checks-offload", | ||
.mtu = "mtu", | ||
.vlan_strip_offload = "vlan-strip-offload", | ||
.rss_hf = "rss-hash-functions", | ||
.mempool_size = "mempool-size", | ||
.mempool_cache_size = "mempool-cache-size", | ||
|
@@ -616,6 +618,13 @@ static int ConfigSetChecksumOffload(DPDKIfaceConfig *iconf, int entry_bool) | |
SCReturnInt(0); | ||
} | ||
|
||
static int ConfigSetVlanStrip(DPDKIfaceConfig *iconf, int entry_bool) | ||
{ | ||
SCEnter(); | ||
iconf->vlan_strip_enabled = entry_bool; | ||
SCReturn; | ||
} | ||
|
||
static int ConfigSetCopyIface(DPDKIfaceConfig *iconf, const char *entry_str) | ||
{ | ||
SCEnter(); | ||
|
@@ -807,6 +816,13 @@ static int ConfigLoad(DPDKIfaceConfig *iconf, const char *iface) | |
if (retval < 0) | ||
SCReturnInt(retval); | ||
|
||
retval = ConfGetChildValueBoolWithDefault( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the function is void then retval should not be assigned. Then you don't need to check for the return code of retval (if-statement at L823) |
||
if_root, if_default, dpdk_yaml.vlan_strip_offload, &entry_bool) != 1 | ||
? ConfigSetVlanStrip(iconf, DPDK_CONFIG_DEFAULT_VLAN_STRIP) | ||
: ConfigSetVlanStrip(iconf, entry_bool); | ||
if (retval < 0) | ||
SCReturnInt(retval); | ||
|
||
retval = ConfGetChildValueWithDefault(if_root, if_default, dpdk_yaml.copy_mode, ©_mode_str); | ||
if (retval != 1) | ||
SCReturnInt(-ENOENT); | ||
|
@@ -1191,6 +1207,20 @@ static void PortConfSetChsumOffload(const DPDKIfaceConfig *iconf, | |
} | ||
} | ||
|
||
static void PortConfSetVlanOffload(const DPDKIfaceConfig *iconf, | ||
const struct rte_eth_dev_info *dev_info, struct rte_eth_conf *port_conf) | ||
{ | ||
if (iconf->vlan_strip_enabled) { | ||
if (dev_info->rx_offload_capa & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) { | ||
port_conf->rxmode.offloads |= RTE_ETH_RX_OFFLOAD_VLAN_STRIP; | ||
SCLogConfig("%s: hardware VLAN stripping enabled", iconf->iface); | ||
} else { | ||
SCLogWarning("%s: hardware VLAN stripping enabled but not supported, disabling", | ||
iconf->iface); | ||
} | ||
} | ||
} | ||
|
||
static void DeviceInitPortConf(const DPDKIfaceConfig *iconf, | ||
const struct rte_eth_dev_info *dev_info, struct rte_eth_conf *port_conf) | ||
{ | ||
|
@@ -1212,6 +1242,7 @@ static void DeviceInitPortConf(const DPDKIfaceConfig *iconf, | |
PortConfSetRSSConf(iconf, dev_info, port_conf); | ||
PortConfSetChsumOffload(iconf, dev_info, port_conf); | ||
DeviceSetMTU(port_conf, iconf->mtu); | ||
PortConfSetVlanOffload(iconf, dev_info, port_conf); | ||
|
||
if (dev_info->tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) { | ||
port_conf->txmode.offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you didn't change the function to void
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I noticed it only at the tests, my bad. I will make one more iteration of PR.