Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
混口饭吃,
rt-thread
提交
8907d321
R
rt-thread
项目概览
混口饭吃,
/
rt-thread
与 Fork 源项目一致
Fork自
Mr_Pangza / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8907d321
编写于
9月 11, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
9月 11, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5045 from grissiom/fix-ethnetif
[Netif] Fix the eth_tx_msg protection
上级
6af6a88d
1ebf7b51
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
7 deletion
+7
-7
components/net/lwip-2.1.2/src/include/netif/ethernetif.h
components/net/lwip-2.1.2/src/include/netif/ethernetif.h
+0
-1
components/net/lwip-2.1.2/src/netif/ethernetif.c
components/net/lwip-2.1.2/src/netif/ethernetif.c
+7
-6
未找到文件。
components/net/lwip-2.1.2/src/include/netif/ethernetif.h
浏览文件 @
8907d321
...
@@ -22,7 +22,6 @@ struct eth_device
...
@@ -22,7 +22,6 @@ struct eth_device
/* network interface for lwip */
/* network interface for lwip */
struct
netif
*
netif
;
struct
netif
*
netif
;
struct
rt_semaphore
tx_ack
;
rt_uint16_t
flags
;
rt_uint16_t
flags
;
rt_uint8_t
link_changed
;
rt_uint8_t
link_changed
;
...
...
components/net/lwip-2.1.2/src/netif/ethernetif.c
浏览文件 @
8907d321
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
* 2013-02-28 aozima fixed list_tcps bug: ipaddr_ntoa isn't reentrant.
* 2013-02-28 aozima fixed list_tcps bug: ipaddr_ntoa isn't reentrant.
* 2016-08-18 Bernard port to lwIP 2.0.0
* 2016-08-18 Bernard port to lwIP 2.0.0
* 2018-11-02 MurphyZhao port to lwIP 2.1.0
* 2018-11-02 MurphyZhao port to lwIP 2.1.0
* 2021-09-07 Grissiom fix eth_tx_msg ack bug
*/
*/
#include "lwip/opt.h"
#include "lwip/opt.h"
...
@@ -58,6 +59,8 @@
...
@@ -58,6 +59,8 @@
#include "lwip/inet.h"
#include "lwip/inet.h"
#include <ipc/completion.h>
#if LWIP_IPV6
#if LWIP_IPV6
#include "lwip/ethip6.h"
#include "lwip/ethip6.h"
#endif
/* LWIP_IPV6 */
#endif
/* LWIP_IPV6 */
...
@@ -79,6 +82,7 @@ struct eth_tx_msg
...
@@ -79,6 +82,7 @@ struct eth_tx_msg
{
{
struct
netif
*
netif
;
struct
netif
*
netif
;
struct
pbuf
*
buf
;
struct
pbuf
*
buf
;
struct
rt_completion
ack
;
};
};
static
struct
rt_mailbox
eth_tx_thread_mb
;
static
struct
rt_mailbox
eth_tx_thread_mb
;
...
@@ -387,18 +391,17 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p)
...
@@ -387,18 +391,17 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p)
{
{
#ifndef LWIP_NO_TX_THREAD
#ifndef LWIP_NO_TX_THREAD
struct
eth_tx_msg
msg
;
struct
eth_tx_msg
msg
;
struct
eth_device
*
enetif
;
RT_ASSERT
(
netif
!=
RT_NULL
);
RT_ASSERT
(
netif
!=
RT_NULL
);
enetif
=
(
struct
eth_device
*
)
netif
->
state
;
/* send a message to eth tx thread */
/* send a message to eth tx thread */
msg
.
netif
=
netif
;
msg
.
netif
=
netif
;
msg
.
buf
=
p
;
msg
.
buf
=
p
;
rt_completion_init
(
&
msg
.
ack
);
if
(
rt_mb_send
(
&
eth_tx_thread_mb
,
(
rt_uint32_t
)
&
msg
)
==
RT_EOK
)
if
(
rt_mb_send
(
&
eth_tx_thread_mb
,
(
rt_uint32_t
)
&
msg
)
==
RT_EOK
)
{
{
/* waiting for ack */
/* waiting for ack */
rt_
sem_take
(
&
(
enetif
->
tx_ack
)
,
RT_WAITING_FOREVER
);
rt_
completion_wait
(
&
msg
.
ack
,
RT_WAITING_FOREVER
);
}
}
#else
#else
struct
eth_device
*
enetif
;
struct
eth_device
*
enetif
;
...
@@ -519,7 +522,6 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
...
@@ -519,7 +522,6 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
dev
->
parent
.
type
=
RT_Device_Class_NetIf
;
dev
->
parent
.
type
=
RT_Device_Class_NetIf
;
/* register to RT-Thread device manager */
/* register to RT-Thread device manager */
rt_device_register
(
&
(
dev
->
parent
),
name
,
RT_DEVICE_FLAG_RDWR
);
rt_device_register
(
&
(
dev
->
parent
),
name
,
RT_DEVICE_FLAG_RDWR
);
rt_sem_init
(
&
(
dev
->
tx_ack
),
name
,
0
,
RT_IPC_FLAG_FIFO
);
/* set name */
/* set name */
netif
->
name
[
0
]
=
name
[
0
];
netif
->
name
[
0
]
=
name
[
0
];
...
@@ -595,7 +597,6 @@ void eth_device_deinit(struct eth_device *dev)
...
@@ -595,7 +597,6 @@ void eth_device_deinit(struct eth_device *dev)
#endif
#endif
rt_device_close
(
&
(
dev
->
parent
));
rt_device_close
(
&
(
dev
->
parent
));
rt_device_unregister
(
&
(
dev
->
parent
));
rt_device_unregister
(
&
(
dev
->
parent
));
rt_sem_detach
(
&
(
dev
->
tx_ack
));
rt_free
(
netif
);
rt_free
(
netif
);
}
}
...
@@ -673,7 +674,7 @@ static void eth_tx_thread_entry(void* parameter)
...
@@ -673,7 +674,7 @@ static void eth_tx_thread_entry(void* parameter)
}
}
/* send ACK */
/* send ACK */
rt_
sem_release
(
&
(
enetif
->
tx_ack
)
);
rt_
completion_done
(
&
msg
->
ack
);
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录