1 Star 0 Fork 32

LemmyHuang/gazelle_1

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0121-remove-unused-variables-in-pbuf-and-reduce-mbuf-size.patch 4.34 KB
一键复制 编辑 原始数据 按行查看 历史
yinbin6 提交于 2024-02-04 15:21 . sync patches from upstream
From 2bfb7f1dcaab4436db7345d6f9fcb6f4a1d27681 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Sun, 21 Jan 2024 16:42:46 +0800
Subject: [PATCH] remove unused variables in pbuf and reduce mbuf size
---
src/lstack/core/lstack_lwip.c | 10 ----------
src/lstack/include/lstack_dpdk.h | 2 +-
src/lstack/netif/lstack_ethdev.c | 11 -----------
3 files changed, 1 insertion(+), 22 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 6ebe589..63044c2 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -114,14 +114,7 @@ static struct pbuf *init_mbuf_to_pbuf(struct rte_mbuf *mbuf, pbuf_layer layer, u
void *data = rte_pktmbuf_mtod(mbuf, void *);
struct pbuf *pbuf = pbuf_alloced_custom(layer, length, type, pbuf_custom, data, MAX_PACKET_SZ);
if (pbuf) {
- pbuf->ol_flags = 0;
- pbuf->l2_len = 0;
- pbuf->l3_len = 0;
- pbuf->l4_len = 0;
- pbuf->header_off = 0;
- pbuf->rexmit = 0;
pbuf->allow_in = 1;
- pbuf->head = 0;
pbuf->last = pbuf;
pbuf->addr = *IP_ANY_TYPE;
pbuf->port = 0;
@@ -290,7 +283,6 @@ struct pbuf *do_lwip_get_from_sendring(struct lwip_sock *sock, uint16_t remain_s
if (pbuf->tot_len > remain_size) {
pthread_spin_unlock(&pbuf->pbuf_lock);
*apiflags &= ~TCP_WRITE_FLAG_MORE;
- pbuf->head = 1;
return NULL;
}
if (pbuf->allow_in == 1) {
@@ -300,7 +292,6 @@ struct pbuf *do_lwip_get_from_sendring(struct lwip_sock *sock, uint16_t remain_s
} else {
if (pbuf->tot_len > remain_size) {
*apiflags &= ~TCP_WRITE_FLAG_MORE;
- pbuf->head = 1;
return NULL;
}
}
@@ -1354,7 +1345,6 @@ err_t netif_loop_output(struct netif *netif, struct pbuf *p)
LSTACK_LOG(ERR, LSTACK, "netif_loop_output: pbuf_alloc failed\n");
return ERR_MEM;
}
- head->ol_flags = p->ol_flags;
memcpy_s(head->payload, head->len, p->payload, p->len);
if ((flags & TCP_SYN) && !(flags & TCP_ACK)) {
diff --git a/src/lstack/include/lstack_dpdk.h b/src/lstack/include/lstack_dpdk.h
index 2a44c6e..b39d199 100644
--- a/src/lstack/include/lstack_dpdk.h
+++ b/src/lstack/include/lstack_dpdk.h
@@ -21,7 +21,7 @@
#define KNI_NB_MBUF (DEFAULT_RING_SIZE << 4)
-#define MAX_PACKET_SZ 2048
+#define MAX_PACKET_SZ 1530
#define RING_SIZE(x) ((x) - 1)
diff --git a/src/lstack/netif/lstack_ethdev.c b/src/lstack/netif/lstack_ethdev.c
index 5b0f83e..4d6f620 100644
--- a/src/lstack/netif/lstack_ethdev.c
+++ b/src/lstack/netif/lstack_ethdev.c
@@ -103,9 +103,6 @@ void eth_dev_recv(struct rte_mbuf *mbuf, struct protocol_stack *stack)
}
next->tot_len = pkt_len;
pkt_len -= len;
-#if CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW
- next->ol_flags = m->ol_flags;
-#endif
if (head == NULL) {
head = next;
@@ -859,7 +856,6 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
struct protocol_stack *stack = get_protocol_stack();
struct rte_mbuf *pre_mbuf = NULL;
struct rte_mbuf *first_mbuf = NULL;
- struct pbuf *first_pbuf = pbuf;
void *buf_addr;
while (likely(pbuf != NULL)) {
@@ -867,8 +863,6 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
mbuf->data_len = pbuf->len;
mbuf->pkt_len = pbuf->tot_len;
- mbuf->ol_flags = pbuf->ol_flags;
- mbuf->vlan_tci = pbuf->vlan_tci;
mbuf->next = NULL;
buf_addr = rte_pktmbuf_mtod(mbuf, void *);
@@ -882,7 +876,6 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
if (first_mbuf == NULL) {
first_mbuf = mbuf;
- first_pbuf = pbuf;
first_mbuf->nb_segs = 1;
} else {
first_mbuf->nb_segs++;
@@ -893,13 +886,9 @@ static err_t eth_dev_output(struct netif *netif, struct pbuf *pbuf)
mbuf->ol_flags |= RTE_MBUF_F_TX_TCP_SEG;
mbuf->tso_segsz = MBUF_MAX_DATA_LEN;
}
- mbuf->l2_len = first_pbuf->l2_len;
- mbuf->l3_len = first_pbuf->l3_len;
- mbuf->l4_len = first_pbuf->l4_len;
pre_mbuf = mbuf;
rte_mbuf_refcnt_update(mbuf, 1);
- pbuf->rexmit = 1;
pbuf = pbuf->next;
}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/LemmyHuang/gazelle_1.git
git@gitee.com:LemmyHuang/gazelle_1.git
LemmyHuang
gazelle_1
gazelle_1
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385