代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From a547e495321969074b72331c0ae6b65a39975f6a Mon Sep 17 00:00:00 2001
From: hkk <hankangkang5@huawei.com>
Date: Mon, 5 Aug 2024 21:58:46 +0800
Subject: [PATCH] virtio_user: add vlan info for kernerl packets when vlan
switch is on
---
src/lstack/core/lstack_virtio.c | 14 ++++++++++++++
src/lstack/netif/lstack_vdev.c | 1 +
2 files changed, 15 insertions(+)
diff --git a/src/lstack/core/lstack_virtio.c b/src/lstack/core/lstack_virtio.c
index 70b025c..f95b289 100644
--- a/src/lstack/core/lstack_virtio.c
+++ b/src/lstack/core/lstack_virtio.c
@@ -179,6 +179,20 @@ void virtio_tap_process_rx(uint16_t port, uint32_t queue_id)
uint32_t pkg_num;
pkg_num = rte_eth_rx_burst(g_virtio_instance.virtio_port_id, queue_id, pkts_burst, VIRTIO_TX_RX_RING_SIZE);
+ /*
+ * For VLAN, the tap device defaults to tx-vlan-ofload as enabled and will not be modified by default,
+ * so the judgment is skipped.
+ * For checksum, tap devices are turned off by default, and it is assumed that they will not be modified,
+ * so no action will be taken.
+ * For TSO, tap devices do not support it, so no action will be taken.
+ */
+ if (get_global_cfg_params()->nic.vlan_mode != -1) {
+ for (int i = 0; i< pkg_num; i++) {
+ pkts_burst[i]->ol_flags |= RTE_MBUF_F_TX_VLAN;
+ pkts_burst[i]->vlan_tci = (u16_t)get_global_cfg_params()->nic.vlan_mode;
+ }
+ }
+
if (pkg_num > 0) {
g_virtio_instance.rx_pkg[queue_id] += pkg_num;
uint16_t nb_rx = rte_eth_tx_burst(lstack_net_port, queue_id, pkts_burst, pkg_num);
diff --git a/src/lstack/netif/lstack_vdev.c b/src/lstack/netif/lstack_vdev.c
index a590b30..9ca77ba 100644
--- a/src/lstack/netif/lstack_vdev.c
+++ b/src/lstack/netif/lstack_vdev.c
@@ -87,6 +87,7 @@ static inline void vdev_pkts_parse(struct rte_mbuf **pkts, int pkt_num)
pkts[i]->l2_len = sizeof(struct rte_ether_hdr);
}
+ pkts[i]->packet_type = 0;
if (type == RTE_BE16(RTE_ETHER_TYPE_IPV4)) {
struct rte_ipv4_hdr *iph = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *,
pkts[i]->l2_len);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。