usb: Fix AX88179 receive CRC errors
Call 'set_multicast' and 'link_reset' during card startup. Increase TX skb buffer allocator. Ref #773
This commit is contained in:
parent
8cf893e8c6
commit
231d92f88a
|
@ -294,6 +294,8 @@ extern "C" void module_dwc3_exynos_driver_init();
|
||||||
extern "C" void module_dwc3_driver_init();
|
extern "C" void module_dwc3_driver_init();
|
||||||
extern "C" void module_xhci_hcd_init();
|
extern "C" void module_xhci_hcd_init();
|
||||||
|
|
||||||
|
extern "C" void module_asix_init();
|
||||||
|
|
||||||
|
|
||||||
void ehci_setup(Services *services)
|
void ehci_setup(Services *services)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#define SKIP_VERBOSE 0
|
#define SKIP_VERBOSE 0
|
||||||
|
|
||||||
#if VERBOSE_LX_EMUL
|
#if DEBUG_TRACE
|
||||||
#define TRACE dde_kit_printf("\033[32m%s\033[0m called, not implemented\n", __PRETTY_FUNCTION__)
|
#define TRACE dde_kit_printf("\033[32m%s\033[0m called, not implemented\n", __PRETTY_FUNCTION__)
|
||||||
#else
|
#else
|
||||||
#define TRACE
|
#define TRACE
|
||||||
|
@ -383,6 +383,7 @@ void device_remove_file(struct device *dev,
|
||||||
const struct device_attribute *attr) { TRACE; }
|
const struct device_attribute *attr) { TRACE; }
|
||||||
|
|
||||||
void put_device(struct device *dev) { TRACE; }
|
void put_device(struct device *dev) { TRACE; }
|
||||||
|
struct device *get_device(struct device *dev) { TRACE; return dev; }
|
||||||
|
|
||||||
void driver_unregister(struct device_driver *drv) { TRACE; }
|
void driver_unregister(struct device_driver *drv) { TRACE; }
|
||||||
int driver_attach(struct device_driver *drv) { TRACE; return 0; }
|
int driver_attach(struct device_driver *drv) { TRACE; return 0; }
|
||||||
|
@ -670,6 +671,8 @@ void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
|
||||||
enum dma_data_direction direction) { SKIP;; }
|
enum dma_data_direction direction) { SKIP;; }
|
||||||
|
|
||||||
int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { SKIP; return 0; }
|
int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) { SKIP; return 0; }
|
||||||
|
int dma_set_mask(struct device *dev, u64 mask) { TRACE; return 0; }
|
||||||
|
|
||||||
|
|
||||||
/*****************
|
/*****************
|
||||||
** linux/pid.h **
|
** linux/pid.h **
|
||||||
|
@ -890,9 +893,10 @@ void netif_tx_wake_all_queues(struct net_device *dev) { TRACE; }
|
||||||
void netif_device_attach(struct net_device *dev) { TRACE; }
|
void netif_device_attach(struct net_device *dev) { TRACE; }
|
||||||
void unregister_netdev(struct net_device *dev) { TRACE; }
|
void unregister_netdev(struct net_device *dev) { TRACE; }
|
||||||
void free_netdev(struct net_device *dev) { TRACE; }
|
void free_netdev(struct net_device *dev) { TRACE; }
|
||||||
void netif_carrier_off(struct net_device *dev) { TRACE; }
|
|
||||||
|
|
||||||
int netdev_mc_empty(struct net_device *dev) { TRACE; return 1; }
|
int netdev_mc_empty(struct net_device *dev) { TRACE; return 1; }
|
||||||
|
unsigned netdev_mc_count(struct net_device * dev) { TRACE; return 1; }
|
||||||
|
|
||||||
|
|
||||||
/*****************
|
/*****************
|
||||||
** linux/mii.h **
|
** linux/mii.h **
|
||||||
|
|
|
@ -32,32 +32,18 @@ extern "C" {
|
||||||
#include <dde_kit/resources.h>
|
#include <dde_kit/resources.h>
|
||||||
|
|
||||||
|
|
||||||
#define VERBOSE_LX_EMUL 0
|
|
||||||
|
|
||||||
|
|
||||||
#if VERBOSE_LX_EMUL
|
|
||||||
#define DEBUG_COMPLETION 0
|
#define DEBUG_COMPLETION 0
|
||||||
#define DEBUG_DMA 0
|
#define DEBUG_DMA 0
|
||||||
#define DEBUG_DRIVER 1
|
|
||||||
#define DEBUG_IRQ 1
|
|
||||||
#define DEBUG_KREF 0
|
|
||||||
#define DEBUG_PCI 0
|
|
||||||
#define DEBUG_SKB 0
|
|
||||||
#define DEBUG_SLAB 0
|
|
||||||
#define DEBUG_TIMER 0
|
|
||||||
#define DEBUG_THREAD 0
|
|
||||||
#else
|
|
||||||
#define DEBUG_COMPLETION 0
|
|
||||||
#define DEBUG_DRIVER 0
|
#define DEBUG_DRIVER 0
|
||||||
#define DEBUG_DMA 0
|
|
||||||
#define DEBUG_IRQ 0
|
#define DEBUG_IRQ 0
|
||||||
#define DEBUG_KREF 0
|
#define DEBUG_KREF 0
|
||||||
|
#define DEBUG_PRINTK 0
|
||||||
#define DEBUG_PCI 0
|
#define DEBUG_PCI 0
|
||||||
#define DEBUG_SKB 0
|
#define DEBUG_SKB 0
|
||||||
#define DEBUG_SLAB 0
|
#define DEBUG_SLAB 0
|
||||||
#define DEBUG_TIMER 0
|
#define DEBUG_TIMER 0
|
||||||
#define DEBUG_THREAD 0
|
#define DEBUG_THREAD 0
|
||||||
#endif
|
#define DEBUG_TRACE 0
|
||||||
|
|
||||||
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
||||||
#define LINUX_VERSION_CODE KERNEL_VERSION(3,9,0)
|
#define LINUX_VERSION_CODE KERNEL_VERSION(3,9,0)
|
||||||
|
@ -500,15 +486,15 @@ enum {
|
||||||
/*
|
/*
|
||||||
* Debug macros
|
* Debug macros
|
||||||
*/
|
*/
|
||||||
#if VERBOSE_LX_EMUL
|
#if DEBUG_PRINTK
|
||||||
#define printk dde_kit_printf
|
#define printk dde_kit_printf
|
||||||
#define vprintk dde_kit_vprintf
|
#define vprintk dde_kit_vprintf
|
||||||
#define panic dde_kit_panic
|
#define panic dde_kit_panic
|
||||||
#else /* VERBOSE_LX_EMUL */
|
#else
|
||||||
#define printk(...)
|
#define printk(...)
|
||||||
#define vprintk(...)
|
#define vprintk(...)
|
||||||
#define panic(...)
|
#define panic(...)
|
||||||
#endif /* VERBOSE_LX_EMUL */
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bits and types
|
* Bits and types
|
||||||
|
@ -1439,7 +1425,7 @@ bool device_can_wakeup(struct device *dev);
|
||||||
#define dev_err( dev, format, arg...) dde_kit_printf("dev_error: " format, ## arg)
|
#define dev_err( dev, format, arg...) dde_kit_printf("dev_error: " format, ## arg)
|
||||||
#define dev_notice(dev, format, arg...) dde_kit_printf("dev_notice: " format, ## arg)
|
#define dev_notice(dev, format, arg...) dde_kit_printf("dev_notice: " format, ## arg)
|
||||||
|
|
||||||
#if VERBOSE_LX_EMUL
|
#if DEBUG_PRINTK
|
||||||
#define dev_dbg(dev, format, arg...) dde_kit_printf("dev_dbg: " format, ## arg)
|
#define dev_dbg(dev, format, arg...) dde_kit_printf("dev_dbg: " format, ## arg)
|
||||||
#else
|
#else
|
||||||
#define dev_dbg( dev, format, arg...)
|
#define dev_dbg( dev, format, arg...)
|
||||||
|
@ -3148,7 +3134,7 @@ int ethtool_op_get_ts_info(struct net_device *, struct ethtool_ts_info *);
|
||||||
|
|
||||||
#define netdev_for_each_mc_addr(a, b) if (0)
|
#define netdev_for_each_mc_addr(a, b) if (0)
|
||||||
|
|
||||||
#if VERBOSE_LX_EMUL
|
#if DEBUG_PRINTK
|
||||||
#define netif_dbg(priv, type, dev, fmt, args...) dde_kit_printf("netif_dbg: " fmt, ## args)
|
#define netif_dbg(priv, type, dev, fmt, args...) dde_kit_printf("netif_dbg: " fmt, ## args)
|
||||||
#define netdev_dbg(dev, fmt, args...) dde_kit_printf("netdev_dbg: " fmt, ##args)
|
#define netdev_dbg(dev, fmt, args...) dde_kit_printf("netdev_dbg: " fmt, ##args)
|
||||||
#else
|
#else
|
||||||
|
@ -3247,21 +3233,18 @@ enum netdev_state_t {
|
||||||
#define netif_msg_tx_err(p) ({ printk("netif_msg_tx_err called not implemented\n"); 0; })
|
#define netif_msg_tx_err(p) ({ printk("netif_msg_tx_err called not implemented\n"); 0; })
|
||||||
#define netif_msg_rx_err(p) ({ printk("netif_msg_rx_err called not implemented\n"); 0; })
|
#define netif_msg_rx_err(p) ({ printk("netif_msg_rx_err called not implemented\n"); 0; })
|
||||||
#define netif_msg_tx_queued(p) ({ printk("netif_msg_tx_queued called not implemented\n"); 0; })
|
#define netif_msg_tx_queued(p) ({ printk("netif_msg_tx_queued called not implemented\n"); 0; })
|
||||||
static inline int netif_carrier_ok(const struct net_device *dev) {
|
|
||||||
return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
|
|
||||||
}
|
|
||||||
#define netif_carrier_on(p) ({ printk("netif_carrier_on called not implemented\n"); 0; })
|
|
||||||
static inline unsigned netdev_mc_count(struct net_device * dev) {
|
|
||||||
printk("netdev_mc_count called not implemented\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 netif_msg_init(int, int);
|
u32 netif_msg_init(int, int);
|
||||||
|
|
||||||
static inline void *netdev_priv(const struct net_device *dev) { return dev->priv; }
|
static inline void *netdev_priv(const struct net_device *dev) { return dev->priv; }
|
||||||
|
|
||||||
int netif_running(const struct net_device *);
|
int netif_running(const struct net_device *);
|
||||||
|
int netif_carrier_ok(const struct net_device *dev);
|
||||||
int netif_device_present(struct net_device *);
|
int netif_device_present(struct net_device *);
|
||||||
|
|
||||||
|
void netif_carrier_on(struct net_device *dev);
|
||||||
|
void netif_carrier_off(struct net_device *dev);
|
||||||
|
|
||||||
void netif_device_detach(struct net_device *);
|
void netif_device_detach(struct net_device *);
|
||||||
void netif_start_queue(struct net_device *);
|
void netif_start_queue(struct net_device *);
|
||||||
void netif_stop_queue(struct net_device *);
|
void netif_stop_queue(struct net_device *);
|
||||||
|
@ -3271,9 +3254,9 @@ void unregister_netdev(struct net_device *);
|
||||||
void free_netdev(struct net_device *);
|
void free_netdev(struct net_device *);
|
||||||
int netif_rx(struct sk_buff *);
|
int netif_rx(struct sk_buff *);
|
||||||
void netif_tx_wake_all_queues(struct net_device *);
|
void netif_tx_wake_all_queues(struct net_device *);
|
||||||
void netif_carrier_off(struct net_device *);
|
|
||||||
|
|
||||||
int netdev_mc_empty(struct net_device *);
|
int netdev_mc_empty(struct net_device *);
|
||||||
|
unsigned netdev_mc_count(struct net_device * dev);
|
||||||
int register_netdev(struct net_device *);
|
int register_netdev(struct net_device *);
|
||||||
|
|
||||||
/*****************
|
/*****************
|
||||||
|
|
|
@ -36,12 +36,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if VERBOSE_LX_EMUL
|
|
||||||
#define TRACE dde_kit_printf("\033[35m%s\033[0m called\n", __PRETTY_FUNCTION__)
|
|
||||||
#else
|
|
||||||
#define TRACE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
class Slab_backend_alloc;
|
class Slab_backend_alloc;
|
||||||
class Slab_alloc;
|
class Slab_alloc;
|
||||||
|
@ -56,7 +50,7 @@ class Genode::Slab_backend_alloc : public Genode::Allocator,
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VM_SIZE = 10 * 1024 * 1024, /* size of VM region to reserve */
|
VM_SIZE = 24 * 1024 * 1024, /* size of VM region to reserve */
|
||||||
BLOCK_SIZE = 1024 * 1024, /* 1 MB */
|
BLOCK_SIZE = 1024 * 1024, /* 1 MB */
|
||||||
ELEMENTS = VM_SIZE / BLOCK_SIZE, /* MAX number of dataspaces in VM */
|
ELEMENTS = VM_SIZE / BLOCK_SIZE, /* MAX number of dataspaces in VM */
|
||||||
};
|
};
|
||||||
|
@ -787,7 +781,6 @@ int dev_set_drvdata(struct device *dev, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct device *get_device(struct device *dev) { TRACE; return dev; }
|
|
||||||
const char *dev_name(const struct device *dev) { return dev->name; }
|
const char *dev_name(const struct device *dev) { return dev->name; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -1011,7 +1004,6 @@ int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
|
||||||
int nents, enum dma_data_direction dir,
|
int nents, enum dma_data_direction dir,
|
||||||
struct dma_attrs *attrs) { return nents; }
|
struct dma_attrs *attrs) { return nents; }
|
||||||
|
|
||||||
int dma_set_mask(struct device *dev, u64 mask) { TRACE; return 0; }
|
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
** linux/kthread.h **
|
** linux/kthread.h **
|
||||||
|
|
|
@ -32,7 +32,6 @@ extern "C" {
|
||||||
static Signal_helper *_signal = 0;
|
static Signal_helper *_signal = 0;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
START = 0x1, /* device flag */
|
|
||||||
HEAD_ROOM = 8, /* head room in skb in bytes */
|
HEAD_ROOM = 8, /* head room in skb in bytes */
|
||||||
MAC_LEN = 17, /* 12 number and 6 colons */
|
MAC_LEN = 17, /* 12 number and 6 colons */
|
||||||
};
|
};
|
||||||
|
@ -74,7 +73,7 @@ class Skb
|
||||||
Genode::memset(_free, 0xff, size * sizeof(_free[0]));
|
Genode::memset(_free, 0xff, size * sizeof(_free[0]));
|
||||||
|
|
||||||
for (unsigned i = 0; i < _entries; i++)
|
for (unsigned i = 0; i < _entries; i++)
|
||||||
_buf[i].start = (unsigned char *)kmalloc(buffer_size, GFP_NOIO);
|
_buf[i].start = (unsigned char *)kmalloc(buffer_size + NET_IP_ALIGN, GFP_NOIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_buff *alloc()
|
sk_buff *alloc()
|
||||||
|
@ -166,7 +165,7 @@ class Nic_device : public Nic::Device
|
||||||
|
|
||||||
/* initialize skb allocators */
|
/* initialize skb allocators */
|
||||||
skb_rx(64, dev->rx_urb_size);
|
skb_rx(64, dev->rx_urb_size);
|
||||||
skb_tx(32, dev->rx_urb_size);
|
skb_tx(64, dev->rx_urb_size);
|
||||||
|
|
||||||
if (!burst()) return;
|
if (!burst()) return;
|
||||||
|
|
||||||
|
@ -294,6 +293,7 @@ int register_netdev(struct net_device *ndev)
|
||||||
{
|
{
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
static bool announce = false;
|
static bool announce = false;
|
||||||
|
int err = -ENODEV;
|
||||||
|
|
||||||
Nic_device *nic = Nic_device::add(ndev);
|
Nic_device *nic = Nic_device::add(ndev);
|
||||||
|
|
||||||
|
@ -305,21 +305,45 @@ int register_netdev(struct net_device *ndev)
|
||||||
|
|
||||||
announce = true;
|
announce = true;
|
||||||
|
|
||||||
ndev->state |= START;
|
ndev->state |= 1 << __LINK_STATE_START;
|
||||||
int err = ndev->netdev_ops->ndo_open(ndev);
|
netif_carrier_off(ndev);
|
||||||
|
|
||||||
|
if ((err = ndev->netdev_ops->ndo_open(ndev)))
|
||||||
|
return err;
|
||||||
|
|
||||||
|
if (ndev->netdev_ops->ndo_set_rx_mode)
|
||||||
|
ndev->netdev_ops->ndo_set_rx_mode(ndev);
|
||||||
|
|
||||||
_nic = nic;
|
_nic = nic;
|
||||||
env()->parent()->announce(ep_nic.manage(&root));
|
env()->parent()->announce(ep_nic.manage(&root));
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENODEV;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int netif_running(const struct net_device *dev) { return dev->state & START; }
|
int netif_running(const struct net_device *dev)
|
||||||
|
{
|
||||||
|
return dev->state & (1 << __LINK_STATE_START);
|
||||||
|
}
|
||||||
|
|
||||||
int netif_device_present(struct net_device *dev) { return 1; }
|
int netif_device_present(struct net_device *dev) { return 1; }
|
||||||
|
|
||||||
|
int netif_carrier_ok(const struct net_device *dev)
|
||||||
|
{
|
||||||
|
return !(dev->state & (1 << __LINK_STATE_NOCARRIER));
|
||||||
|
}
|
||||||
|
|
||||||
|
void netif_carrier_on(struct net_device *dev)
|
||||||
|
{
|
||||||
|
dev->state &= ~(1 << __LINK_STATE_NOCARRIER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void netif_carrier_off(struct net_device *dev)
|
||||||
|
{
|
||||||
|
dev->state |= 1 << __LINK_STATE_NOCARRIER;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GENODE_NET_STAT
|
#ifdef GENODE_NET_STAT
|
||||||
#include <nic/stat.h>
|
#include <nic/stat.h>
|
||||||
static Timer::Connection _timer;
|
static Timer::Connection _timer;
|
||||||
|
@ -332,8 +356,13 @@ int netif_rx(struct sk_buff *skb)
|
||||||
_nic->rx(skb);
|
_nic->rx(skb);
|
||||||
}
|
}
|
||||||
#ifdef GENODE_NET_STAT
|
#ifdef GENODE_NET_STAT
|
||||||
else if (_nic)
|
else if (_nic) {
|
||||||
|
try {
|
||||||
_stat.data(new (skb->data) Net::Ethernet_frame(skb->len), skb->len);
|
_stat.data(new (skb->data) Net::Ethernet_frame(skb->len), skb->len);
|
||||||
|
} catch(Net::Ethernet_frame::No_ethernet_frame) {
|
||||||
|
PWRN("No ether frame");
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dev_kfree_skb(skb);
|
dev_kfree_skb(skb);
|
||||||
|
@ -370,7 +399,11 @@ struct sk_buff *alloc_skb(unsigned int size, gfp_t priority)
|
||||||
|
|
||||||
struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, unsigned int length)
|
struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, unsigned int length)
|
||||||
{
|
{
|
||||||
return _alloc_skb(length + NET_IP_ALIGN, false);
|
struct usbnet *d = (usbnet *)netdev_priv(dev);
|
||||||
|
struct sk_buff *s = _alloc_skb(length + NET_IP_ALIGN, false);
|
||||||
|
s->data += NET_IP_ALIGN;
|
||||||
|
s->tail += NET_IP_ALIGN;
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user