cpu: native: netdev2_tap: make use of netdev2_eth module
This commit is contained in:
parent
fa711ceb8d
commit
14a54bddce
@ -33,6 +33,7 @@ endif
|
|||||||
|
|
||||||
ifneq (,$(filter netdev2_tap,$(USEMODULE)))
|
ifneq (,$(filter netdev2_tap,$(USEMODULE)))
|
||||||
USEMODULE += netif
|
USEMODULE += netif
|
||||||
|
USEMODULE += netdev2_eth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter gnrc_zep,$(USEMODULE)))
|
ifneq (,$(filter gnrc_zep,$(USEMODULE)))
|
||||||
|
|||||||
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#include "net/eui64.h"
|
#include "net/eui64.h"
|
||||||
#include "net/netdev2.h"
|
#include "net/netdev2.h"
|
||||||
|
#include "net/netdev2_eth.h"
|
||||||
#include "net/ethernet.h"
|
#include "net/ethernet.h"
|
||||||
#include "net/ethernet/hdr.h"
|
#include "net/ethernet/hdr.h"
|
||||||
#include "netdev2_tap.h"
|
#include "netdev2_tap.h"
|
||||||
@ -97,18 +98,6 @@ static inline int _set_promiscous(netdev2_t *netdev, int value)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int _get_iid(netdev2_t *netdev, eui64_t *value, size_t max_len)
|
|
||||||
{
|
|
||||||
if (max_len < sizeof(eui64_t)) {
|
|
||||||
return -EOVERFLOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t addr[ETHERNET_ADDR_LEN];
|
|
||||||
_get_mac_addr(netdev, addr);
|
|
||||||
ethernet_get_iid(value, addr);
|
|
||||||
|
|
||||||
return sizeof(eui64_t);
|
|
||||||
}
|
|
||||||
static inline void _isr(netdev2_t *netdev)
|
static inline void _isr(netdev2_t *netdev)
|
||||||
{
|
{
|
||||||
if (netdev->event_callback) {
|
if (netdev->event_callback) {
|
||||||
@ -130,13 +119,6 @@ int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len)
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case NETOPT_DEVICE_TYPE:
|
|
||||||
{
|
|
||||||
uint16_t *tgt = (uint16_t *)value;
|
|
||||||
*tgt = NETDEV2_TYPE_ETHERNET;
|
|
||||||
res = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case NETOPT_ADDRESS:
|
case NETOPT_ADDRESS:
|
||||||
if (max_len < ETHERNET_ADDR_LEN) {
|
if (max_len < ETHERNET_ADDR_LEN) {
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
@ -146,24 +128,12 @@ int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len)
|
|||||||
res = ETHERNET_ADDR_LEN;
|
res = ETHERNET_ADDR_LEN;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NETOPT_ADDR_LEN:
|
|
||||||
case NETOPT_SRC_LEN:
|
|
||||||
assert(max_len == 2);
|
|
||||||
uint16_t *tgt = (uint16_t*)value;
|
|
||||||
*tgt=6;
|
|
||||||
res = sizeof(uint16_t);
|
|
||||||
break;
|
|
||||||
case NETOPT_PROMISCUOUSMODE:
|
case NETOPT_PROMISCUOUSMODE:
|
||||||
*((bool*)value) = (bool)_get_promiscous(dev);
|
*((bool*)value) = (bool)_get_promiscous(dev);
|
||||||
res = sizeof(bool);
|
res = sizeof(bool);
|
||||||
break;
|
break;
|
||||||
case NETOPT_IPV6_IID:
|
|
||||||
return _get_iid(dev, value, max_len);
|
|
||||||
case NETOPT_IS_WIRED:
|
|
||||||
res = 1;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
res = -ENOTSUP;
|
res = netdev2_eth_get(dev, opt, value, max_len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user