提交 c5a93780 编写于 作者: F Fam Zheng 提交者: Stefan Hajnoczi

ne2000: Drop ne2000_can_receive

ne2000_receive already checks the same conditions and drops the packet
if it's not ready, removing the .can_receive callback avoids the
necessity to add explicit flushes when the conditions turn true (which
is required by the new semantics of .can_receive since 6e99c631
"net/socket: Drop net_socket_can_send").

Plus the "return 1" if E8390_STOP is also suspicious.
Signed-off-by: NFam Zheng <famz@redhat.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 2734a20b
...@@ -44,7 +44,6 @@ typedef struct ISANE2000State { ...@@ -44,7 +44,6 @@ typedef struct ISANE2000State {
static NetClientInfo net_ne2000_isa_info = { static NetClientInfo net_ne2000_isa_info = {
.type = NET_CLIENT_OPTIONS_KIND_NIC, .type = NET_CLIENT_OPTIONS_KIND_NIC,
.size = sizeof(NICState), .size = sizeof(NICState),
.can_receive = ne2000_can_receive,
.receive = ne2000_receive, .receive = ne2000_receive,
}; };
......
...@@ -165,15 +165,6 @@ static int ne2000_buffer_full(NE2000State *s) ...@@ -165,15 +165,6 @@ static int ne2000_buffer_full(NE2000State *s)
return 0; return 0;
} }
int ne2000_can_receive(NetClientState *nc)
{
NE2000State *s = qemu_get_nic_opaque(nc);
if (s->cmd & E8390_STOP)
return 1;
return !ne2000_buffer_full(s);
}
#define MIN_BUF_SIZE 60 #define MIN_BUF_SIZE 60
ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_) ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
...@@ -705,7 +696,6 @@ void ne2000_setup_io(NE2000State *s, DeviceState *dev, unsigned size) ...@@ -705,7 +696,6 @@ void ne2000_setup_io(NE2000State *s, DeviceState *dev, unsigned size)
static NetClientInfo net_ne2000_info = { static NetClientInfo net_ne2000_info = {
.type = NET_CLIENT_OPTIONS_KIND_NIC, .type = NET_CLIENT_OPTIONS_KIND_NIC,
.size = sizeof(NICState), .size = sizeof(NICState),
.can_receive = ne2000_can_receive,
.receive = ne2000_receive, .receive = ne2000_receive,
}; };
......
...@@ -34,7 +34,6 @@ typedef struct NE2000State { ...@@ -34,7 +34,6 @@ typedef struct NE2000State {
void ne2000_setup_io(NE2000State *s, DeviceState *dev, unsigned size); void ne2000_setup_io(NE2000State *s, DeviceState *dev, unsigned size);
extern const VMStateDescription vmstate_ne2000; extern const VMStateDescription vmstate_ne2000;
void ne2000_reset(NE2000State *s); void ne2000_reset(NE2000State *s);
int ne2000_can_receive(NetClientState *nc);
ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_); ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册