From 8a6d48c0542876eb3acfc0970c0ab7872db08d5f Mon Sep 17 00:00:00 2001 From: Zheng Da Date: Sun, 6 Dec 2009 05:26:23 +0100 Subject: check in the original version of dde linux26. --- libdde_linux26/lib/src/arch/l4/kmalloc.c | 199 +++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 libdde_linux26/lib/src/arch/l4/kmalloc.c (limited to 'libdde_linux26/lib/src/arch/l4/kmalloc.c') diff --git a/libdde_linux26/lib/src/arch/l4/kmalloc.c b/libdde_linux26/lib/src/arch/l4/kmalloc.c new file mode 100644 index 00000000..065c13c7 --- /dev/null +++ b/libdde_linux26/lib/src/arch/l4/kmalloc.c @@ -0,0 +1,199 @@ +/* + * \brief kmalloc() implementation + * \author Christian Helmuth + * \date 2007-01-24 + * + * In Linux 2.6 this resides in mm/slab.c. + * + * This implementation of kmalloc() stays with Linux's and uses kmem_caches for + * some power of two bytes. For larger allocations ddedkit_large_malloc() is + * used. This way, we optimize for speed and potentially waste memory + * resources. + */ + +/* Linux */ +#include +#include +#include +#include +#include +#include +#include + +/* DDEKit */ +#include +#include + +#include + +/* dummy */ +int forbid_dac; + +/* This stuff is needed by some drivers, e.g. for ethtool. + * XXX: This is a fake, implement it if you really need ethtool stuff. + */ +struct page* mem_map = NULL; +static bootmem_data_t contig_bootmem_data; +struct pglist_data contig_page_data = { .bdata = &contig_bootmem_data }; + +int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, + unsigned long pfn, unsigned long size, pgprot_t prot) +{ + return 0; +} +EXPORT_SYMBOL(remap_pfn_range); + +/******************* + ** Configuration ** + *******************/ + +#define DEBUG_MALLOC 0 + +/******************** + ** Implementation ** + ********************/ + +/* + * These are the default caches for kmalloc. Custom caches can have other sizes. + */ +static struct cache_sizes malloc_sizes[] = { +#define CACHE(x) { .cs_size = (x) }, +#include + CACHE(ULONG_MAX) +#undef CACHE +}; + + +/* + * kmalloc() cache names + */ +static const char *malloc_names[] = { +#define CACHE(x) "size-" #x, +#include + NULL +#undef CACHE +}; + + +/** + * Find kmalloc() cache for size + */ +static struct kmem_cache *find_cache(size_t size) +{ + struct cache_sizes *sizes; + + for (sizes = malloc_sizes; size > sizes->cs_size; ++sizes) ; + + return sizes->cs_cachep; +} + + +/** + * Free previously allocated memory + * @objp: pointer returned by kmalloc. + * + * If @objp is NULL, no operation is performed. + * + * Don't free memory not originally allocated by kmalloc() + * or you will run into trouble. + */ +void kfree(const void *objp) +{ + if (!objp) return; + + /* find cache back-pointer */ + void **p = (void **)objp - 1; + + ddekit_log(DEBUG_MALLOC, "objp=%p cache=%p (%d)", + p, *p, *p ? kmem_cache_size(*p) : 0); + + if (*p) + /* free from cache */ + kmem_cache_free(*p, p); + else + /* no cache for this size - use ddekit free */ + ddekit_large_free(p); +} + + +/** + * Allocate memory + * @size: how many bytes of memory are required. + * @flags: the type of memory to allocate. + * + * kmalloc is the normal method of allocating memory + * in the kernel. + */ +void *__kmalloc(size_t size, gfp_t flags) +{ + /* add space for back-pointer */ + size += sizeof(void *); + + /* find appropriate cache */ + struct kmem_cache *cache = find_cache(size); + + void **p; + if (cache) + /* allocate from cache */ + p = kmem_cache_alloc(cache, flags); + else + /* no cache for this size - use ddekit malloc */ + p = ddekit_large_malloc(size); + + ddekit_log(DEBUG_MALLOC, "size=%d, cache=%p (%d) => %p", + size, cache, cache ? kmem_cache_size(cache) : 0, p); + + /* return pointer to actual chunk */ + if (p) { + *p = cache; + p++; + } + return p; +} + + +size_t ksize(const void *p) +{ + struct kmem_cache *cache = (struct kmem_cache *)*((void**)p - 1); + if (cache) + return kmem_cache_size(cache); + return -1; +} + + +void *dma_alloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t flag) +{ + void *ret = (void *)__get_free_pages(flag, get_order(size)); + + if (ret != NULL) { + memset(ret, 0, size); + *dma_handle = virt_to_bus(ret); + } + return ret; +} + + +void dma_free_coherent(struct device *dev, size_t size, + void *vaddr, dma_addr_t dma_handle) +{ + free_pages((unsigned long)vaddr, get_order(size)); +} + + +/******************** + ** Initialization ** + ********************/ + +/** + * dde_linux kmalloc initialization + */ +void l4dde26_kmalloc_init(void) +{ + struct cache_sizes *sizes = malloc_sizes; + const char **names = malloc_names; + + /* init malloc sizes array */ + for (; sizes->cs_size != ULONG_MAX; ++sizes, ++names) + sizes->cs_cachep = kmem_cache_create(*names, sizes->cs_size, 0, 0, 0); +} -- cgit v1.2.3 From 16b4a9b6e25500f2da14839b4494f82df4b0fc7f Mon Sep 17 00:00:00 2001 From: Zheng Da Date: Tue, 5 Jan 2010 16:30:03 +0100 Subject: correct the path of header files. --- libdde_linux26/lib/src/arch/l4/irq.c | 4 ---- libdde_linux26/lib/src/arch/l4/kmalloc.c | 6 ++---- libdde_linux26/lib/src/arch/l4/kmem_cache.c | 4 +--- libdde_linux26/lib/src/arch/l4/mm-helper.c | 5 ----- libdde_linux26/lib/src/arch/l4/net.c | 2 +- libdde_linux26/lib/src/arch/l4/page_alloc.c | 5 ----- libdde_linux26/lib/src/arch/l4/process.c | 4 ++-- libdde_linux26/lib/src/arch/l4/vmalloc.c | 4 +--- libdde_linux26/lib/src/net/core/dev.c | 2 +- 9 files changed, 8 insertions(+), 28 deletions(-) (limited to 'libdde_linux26/lib/src/arch/l4/kmalloc.c') diff --git a/libdde_linux26/lib/src/arch/l4/irq.c b/libdde_linux26/lib/src/arch/l4/irq.c index 0e565e54..9594b05c 100644 --- a/libdde_linux26/lib/src/arch/l4/irq.c +++ b/libdde_linux26/lib/src/arch/l4/irq.c @@ -12,10 +12,6 @@ #include #include /* memset() */ -/* DDEKit */ -#include -#include - /* local */ #include "dde26.h" #include "local.h" diff --git a/libdde_linux26/lib/src/arch/l4/kmalloc.c b/libdde_linux26/lib/src/arch/l4/kmalloc.c index 065c13c7..87d64878 100644 --- a/libdde_linux26/lib/src/arch/l4/kmalloc.c +++ b/libdde_linux26/lib/src/arch/l4/kmalloc.c @@ -20,11 +20,9 @@ #include #include -/* DDEKit */ -#include -#include +#include "local.h" -#include +#include /* dummy */ int forbid_dac; diff --git a/libdde_linux26/lib/src/arch/l4/kmem_cache.c b/libdde_linux26/lib/src/arch/l4/kmem_cache.c index 1465ac6c..5e44c140 100644 --- a/libdde_linux26/lib/src/arch/l4/kmem_cache.c +++ b/libdde_linux26/lib/src/arch/l4/kmem_cache.c @@ -14,9 +14,7 @@ /* Linux */ #include -/* DDEKit */ -#include -#include +#include "local.h" /******************* diff --git a/libdde_linux26/lib/src/arch/l4/mm-helper.c b/libdde_linux26/lib/src/arch/l4/mm-helper.c index 68c0213b..cc4cc1d1 100644 --- a/libdde_linux26/lib/src/arch/l4/mm-helper.c +++ b/libdde_linux26/lib/src/arch/l4/mm-helper.c @@ -3,11 +3,6 @@ #include #include -/* DDEKit */ -#include -#include -#include - #include "local.h" int ioprio_best(unsigned short aprio, unsigned short bprio) diff --git a/libdde_linux26/lib/src/arch/l4/net.c b/libdde_linux26/lib/src/arch/l4/net.c index d6637d96..6e799119 100644 --- a/libdde_linux26/lib/src/arch/l4/net.c +++ b/libdde_linux26/lib/src/arch/l4/net.c @@ -8,7 +8,7 @@ * GNU General Public License 2. Please see the COPYING file for details. * ******************************************************************************/ -#include +#include #include #include diff --git a/libdde_linux26/lib/src/arch/l4/page_alloc.c b/libdde_linux26/lib/src/arch/l4/page_alloc.c index 0a2e3fdf..e887bd51 100644 --- a/libdde_linux26/lib/src/arch/l4/page_alloc.c +++ b/libdde_linux26/lib/src/arch/l4/page_alloc.c @@ -25,11 +25,6 @@ #include #include -/* DDEKit */ -#include -#include -#include - #include "local.h" unsigned long max_low_pfn; diff --git a/libdde_linux26/lib/src/arch/l4/process.c b/libdde_linux26/lib/src/arch/l4/process.c index 5fe43b32..b5189cd4 100644 --- a/libdde_linux26/lib/src/arch/l4/process.c +++ b/libdde_linux26/lib/src/arch/l4/process.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include diff --git a/libdde_linux26/lib/src/arch/l4/vmalloc.c b/libdde_linux26/lib/src/arch/l4/vmalloc.c index 134b80c3..4fa063f0 100644 --- a/libdde_linux26/lib/src/arch/l4/vmalloc.c +++ b/libdde_linux26/lib/src/arch/l4/vmalloc.c @@ -15,9 +15,7 @@ /* Linux */ #include -/* DDEKit */ -#include -#include +#include "local.h" void *vmalloc(unsigned long size) { diff --git a/libdde_linux26/lib/src/net/core/dev.c b/libdde_linux26/lib/src/net/core/dev.c index 22fdf4d7..1e9247c2 100644 --- a/libdde_linux26/lib/src/net/core/dev.c +++ b/libdde_linux26/lib/src/net/core/dev.c @@ -74,7 +74,7 @@ #ifdef DDE_LINUX #include "local.h" -#include +#include #endif #include -- cgit v1.2.3 From 7a7787bfb9c776da1a2597f5f723846d004de78d Mon Sep 17 00:00:00 2001 From: Zheng Da Date: Tue, 6 Apr 2010 04:24:31 +0200 Subject: set memory allocated by ddekit_large_malloc to zero --- libdde_linux26/lib/src/arch/l4/kmalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libdde_linux26/lib/src/arch/l4/kmalloc.c') diff --git a/libdde_linux26/lib/src/arch/l4/kmalloc.c b/libdde_linux26/lib/src/arch/l4/kmalloc.c index 87d64878..0e94fb97 100644 --- a/libdde_linux26/lib/src/arch/l4/kmalloc.c +++ b/libdde_linux26/lib/src/arch/l4/kmalloc.c @@ -134,9 +134,12 @@ void *__kmalloc(size_t size, gfp_t flags) if (cache) /* allocate from cache */ p = kmem_cache_alloc(cache, flags); - else + else { /* no cache for this size - use ddekit malloc */ p = ddekit_large_malloc(size); + if (flags & __GFP_ZERO) + memset (p, 0, size); + } ddekit_log(DEBUG_MALLOC, "size=%d, cache=%p (%d) => %p", size, cache, cache ? kmem_cache_size(cache) : 0, p); -- cgit v1.2.3 From 045fb6a578e0e4d97f0e581bbf514654686a86c1 Mon Sep 17 00:00:00 2001 From: Zheng Da Date: Tue, 4 May 2010 15:56:46 +0200 Subject: Add printing. --- dde_e1000/e1000_hw.c | 3 +++ dde_e1000/e1000_main.c | 33 ++++++++++++++++++++++++++++++-- libdde_linux26/lib/src/arch/l4/kmalloc.c | 11 ++++++++++- libdde_linux26/lib/src/arch/l4/res.c | 8 ++++++++ libdde_linux26/lib/src/net/core/skbuff.c | 9 +++++++-- libmachdev/net.c | 17 ++++++++++++---- 6 files changed, 72 insertions(+), 9 deletions(-) (limited to 'libdde_linux26/lib/src/arch/l4/kmalloc.c') diff --git a/dde_e1000/e1000_hw.c b/dde_e1000/e1000_hw.c index e1a3fc13..27ed37d4 100644 --- a/dde_e1000/e1000_hw.c +++ b/dde_e1000/e1000_hw.c @@ -5627,6 +5627,7 @@ s32 e1000_read_mac_addr(struct e1000_hw *hw) DEBUGFUNC("e1000_read_mac_addr"); + printk("mac address: "); for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) { offset = i >> 1; if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { @@ -5635,7 +5636,9 @@ s32 e1000_read_mac_addr(struct e1000_hw *hw) } hw->perm_mac_addr[i] = (u8)(eeprom_data & 0x00FF); hw->perm_mac_addr[i+1] = (u8)(eeprom_data >> 8); + printk("%x%x ", hw->perm_mac_addr[i], hw->perm_mac_addr[i+1]); } + printk("\n"); switch (hw->mac_type) { default: diff --git a/dde_e1000/e1000_main.c b/dde_e1000/e1000_main.c index f25a5367..3f608476 100644 --- a/dde_e1000/e1000_main.c +++ b/dde_e1000/e1000_main.c @@ -328,13 +328,15 @@ static void e1000_update_mng_vlan(struct e1000_adapter *adapter) E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) { e1000_vlan_rx_add_vid(netdev, vid); adapter->mng_vlan_id = vid; - } else + } else { adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; + } if ((old_vid != (u16)E1000_MNG_VLAN_NONE) && (vid != old_vid) && - !vlan_group_get_device(adapter->vlgrp, old_vid)) + !vlan_group_get_device(adapter->vlgrp, old_vid)) { e1000_vlan_rx_kill_vid(netdev, old_vid); + } } else adapter->mng_vlan_id = vid; } @@ -937,7 +939,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev, /* do not allocate ioport bars when not needed */ need_ioport = e1000_is_need_ioport(pdev); + printk("do we need ioport? %d\n", need_ioport); if (need_ioport) { + printk("pci_enable_device will be called\n"); bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); err = pci_enable_device(pdev); } else { @@ -947,6 +951,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, if (err) return err; + printk("bars: %x\n", bars); if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK) && !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) { pci_using_dac = 1; @@ -998,6 +1003,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, continue; if (pci_resource_flags(pdev, i) & IORESOURCE_IO) { hw->io_base = pci_resource_start(pdev, i); + printk("io base: %p, i: %d\n", + hw->io_base, i); break; } } @@ -1084,6 +1091,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, */ memset(hw->mac_addr, 0, netdev->addr_len); } else { + printk("succeed to validate eeprom\n"); /* copy the MAC address out of the EEPROM */ if (e1000_read_mac_addr(hw)) DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); @@ -1585,6 +1593,8 @@ static int e1000_setup_tx_resources(struct e1000_adapter *adapter, txdr->size = ALIGN(txdr->size, 4096); txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); + printk("allocate %d bytes for transmit desc ring: %p\n", + txdr->size, txdr->desc); if (!txdr->desc) { setup_tx_desc_die: vfree(txdr->buffer_info); @@ -1804,6 +1814,7 @@ static int e1000_setup_rx_resources(struct e1000_adapter *adapter, rxdr->size = rxdr->count * desc_len; rxdr->size = ALIGN(rxdr->size, 4096); + printk("we allocate %d descriptors for rx\n", rxdr->count); rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); if (!rxdr->desc) { @@ -3194,6 +3205,7 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) int tso; unsigned int f; + printk("try to send a packet\n"); /* This goes back to the question of how to logically map a tx queue * to a flow. Right now, performance is impacted slightly negatively * if using multiple tx queues. If the stack breaks away from a @@ -3671,6 +3683,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) struct e1000_hw *hw = &adapter->hw; u32 icr = er32(ICR); + printk("e1000_intr_msi is called\n"); /* in NAPI mode read ICR disables interrupts using IAM */ if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { @@ -3717,6 +3730,7 @@ static irqreturn_t e1000_intr(int irq, void *data) if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags))) return IRQ_NONE; /* Not our interrupt */ + printk("e1000 gets an interrupt\n"); /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is * not set, then the adapter didn't send an interrupt */ if (unlikely(hw->mac_type >= e1000_82571 && @@ -3799,6 +3813,8 @@ static int e1000_clean(struct napi_struct *napi, int budget) e1000_irq_enable(adapter); } + printk("e1000_clean: budget: %d, work_done: %d, tx_cleaned: %d\n", + budget, work_done, tx_cleaned); return work_done; } @@ -3823,6 +3839,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, eop_desc = E1000_TX_DESC(*tx_ring, eop); while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { + printk("e1000_clean_tx_irq: check desc %d\n", eop); for (cleaned = false; !cleaned; ) { tx_desc = E1000_TX_DESC(*tx_ring, i); buffer_info = &tx_ring->buffer_info[i]; @@ -4090,6 +4107,8 @@ next_desc: /* return some buffers to hardware, one at a time is too slow */ if (unlikely(cleaned_count >= E1000_RX_BUFFER_WRITE)) { + printk("cleaned_count in the loop: %d\n", + cleaned_count); adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count); cleaned_count = 0; } @@ -4129,6 +4148,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, unsigned int i; unsigned int bufsz = adapter->rx_buffer_len + NET_IP_ALIGN; + printk("e1000_alloc_rx_buffers is called\n"); i = rx_ring->next_to_use; buffer_info = &rx_ring->buffer_info[i]; @@ -4143,6 +4163,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, if (unlikely(!skb)) { /* Better luck next round */ adapter->alloc_rx_buff_failed++; + printk("check point 1\n"); break; } @@ -4156,6 +4177,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, /* Failed allocation, critical failure */ if (!skb) { dev_kfree_skb(oldskb); + printk("check point 2\n"); break; } @@ -4163,6 +4185,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, /* give up */ dev_kfree_skb(skb); dev_kfree_skb(oldskb); + printk("check point 3\n"); break; /* while !buffer_info->skb */ } @@ -4198,6 +4221,7 @@ map_skb: adapter->rx_buffer_len, PCI_DMA_FROMDEVICE); + printk("check point 4\n"); break; /* while !buffer_info->skb */ } rx_desc = E1000_RX_DESC(*rx_ring, i); @@ -4208,7 +4232,10 @@ map_skb: buffer_info = &rx_ring->buffer_info[i]; } + printk("cleaned_count: %d\n", cleaned_count); if (likely(rx_ring->next_to_use != i)) { + printk("old rx_ring next_to_use: %d, new one: %d\n", + rx_ring->next_to_use, i); rx_ring->next_to_use = i; if (unlikely(i-- == 0)) i = (rx_ring->count - 1); @@ -4452,6 +4479,8 @@ static void e1000_vlan_rx_register(struct net_device *netdev, struct e1000_hw *hw = &adapter->hw; u32 ctrl, rctl; + printk ("********e1000_vlan_rx_register. grp: %p\n", grp); + if (!test_bit(__E1000_DOWN, &adapter->flags)) e1000_irq_disable(adapter); adapter->vlgrp = grp; diff --git a/libdde_linux26/lib/src/arch/l4/kmalloc.c b/libdde_linux26/lib/src/arch/l4/kmalloc.c index 0e94fb97..816f443c 100644 --- a/libdde_linux26/lib/src/arch/l4/kmalloc.c +++ b/libdde_linux26/lib/src/arch/l4/kmalloc.c @@ -131,14 +131,23 @@ void *__kmalloc(size_t size, gfp_t flags) struct kmem_cache *cache = find_cache(size); void **p; - if (cache) + if (cache) { /* allocate from cache */ p = kmem_cache_alloc(cache, flags); + if (!p) { + printk("__kmalloc: kmem_cache_alloc %s fails\n", + ((char **)cache)[0]); + } + } else { /* no cache for this size - use ddekit malloc */ p = ddekit_large_malloc(size); if (flags & __GFP_ZERO) memset (p, 0, size); + if (!p) { + printk("__kmalloc: ddekit_large_malloc %d fails\n", + size); + } } ddekit_log(DEBUG_MALLOC, "size=%d, cache=%p (%d) => %p", diff --git a/libdde_linux26/lib/src/arch/l4/res.c b/libdde_linux26/lib/src/arch/l4/res.c index fbd2d09b..a2ffb98f 100644 --- a/libdde_linux26/lib/src/arch/l4/res.c +++ b/libdde_linux26/lib/src/arch/l4/res.c @@ -99,8 +99,12 @@ struct resource * __request_region(struct resource *parent, switch (parent->flags) { case IORESOURCE_IO: + printk("IO: name: %s, start: %x, len: %d\n", + name, start, n); return l4dde26_request_region(start, n, name); case IORESOURCE_MEM: + printk("MEM: name: %s, start: %x, len: %d\n", + name, start, n); return l4dde26_request_mem_region(start, n, name); } @@ -161,7 +165,11 @@ void __iomem * ioremap(unsigned long phys_addr, unsigned long size) struct dde_mem_region *mreg = list_entry(pos, struct dde_mem_region, list); if (mreg->pa <= phys_addr && mreg->pa + mreg->size >= phys_addr + size) + { + printk ("ioremap: phys: %x <-> virt: %x\n", phys_addr, + (mreg->va + (phys_addr - mreg->pa))); return (void *)(mreg->va + (phys_addr - mreg->pa)); + } } return NULL; diff --git a/libdde_linux26/lib/src/net/core/skbuff.c b/libdde_linux26/lib/src/net/core/skbuff.c index 2f65e534..40d64a88 100644 --- a/libdde_linux26/lib/src/net/core/skbuff.c +++ b/libdde_linux26/lib/src/net/core/skbuff.c @@ -180,14 +180,19 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, /* Get the HEAD */ skb = kmem_cache_alloc_node(cache, gfp_mask & ~__GFP_DMA, node); - if (!skb) + if (!skb) { + printk("kmem_cache_alloc_node fails\n"); goto out; + } size = SKB_DATA_ALIGN(size); data = kmalloc_node_track_caller(size + sizeof(struct skb_shared_info), gfp_mask, node); - if (!data) + if (!data) { + printk("kmalloc_node_track_caller %d fails\n", + size + sizeof(struct skb_shared_info)); goto nodata; + } /* * Only clear those fields we need to clear, not those that we will diff --git a/libmachdev/net.c b/libmachdev/net.c index 9a367a6b..ca6bca63 100644 --- a/libmachdev/net.c +++ b/libmachdev/net.c @@ -122,7 +122,7 @@ struct net_data *nd_head; extern struct device_emulation_ops linux_net_emulation_ops; -static int print_packet_size = 0; +static int print_packet_size = 1; mach_msg_type_t header_type = { @@ -299,7 +299,10 @@ device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type, /* Search for the device. */ dev = search_netdev (name); if (!dev) - return D_NO_SUCH_DEVICE; + { + fprintf (stderr, "after search_netdev: cannot find %s\n", name); + return D_NO_SUCH_DEVICE; + } /* Allocate and initialize device data if this is the first open. */ nd = search_nd (dev); @@ -307,7 +310,10 @@ device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type, { err = create_device_port (sizeof (*nd), &nd); if (err) - goto out; + { + fprintf (stderr, "after create_device_port: cannot create a port\n"); + goto out; + } nd->dev = dev; nd->device.emul_data = nd; @@ -333,7 +339,10 @@ device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type, #endif if (dev_open(dev) < 0) - err = D_NO_SUCH_DEVICE; + { + fprintf (stderr, "after dev_open: cannot open the device\n"); + err = D_NO_SUCH_DEVICE; + } out: if (err) -- cgit v1.2.3