* [PATCH 1/5] net: use net_alloc_packet to allocate packet
@ 2012-03-02 18:20 Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 2/5] net: introduce net_free_packet to free the packet Jean-Christophe PLAGNIOL-VILLARD
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-02 18:20 UTC (permalink / raw)
To: barebox
Was missing in net_init and net_new.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
net/net.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/net.c b/net/net.c
index 2752884..cbcac40 100644
--- a/net/net.c
+++ b/net/net.c
@@ -370,7 +370,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler,
return ERR_PTR(-ENETDOWN);
con = xzalloc(sizeof(*con));
- con->packet = xmemalign(32, PKTSIZE);
+ con->packet = net_alloc_packet();
con->priv = ctx;
memset(con->packet, 0, PKTSIZE);
@@ -665,7 +665,7 @@ static int net_init(void)
int i;
for (i = 0; i < PKTBUFSRX; i++)
- NetRxPackets[i] = xmemalign(32, PKTSIZE);
+ NetRxPackets[i] = net_alloc_packet();
return 0;
}
--
1.7.7
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/5] net: introduce net_free_packet to free the packet
2012-03-02 18:20 [PATCH 1/5] net: use net_alloc_packet to allocate packet Jean-Christophe PLAGNIOL-VILLARD
@ 2012-03-02 18:20 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 3/5] net: allow the drivers to specify the tx buffer allocator Jean-Christophe PLAGNIOL-VILLARD
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-02 18:20 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
include/net.h | 5 +++++
net/net.c | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/net.h b/include/net.h
index d0f8341..c7da380 100644
--- a/include/net.h
+++ b/include/net.h
@@ -401,6 +401,11 @@ static inline char *net_alloc_packet(void)
return xmemalign(32, PKTSIZE);
}
+static inline void net_free_packet(void *packet)
+{
+ free(packet);
+}
+
struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport,
rx_handler_f *handler, void *ctx);
diff --git a/net/net.c b/net/net.c
index cbcac40..07fc23a 100644
--- a/net/net.c
+++ b/net/net.c
@@ -402,7 +402,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler,
return con;
out:
- free(con->packet);
+ net_free_packet(con->packet);
free(con);
return ERR_PTR(ret);
}
@@ -440,7 +440,7 @@ struct net_connection *net_icmp_new(IPaddr_t dest, rx_handler_f *handler,
void net_unregister(struct net_connection *con)
{
list_del(&con->list);
- free(con->packet);
+ net_free_packet(con->packet);
free(con);
}
@@ -495,7 +495,7 @@ static int net_answer_arp(unsigned char *pkt, int len)
return 0;
memcpy(packet, pkt, ETHER_HDR_SIZE + ARP_HDR_SIZE);
eth_send(packet, ETHER_HDR_SIZE + ARP_HDR_SIZE);
- free(packet);
+ net_free_packet(packet);
return 0;
}
--
1.7.7
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/5] net: allow the drivers to specify the tx buffer allocator
2012-03-02 18:20 [PATCH 1/5] net: use net_alloc_packet to allocate packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 2/5] net: introduce net_free_packet to free the packet Jean-Christophe PLAGNIOL-VILLARD
@ 2012-03-02 18:20 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 4/5] macb: implement alloc_packet & free_packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 5/5] macb: add timeout on send Jean-Christophe PLAGNIOL-VILLARD
3 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-02 18:20 UTC (permalink / raw)
To: barebox
This will allow as example to have a non cached buffer.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
include/net.h | 16 +++++++---------
net/eth.c | 41 +++++++++++++++++++++++++++++++++++++++++
net/net.c | 24 +++++++++++++++++-------
3 files changed, 65 insertions(+), 16 deletions(-)
diff --git a/include/net.h b/include/net.h
index c7da380..97515a5 100644
--- a/include/net.h
+++ b/include/net.h
@@ -39,6 +39,9 @@ struct eth_device {
int (*get_ethaddr) (struct eth_device*, unsigned char *adr);
int (*set_ethaddr) (struct eth_device*, unsigned char *adr);
+ void *(*alloc_packet)(struct eth_device*);
+ void (*free_packet)(struct eth_device*, void *packet);
+
struct eth_device *next;
void *priv;
@@ -373,6 +376,8 @@ typedef void rx_handler_f(void *ctx, char *packet, unsigned int len);
void eth_set_current(struct eth_device *eth);
struct eth_device *eth_get_current(void);
struct eth_device *eth_get_byname(char *name);
+void *eth_alloc_packet(void);
+void eth_free_packet(void *packet);
void net_update_env(void);
/**
@@ -396,15 +401,8 @@ struct net_connection {
void *priv;
};
-static inline char *net_alloc_packet(void)
-{
- return xmemalign(32, PKTSIZE);
-}
-
-static inline void net_free_packet(void *packet)
-{
- free(packet);
-}
+void *net_alloc_packet(void);
+void net_free_packet(void *packet);
struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport,
rx_handler_f *handler, void *ctx);
diff --git a/net/eth.c b/net/eth.c
index 20fdbf4..ba7a0eb 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -109,6 +109,31 @@ struct eth_device *eth_get_byname(char *ethname)
return NULL;
}
+void *eth_alloc_packet(void)
+{
+ int ret;
+
+ if (!eth_current)
+ return NULL;
+
+ if (!eth_current->active) {
+ ret = eth_current->open(eth_current);
+ if (ret)
+ return NULL;
+ eth_current->active = 1;
+ }
+
+ return eth_current->alloc_packet(eth_current);
+}
+
+void eth_free_packet(void *packet)
+{
+ if (!eth_current)
+ return;
+
+ eth_current->free_packet(eth_current, packet);
+}
+
int eth_send(void *packet, int length)
{
int ret;
@@ -185,6 +210,16 @@ static int eth_set_ipaddr(struct device_d *dev, struct param_d *param, const cha
return 0;
}
+static void *eth_default_alloc_packet(struct eth_device *edev)
+{
+ return net_alloc_packet();
+}
+
+static void eth_default_free_packet(struct eth_device *edev, void* packet)
+{
+ net_free_packet(packet);
+}
+
int eth_register(struct eth_device *edev)
{
struct device_d *dev = &edev->dev;
@@ -197,6 +232,12 @@ int eth_register(struct eth_device *edev)
return -1;
}
+ if (!edev->alloc_packet)
+ edev->alloc_packet = eth_default_alloc_packet;
+
+ if (!edev->free_packet)
+ edev->free_packet = eth_default_free_packet;
+
strcpy(edev->dev.name, "eth");
edev->dev.id = -1;
diff --git a/net/net.c b/net/net.c
index 07fc23a..cf1bfa8 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1,4 +1,4 @@
-/*
+ /*
* net.c - barebox networking support
*
* Copyright (c) 2010 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
@@ -222,7 +222,7 @@ static int arp_request(IPaddr_t dest, unsigned char *ether)
struct ethernet *et;
if (!arp_packet) {
- arp_packet = net_alloc_packet();
+ arp_packet = eth_alloc_packet();
if (!arp_packet)
return -ENOMEM;
}
@@ -370,7 +370,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler,
return ERR_PTR(-ENETDOWN);
con = xzalloc(sizeof(*con));
- con->packet = net_alloc_packet();
+ con->packet = eth_alloc_packet();
con->priv = ctx;
memset(con->packet, 0, PKTSIZE);
@@ -402,7 +402,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler,
return con;
out:
- net_free_packet(con->packet);
+ eth_free_packet(con->packet);
free(con);
return ERR_PTR(ret);
}
@@ -440,7 +440,7 @@ struct net_connection *net_icmp_new(IPaddr_t dest, rx_handler_f *handler,
void net_unregister(struct net_connection *con)
{
list_del(&con->list);
- net_free_packet(con->packet);
+ eth_free_packet(con->packet);
free(con);
}
@@ -490,12 +490,12 @@ static int net_answer_arp(unsigned char *pkt, int len)
memcpy(&arp->ar_data[0], net_ether, 6);
net_copy_ip(&arp->ar_data[6], &net_ip);
- packet = net_alloc_packet();
+ packet = eth_alloc_packet();
if (!packet)
return 0;
memcpy(packet, pkt, ETHER_HDR_SIZE + ARP_HDR_SIZE);
eth_send(packet, ETHER_HDR_SIZE + ARP_HDR_SIZE);
- net_free_packet(packet);
+ eth_free_packet(packet);
return 0;
}
@@ -660,6 +660,16 @@ out:
return ret;
}
+void *net_alloc_packet(void)
+{
+ return xmemalign(32, PKTSIZE);
+}
+
+void net_free_packet(void *packet)
+{
+ free(packet);
+}
+
static int net_init(void)
{
int i;
--
1.7.7
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/5] macb: implement alloc_packet & free_packet
2012-03-02 18:20 [PATCH 1/5] net: use net_alloc_packet to allocate packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 2/5] net: introduce net_free_packet to free the packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 3/5] net: allow the drivers to specify the tx buffer allocator Jean-Christophe PLAGNIOL-VILLARD
@ 2012-03-02 18:20 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-04 12:08 ` Sascha Hauer
2012-03-02 18:20 ` [PATCH 5/5] macb: add timeout on send Jean-Christophe PLAGNIOL-VILLARD
3 siblings, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-02 18:20 UTC (permalink / raw)
To: barebox
We need to have a non cached buffer.
Need when MMU enabled.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/net/macb.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index d79da72..9b54afa 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -50,6 +50,7 @@
#include <mach/board.h>
#include <linux/clk.h>
#include <linux/err.h>
+#include <asm/mmu.h>
#include "macb.h"
@@ -391,6 +392,16 @@ static int macb_set_ethaddr(struct eth_device *edev, unsigned char *adr)
return 0;
}
+static void *macb_alloc_packet(struct eth_device* edev)
+{
+ return dma_alloc_coherent(PKTSIZE);
+}
+
+static void macb_free_packet(struct eth_device* edev, void *packet)
+{
+ dma_free_coherent(packet, PKTSIZE);
+}
+
static int macb_probe(struct device_d *dev)
{
struct eth_device *edev;
@@ -420,6 +431,8 @@ static int macb_probe(struct device_d *dev)
edev->halt = macb_halt;
edev->get_ethaddr = pdata->get_ethaddr ? pdata->get_ethaddr : macb_get_ethaddr;
edev->set_ethaddr = macb_set_ethaddr;
+ edev->alloc_packet = macb_alloc_packet;
+ edev->free_packet = macb_free_packet;
edev->parent = dev;
macb->miidev.read = macb_phy_read;
@@ -431,9 +444,9 @@ static int macb_probe(struct device_d *dev)
macb->miidev.parent = dev;
macb->flags = pdata->flags;
- macb->rx_buffer = xmalloc(CFG_MACB_RX_BUFFER_SIZE);
- macb->rx_ring = xmalloc(CFG_MACB_RX_RING_SIZE * sizeof(struct macb_dma_desc));
- macb->tx_ring = xmalloc(sizeof(struct macb_dma_desc));
+ macb->rx_buffer = dma_alloc_coherent(CFG_MACB_RX_BUFFER_SIZE);
+ macb->rx_ring = dma_alloc_coherent(CFG_MACB_RX_RING_SIZE * sizeof(struct macb_dma_desc));
+ macb->tx_ring = dma_alloc_coherent(sizeof(struct macb_dma_desc));
macb->regs = dev_request_mem_region(dev, 0);
--
1.7.7
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/5] macb: add timeout on send
2012-03-02 18:20 [PATCH 1/5] net: use net_alloc_packet to allocate packet Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2012-03-02 18:20 ` [PATCH 4/5] macb: implement alloc_packet & free_packet Jean-Christophe PLAGNIOL-VILLARD
@ 2012-03-02 18:20 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-06 8:29 ` Sascha Hauer
3 siblings, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-02 18:20 UTC (permalink / raw)
To: barebox
This will ensure that we send an other packet only when the first one is send.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/net/macb.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 9b54afa..3835dba 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -121,6 +121,11 @@ static int macb_send(struct eth_device *edev, void *packet,
barrier();
writel(MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART), macb->regs + MACB_NCR);
+ wait_on_timeout(100 * MSECOND,
+ !(macb->tx_ring[0].ctrl & TXBUF_USED));
+
+ ctrl = macb->tx_ring[0].ctrl;
+
if (ctrl & TXBUF_UNDERRUN)
printf("TX underrun\n");
if (ctrl & TXBUF_EXHAUSTED)
--
1.7.7
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/5] macb: implement alloc_packet & free_packet
2012-03-02 18:20 ` [PATCH 4/5] macb: implement alloc_packet & free_packet Jean-Christophe PLAGNIOL-VILLARD
@ 2012-03-04 12:08 ` Sascha Hauer
2012-03-05 17:55 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2012-03-04 12:08 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Fri, Mar 02, 2012 at 07:20:09PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> We need to have a non cached buffer.
> Need when MMU enabled.
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> drivers/net/macb.c | 19 ++++++++++++++++---
> 1 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index d79da72..9b54afa 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -50,6 +50,7 @@
> #include <mach/board.h>
> #include <linux/clk.h>
> #include <linux/err.h>
> +#include <asm/mmu.h>
>
> #include "macb.h"
>
> @@ -391,6 +392,16 @@ static int macb_set_ethaddr(struct eth_device *edev, unsigned char *adr)
> return 0;
> }
>
> +static void *macb_alloc_packet(struct eth_device* edev)
> +{
> + return dma_alloc_coherent(PKTSIZE);
> +}
> +
> +static void macb_free_packet(struct eth_device* edev, void *packet)
> +{
> + dma_free_coherent(packet, PKTSIZE);
> +}
Why don't you use dma_flush_range/dma_clean_range like we do in other
drivers?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/5] macb: implement alloc_packet & free_packet
2012-03-04 12:08 ` Sascha Hauer
@ 2012-03-05 17:55 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-05 17:55 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 13:08 Sun 04 Mar , Sascha Hauer wrote:
> On Fri, Mar 02, 2012 at 07:20:09PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > We need to have a non cached buffer.
> > Need when MMU enabled.
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > drivers/net/macb.c | 19 ++++++++++++++++---
> > 1 files changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > index d79da72..9b54afa 100644
> > --- a/drivers/net/macb.c
> > +++ b/drivers/net/macb.c
> > @@ -50,6 +50,7 @@
> > #include <mach/board.h>
> > #include <linux/clk.h>
> > #include <linux/err.h>
> > +#include <asm/mmu.h>
> >
> > #include "macb.h"
> >
> > @@ -391,6 +392,16 @@ static int macb_set_ethaddr(struct eth_device *edev, unsigned char *adr)
> > return 0;
> > }
> >
> > +static void *macb_alloc_packet(struct eth_device* edev)
> > +{
> > + return dma_alloc_coherent(PKTSIZE);
> > +}
> > +
> > +static void macb_free_packet(struct eth_device* edev, void *packet)
> > +{
> > + dma_free_coherent(packet, PKTSIZE);
> > +}
>
> Why don't you use dma_flush_range/dma_clean_range like we do in other
> drivers?
yeah I did it last week-end but too much late and put the flush at thw wrong
place
now work send an update.
can you apply them on master as they fix the macb when MMU is enable on AT91
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 5/5] macb: add timeout on send
2012-03-02 18:20 ` [PATCH 5/5] macb: add timeout on send Jean-Christophe PLAGNIOL-VILLARD
@ 2012-03-06 8:29 ` Sascha Hauer
2012-03-07 9:21 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2012-03-06 8:29 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Fri, Mar 02, 2012 at 07:20:10PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> This will ensure that we send an other packet only when the first one is send.
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> drivers/net/macb.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 9b54afa..3835dba 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -121,6 +121,11 @@ static int macb_send(struct eth_device *edev, void *packet,
> barrier();
> writel(MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART), macb->regs + MACB_NCR);
>
> + wait_on_timeout(100 * MSECOND,
> + !(macb->tx_ring[0].ctrl & TXBUF_USED));
If you care for adding a timeout loop then you should also check
the return value.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 5/5] macb: add timeout on send
2012-03-06 8:29 ` Sascha Hauer
@ 2012-03-07 9:21 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-07 9:21 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 09:29 Tue 06 Mar , Sascha Hauer wrote:
> On Fri, Mar 02, 2012 at 07:20:10PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > This will ensure that we send an other packet only when the first one is send.
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > drivers/net/macb.c | 5 +++++
> > 1 files changed, 5 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > index 9b54afa..3835dba 100644
> > --- a/drivers/net/macb.c
> > +++ b/drivers/net/macb.c
> > @@ -121,6 +121,11 @@ static int macb_send(struct eth_device *edev, void *packet,
> > barrier();
> > writel(MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART), macb->regs + MACB_NCR);
> >
> > + wait_on_timeout(100 * MSECOND,
> > + !(macb->tx_ring[0].ctrl & TXBUF_USED));
>
> If you care for adding a timeout loop then you should also check
> the return value.
manage already in the source code
as we have the error storein ctrl field
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-03-07 9:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-02 18:20 [PATCH 1/5] net: use net_alloc_packet to allocate packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 2/5] net: introduce net_free_packet to free the packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 3/5] net: allow the drivers to specify the tx buffer allocator Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 4/5] macb: implement alloc_packet & free_packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-04 12:08 ` Sascha Hauer
2012-03-05 17:55 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 5/5] macb: add timeout on send Jean-Christophe PLAGNIOL-VILLARD
2012-03-06 8:29 ` Sascha Hauer
2012-03-07 9:21 ` Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox