mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 14:37:50 +00:00
net: net_stat instrumented version of usb_drv
This commit is contained in:
parent
3ace475f2d
commit
901439211c
4
dde_linux/lib/mk/platform_arndale/usb-stat.mk
Normal file
4
dde_linux/lib/mk/platform_arndale/usb-stat.mk
Normal file
@ -0,0 +1,4 @@
|
||||
LIBS += net-stat
|
||||
CC_OPT += -DGENODE_NET_STAT
|
||||
|
||||
include $(REP_DIR)/lib/mk/platform_arndale/usb.mk
|
4
dde_linux/lib/mk/platform_panda/usb-stat.mk
Normal file
4
dde_linux/lib/mk/platform_panda/usb-stat.mk
Normal file
@ -0,0 +1,4 @@
|
||||
LIBS += net-stat
|
||||
CC_OPT += -DGENODE_NET_STAT
|
||||
|
||||
include $(REP_DIR)/lib/mk/platform_panda/usb.mk
|
12
dde_linux/src/drivers/usb_net_stat/main.cc
Normal file
12
dde_linux/src/drivers/usb_net_stat/main.cc
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* \brief Startup USB driver library
|
||||
* \author Sebastian Sumpf
|
||||
* \date 2013-02-20
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
extern void start_usb_driver();
|
||||
start_usb_driver();
|
||||
return 0;
|
||||
}
|
3
dde_linux/src/drivers/usb_net_stat/target.mk
Normal file
3
dde_linux/src/drivers/usb_net_stat/target.mk
Normal file
@ -0,0 +1,3 @@
|
||||
TARGET = usb_drv_net_stat
|
||||
SRC_CC = main.cc
|
||||
LIBS = usb-stat
|
@ -320,12 +320,21 @@ int register_netdev(struct net_device *ndev)
|
||||
int netif_running(const struct net_device *dev) { return dev->state & START; }
|
||||
int netif_device_present(struct net_device *dev) { return 1; }
|
||||
|
||||
#ifdef GENODE_NET_STAT
|
||||
#include <nic/stat.h>
|
||||
static Timer::Connection _timer;
|
||||
static Nic::Measurement _stat(_timer);
|
||||
#endif
|
||||
|
||||
int netif_rx(struct sk_buff *skb)
|
||||
{
|
||||
if (_nic && _nic->session()) {
|
||||
_nic->rx(skb);
|
||||
}
|
||||
#ifdef GENODE_NET_STAT
|
||||
else if (_nic)
|
||||
_stat.data(new (skb->data) Net::Ethernet_frame(skb->len), skb->len);
|
||||
#endif
|
||||
|
||||
dev_kfree_skb(skb);
|
||||
return NET_RX_SUCCESS;
|
||||
@ -621,5 +630,9 @@ void random_ether_addr(u8 *addr)
|
||||
Genode::memcpy(addr, mac.addr, ETH_ALEN);
|
||||
snprint_mac(str, mac.addr);
|
||||
PINF("Using configured mac: %s", str);
|
||||
|
||||
#ifdef GENODE_NET_STAT
|
||||
_stat.set_mac(mac.addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user