* [PATCH 1/2] stmmac: fixed a compilation error when use the external timer
From: Giuseppe CAVALLARO @ 2009-11-19 7:42 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/stmmac/stmmac_timer.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c
index b838c65..679f61f 100644
--- a/drivers/net/stmmac/stmmac_timer.c
+++ b/drivers/net/stmmac/stmmac_timer.c
@@ -63,7 +63,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
if (stmmac_rtc == NULL) {
- pr_error("open rtc device failed\n");
+ pr_err("open rtc device failed\n");
return -ENODEV;
}
@@ -71,7 +71,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
/* Periodic mode is not supported */
if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) {
- pr_error("set periodic failed\n");
+ pr_err("set periodic failed\n");
rtc_irq_unregister(stmmac_rtc, &stmmac_task);
rtc_class_close(stmmac_rtc);
return -1;
--
1.6.0.4
^ permalink raw reply related
* [PATCH 2/2] stmmac: do not fail when the timer cannot be used.
From: Giuseppe CAVALLARO @ 2009-11-19 7:42 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
In-Reply-To: <1258616528-739-1-git-send-email-peppe.cavallaro@st.com>
If the external timer cannot be used the driver
will continue to work without mitigation.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/stmmac/stmmac_main.c | 52 ++++++++++++++++++++----------------
drivers/net/stmmac/stmmac_timer.h | 1 +
2 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index c2f14dc..e63bf93 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -416,13 +416,8 @@ static void init_dma_desc_rings(struct net_device *dev)
unsigned int txsize = priv->dma_tx_size;
unsigned int rxsize = priv->dma_rx_size;
unsigned int bfsize = priv->dma_buf_sz;
- int buff2_needed = 0;
- int dis_ic = 0;
+ int buff2_needed = 0, dis_ic = 0;
-#ifdef CONFIG_STMMAC_TIMER
- /* Using Timers disable interrupts on completion for the reception */
- dis_ic = 1;
-#endif
/* Set the Buffer size according to the MTU;
* indeed, in case of jumbo we need to bump-up the buffer sizes.
*/
@@ -437,6 +432,11 @@ static void init_dma_desc_rings(struct net_device *dev)
else
bfsize = DMA_BUFFER_SIZE;
+#ifdef CONFIG_STMMAC_TIMER
+ /* Disable interrupts on completion for the reception if timer is on */
+ if (likely(priv->tm->enable))
+ dis_ic = 1;
+#endif
/* If the MTU exceeds 8k so use the second buffer in the chain */
if (bfsize >= BUF_SIZE_8KiB)
buff2_needed = 1;
@@ -809,20 +809,22 @@ static void stmmac_tx(struct stmmac_priv *priv)
static inline void stmmac_enable_irq(struct stmmac_priv *priv)
{
-#ifndef CONFIG_STMMAC_TIMER
- writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA);
-#else
- priv->tm->timer_start(tmrate);
+#ifdef CONFIG_STMMAC_TIMER
+ if (likely(priv->tm->enable))
+ priv->tm->timer_start(tmrate);
+ else
#endif
+ writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA);
}
static inline void stmmac_disable_irq(struct stmmac_priv *priv)
{
-#ifndef CONFIG_STMMAC_TIMER
- writel(0, priv->dev->base_addr + DMA_INTR_ENA);
-#else
- priv->tm->timer_stop();
+#ifdef CONFIG_STMMAC_TIMER
+ if (likely(priv->tm->enable))
+ priv->tm->timer_stop();
+ else
#endif
+ writel(0, priv->dev->base_addr + DMA_INTR_ENA);
}
static int stmmac_has_work(struct stmmac_priv *priv)
@@ -1031,22 +1033,23 @@ static int stmmac_open(struct net_device *dev)
}
#ifdef CONFIG_STMMAC_TIMER
- priv->tm = kmalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
+ priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
if (unlikely(priv->tm == NULL)) {
pr_err("%s: ERROR: timer memory alloc failed \n", __func__);
return -ENOMEM;
}
priv->tm->freq = tmrate;
- /* Test if the HW timer can be actually used.
- * In case of failure continue with no timer. */
+ /* Test if the external timer can be actually used.
+ * In case of failure continue without timer. */
if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) {
- pr_warning("stmmaceth: cannot attach the HW timer\n");
+ pr_warning("stmmaceth: cannot attach the external timer.\n");
tmrate = 0;
priv->tm->freq = 0;
priv->tm->timer_start = stmmac_no_timer_started;
priv->tm->timer_stop = stmmac_no_timer_stopped;
- }
+ } else
+ priv->tm->enable = 1;
#endif
/* Create and initialize the TX/RX descriptors chains. */
@@ -1322,9 +1325,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
/* Interrupt on completition only for the latest segment */
priv->mac_type->ops->close_tx_desc(desc);
+
#ifdef CONFIG_STMMAC_TIMER
- /* Clean IC while using timers */
- priv->mac_type->ops->clear_tx_ic(desc);
+ /* Clean IC while using timer */
+ if (likely(priv->tm->enable))
+ priv->mac_type->ops->clear_tx_ic(desc);
#endif
/* To avoid raise condition */
priv->mac_type->ops->set_tx_owner(first);
@@ -2028,7 +2033,8 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state)
#ifdef CONFIG_STMMAC_TIMER
priv->tm->timer_stop();
- dis_ic = 1;
+ if (likely(priv->tm->enable))
+ dis_ic = 1;
#endif
napi_disable(&priv->napi);
@@ -2037,7 +2043,7 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state)
stmmac_dma_stop_rx(dev->base_addr);
/* Clear the Rx/Tx descriptors */
priv->mac_type->ops->init_rx_desc(priv->dma_rx,
- priv->dma_rx_size, dis_ic);
+ priv->dma_rx_size, dis_ic);
priv->mac_type->ops->init_tx_desc(priv->dma_tx,
priv->dma_tx_size);
diff --git a/drivers/net/stmmac/stmmac_timer.h b/drivers/net/stmmac/stmmac_timer.h
index f795cae..6863590 100644
--- a/drivers/net/stmmac/stmmac_timer.h
+++ b/drivers/net/stmmac/stmmac_timer.h
@@ -26,6 +26,7 @@ struct stmmac_timer {
void (*timer_start) (unsigned int new_freq);
void (*timer_stop) (void);
unsigned int freq;
+ unsigned int enable;
};
/* Open the HW timer device and return 0 in case of success */
--
1.6.0.4
^ permalink raw reply related
* Re: [PATCH 1/2] rps: core implementation
From: Jarek Poplawski @ 2009-11-19 8:08 UTC (permalink / raw)
To: Tom Herbert; +Cc: David Miller, netdev
In-Reply-To: <65634d660911160843j3df398f2w876044083181cfcd@mail.gmail.com>
On 16-11-2009 17:43, Tom Herbert wrote:
> On Mon, Nov 16, 2009 at 3:19 AM, David Miller <davem@davemloft.net> wrote:
>> From: Tom Herbert <therbert@google.com>
>> Date: Tue, 10 Nov 2009 22:53:17 -0800
>>
>>> + /* Schedule NAPI for backlog device */
>>> + if (napi_schedule_prep(&queue->backlog)) {
>>> + if (cpu != smp_processor_id()) {
>>> + cpu_set(cpu,
>>> + get_cpu_var(rps_remote_softirq_cpus));
>>> + __raise_softirq_irqoff(NET_RPS_SOFTIRQ);
>>> + } else
>>> + __napi_schedule(&queue->backlog);
>>> + }
>>> + goto enqueue;
>> {,__}send_remote_softirq() doesn't work? :-)
>>
> NET_RPS_SOFTIRQ is intended to provide coalescing of IPIs.
It seems calling net_rps_action() at the end of net_rx_action() should
do (mostly) the same, at least for napi drivers. And I'm not sure it's
worth to add a new softirq because of non-napis.
Jarek P.
^ permalink raw reply
* [RFC] gianfar: multi queue stuff not complete
From: Eric Dumazet @ 2009-11-19 8:28 UTC (permalink / raw)
To: David S. Miller, Sandeep Gopalpet; +Cc: Linux Netdev List
I noticed gianfar got multiqueue support recently, but it still
updates dev->stats.{tx_bytes|tx_packets|tx_dropped} without proper locking
(several cpus could update stats at same time while xmitting on different tx queues)
It should use txq->{tx_bytes|tx_packets|tx_dropped} to avoid wrong tx stats
I cooked following preliminar patch but its only for discussion, because I
dont know yet how to transform dev->stats.tx_dropped++; in gfar_error(),
and also because I cannot compile this driver on my dev machine.
(if a driver uses txq->tx... counters, it must not use any dev->stats.{tx_bytes|tx_packets|tx_dropped}
that are overwritten by dev_txq_stats_fold(). Or we could change dev_txq_stats_fold() logic
to get a mask of what fields a drivers updates in txq-> or dev->stats
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 16def13..8fe38aa 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1937,7 +1937,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
/* Update transmit stats */
- dev->stats.tx_bytes += skb->len;
+ txq->tx_bytes += skb->len;
+ txq->tx_packets++;
txbdp = txbdp_start = tx_queue->cur_tx;
@@ -2295,8 +2296,6 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
tx_queue->skb_dirtytx = skb_dirtytx;
tx_queue->dirty_tx = bdp;
- dev->stats.tx_packets += howmany;
-
return howmany;
}
^ permalink raw reply related
* [PATCH 1/3] hso: memory leak in hso_serial_common_free()
From: Martin Schiller @ 2009-11-19 8:43 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
This patch fixes a memory leak in the hso_serial_common_free() function.
The tx_buffer of a serial device was never freed here.
Signed-off-by: Martin Schiller <mschiller@tdt.de>
---
--- linux-2.6.32-rc7-git3/drivers/net/usb/hso.c.orig 2009-11-19 08:54:08.000000000 +0100
+++ linux-2.6.32-rc7-git3/drivers/net/usb/hso.c 2009-11-19 09:04:29.000000000 +0100
@@ -2296,6 +2296,7 @@ static void hso_serial_common_free(struc
/* unlink and free TX URB */
usb_free_urb(serial->tx_urb);
kfree(serial->tx_data);
+ kfree(serial->tx_buffer);
}
static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
^ permalink raw reply
* [PATCH 2/3] hso: memory leak in hso_free_net_device()
From: Martin Schiller @ 2009-11-19 8:44 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
This patch fixes a memory leak in the hso_free_net_device() function.
The structure hso_net will be freed by free_netdev(). So, the rx/tx urbs
and buffers must be freed before free_netdev() is called.
Signed-off-by: Martin Schiller <mschiller@tdt.de>
---
kmemleak still finds 1 remaining leak, but I can't find it.
Maybe someone else has an idea for this:
unreferenced object 0xce461130 (size 32):
comm "khubd", pid 1105, jiffies 17464
backtrace:
[<c10745b6>] create_object+0xe6/0x210
[<c10747d7>] kmemleak_alloc+0x27/0x60
[<c1071b0d>] kmem_cache_alloc+0xcd/0x120
[<d0ba29a7>] hso_create_net_device+0x207/0x420 [hso]
[<d0ba30c7>] hso_probe+0x417/0x690 [hso]
[<d0998103>] usb_probe_interface+0x83/0x170 [usbcore]
[<c113f9e2>] driver_probe_device+0x62/0x140
[<c113fb81>] __device_attach+0x41/0x50
[<c113f098>] bus_for_each_drv+0x48/0x70
[<c113fc2d>] device_attach+0x6d/0x80
[<c113eeed>] bus_probe_device+0x1d/0x40
[<c113da66>] device_add+0x436/0x4f0
[<d0997654>] usb_set_configuration+0x424/0x5c0 [usbcore]
[<d099e68e>] generic_probe+0x2e/0xa0 [usbcore]
[<d09979cf>] usb_probe_device+0x1f/0x30 [usbcore]
[<c113f9e2>] driver_probe_device+0x62/0x140
--- linux-2.6.32-rc7-git3/drivers/net/usb/hso.c.orig 2009-11-19 09:04:29.000000000 +0100
+++ linux-2.6.32-rc7-git3/drivers/net/usb/hso.c 2009-11-19 09:08:17.000000000 +0100
@@ -2423,7 +2423,6 @@ static void hso_free_net_device(struct h
if (hso_net->net) {
unregister_netdev(hso_net->net);
- free_netdev(hso_net->net);
}
/* start freeing */
@@ -2436,6 +2435,10 @@ static void hso_free_net_device(struct h
kfree(hso_net->mux_bulk_tx_buf);
hso_net->mux_bulk_tx_buf = NULL;
+ if (hso_net->net) {
+ free_netdev(hso_net->net);
+ }
+
kfree(hso_dev);
}
^ permalink raw reply
* [PATCH 3/3] hso: Fix interface order/creation when disabled_net=1
From: Martin Schiller @ 2009-11-19 8:44 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
This patch stops the useless creation of an serial ttyHS<x> for the
Network Port, when disable_net=1 is set. By that, the order of the
ttyHS<x> is always the same, regardless if disable_net is set or not.
Signed-off-by: Martin Schiller <mschiller@tdt.de>
---
--- linux-2.6.32-rc7-git3/drivers/net/usb/hso.c.orig 2009-11-19 09:08:17.000000000 +0100
+++ linux-2.6.32-rc7-git3/drivers/net/usb/hso.c 2009-11-19 09:10:36.000000000 +0100
@@ -2984,9 +2984,10 @@ static int hso_probe(struct usb_interfac
case HSO_INTF_BULK:
/* It's a regular bulk interface */
- if (((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK)
- && !disable_net)
+ if ((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) {
+ if (!disable_net)
hso_dev = hso_create_net_device(interface, port_spec);
+ }
else
hso_dev =
hso_create_bulk_serial_device(interface, port_spec);
^ permalink raw reply
* [net-next-2.6 PATCH] be2net:Patch to flash redboot section while firmware update.
From: Sarveshwar Bandi @ 2009-11-19 8:48 UTC (permalink / raw)
To: netdev; +Cc: davem
Please apply patch to update redboot section while firmware update. Code
checks if section needs to be updated before actually doing it.
Signed-off-by: Sarveshwar Bandi <sarveshwarb@serverengines.com>
---
drivers/net/benet/be_cmds.c | 29 +++++++++++++++++++++++++++++
drivers/net/benet/be_cmds.h | 2 ++
drivers/net/benet/be_hw.h | 5 +++++
drivers/net/benet/be_main.c | 31 +++++++++++++++++++++++++++++++
4 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index cc75dd0..808ad0d 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1251,3 +1251,32 @@ int be_cmd_write_flashrom(struct be_adap
spin_unlock_bh(&adapter->mcc_lock);
return status;
}
+
+int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc)
+{
+ struct be_mcc_wrb *wrb;
+ struct be_cmd_write_flashrom *req;
+ int status;
+
+ spin_lock_bh(&adapter->mcc_lock);
+
+ wrb = wrb_from_mccq(adapter);
+ req = embedded_payload(wrb);
+
+ be_wrb_hdr_prepare(wrb, sizeof(*req)+4, true, 0);
+
+ be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
+ OPCODE_COMMON_READ_FLASHROM, sizeof(*req)+4);
+
+ req->params.op_type = cpu_to_le32(FLASHROM_TYPE_REDBOOT);
+ req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT);
+ req->params.offset = 0x3FFFC;
+ req->params.data_buf_size = 0x4;
+
+ status = be_mcc_notify_wait(adapter);
+ if (!status)
+ memcpy(flashed_crc, req->params.data_buf, 4);
+
+ spin_unlock_bh(&adapter->mcc_lock);
+ return status;
+}
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 69dc017..6a430e4 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -118,6 +118,7 @@ #define OPCODE_COMMON_NTWK_MAC_SET 2
#define OPCODE_COMMON_NTWK_MULTICAST_SET 3
#define OPCODE_COMMON_NTWK_VLAN_CONFIG 4
#define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
+#define OPCODE_COMMON_READ_FLASHROM 6
#define OPCODE_COMMON_WRITE_FLASHROM 7
#define OPCODE_COMMON_CQ_CREATE 12
#define OPCODE_COMMON_EQ_CREATE 13
@@ -846,3 +847,4 @@ extern int be_cmd_read_port_type(struct
extern int be_cmd_write_flashrom(struct be_adapter *adapter,
struct be_dma_mem *cmd, u32 flash_oper,
u32 flash_opcode, u32 buf_size);
+extern int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc);
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h
index a3394b4..f53d5ca 100644
--- a/drivers/net/benet/be_hw.h
+++ b/drivers/net/benet/be_hw.h
@@ -225,6 +225,7 @@ #define IMAGE_TYPE_OPTIONROM 32
#define NUM_FLASHDIR_ENTRIES 32
#define FLASHROM_TYPE_ISCSI_ACTIVE 0
+#define FLASHROM_TYPE_REDBOOT 1
#define FLASHROM_TYPE_BIOS 2
#define FLASHROM_TYPE_PXE_BIOS 3
#define FLASHROM_TYPE_FCOE_BIOS 8
@@ -234,9 +235,11 @@ #define FLASHROM_TYPE_FCOE_FW_BACKUP 11
#define FLASHROM_OPER_FLASH 1
#define FLASHROM_OPER_SAVE 2
+#define FLASHROM_OPER_REPORT 4
#define FLASH_IMAGE_MAX_SIZE (1310720) /* Max firmware image size */
#define FLASH_BIOS_IMAGE_MAX_SIZE (262144) /* Max OPTION ROM image sz */
+#define FLASH_REDBOOT_IMAGE_MAX_SIZE (262144) /* Max redboot image sz */
/* Offsets for components on Flash. */
#define FLASH_iSCSI_PRIMARY_IMAGE_START (1048576)
@@ -246,6 +249,8 @@ #define FLASH_FCoE_BACKUP_IMAGE_START
#define FLASH_iSCSI_BIOS_START (7340032)
#define FLASH_PXE_BIOS_START (7864320)
#define FLASH_FCoE_BIOS_START (524288)
+#define FLASH_REDBOOT_START (32768)
+#define FLASH_REDBOOT_ISM_START (0)
struct controller_id {
u32 vendor;
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index c0bd203..921103c 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1721,6 +1721,31 @@ static int be_close(struct net_device *n
#define FW_FILE_HDR_SIGN "ServerEngines Corp. "
char flash_cookie[2][16] = {"*** SE FLAS",
"H DIRECTORY *** "};
+
+static bool be_flash_redboot(struct be_adapter *adapter,
+ const u8 *p)
+{
+ u32 crc_offset;
+ u8 flashed_crc[4];
+ int status;
+ crc_offset = FLASH_REDBOOT_START + FLASH_REDBOOT_IMAGE_MAX_SIZE - 4
+ + sizeof(struct flash_file_hdr) - 32*1024;
+ p += crc_offset;
+ status = be_cmd_get_flash_crc(adapter, flashed_crc);
+ if (status) {
+ dev_err(&adapter->pdev->dev,
+ "could not get crc from flash, not flashing redboot\n");
+ return false;
+ }
+
+ /*update redboot only if crc does not match*/
+ if (!memcmp(flashed_crc, p, 4))
+ return false;
+ else
+ return true;
+
+}
+
static int be_flash_image(struct be_adapter *adapter,
const struct firmware *fw,
struct be_dma_mem *flash_cmd, u32 flash_type)
@@ -1760,6 +1785,12 @@ static int be_flash_image(struct be_adap
image_offset = FLASH_PXE_BIOS_START;
image_size = FLASH_BIOS_IMAGE_MAX_SIZE;
break;
+ case FLASHROM_TYPE_REDBOOT:
+ if (!be_flash_redboot(adapter, fw->data))
+ return 0;
+ image_offset = FLASH_REDBOOT_ISM_START;
+ image_size = FLASH_REDBOOT_IMAGE_MAX_SIZE;
+ break;
default:
return 0;
}
--
1.4.0
^ permalink raw reply related
* RE: [RFC] gianfar: multi queue stuff not complete
From: Kumar Gopalpet-B05799 @ 2009-11-19 8:52 UTC (permalink / raw)
To: Eric Dumazet, David S. Miller; +Cc: Linux Netdev List
In-Reply-To: <4B05019F.4090208@gmail.com>
>I noticed gianfar got multiqueue support recently, but it
>still updates dev->stats.{tx_bytes|tx_packets|tx_dropped}
>without proper locking (several cpus could update stats at
>same time while xmitting on different tx queues)
>
>It should use txq->{tx_bytes|tx_packets|tx_dropped} to avoid
>wrong tx stats
>
>
>I cooked following preliminar patch but its only for
>discussion, because I dont know yet how to transform
>dev->stats.tx_dropped++; in gfar_error(), and also because I
>cannot compile this driver on my dev machine.
>
>(if a driver uses txq->tx... counters, it must not use any
>dev->stats.{tx_bytes|tx_packets|tx_dropped}
>that are overwritten by dev_txq_stats_fold(). Or we could
>change dev_txq_stats_fold() logic to get a mask of what fields
>a drivers updates in txq-> or dev->stats
>
>
Eric, Yes I agree that still there are a couple of changes left and I am
working on it.
One of them being the stats. Currently caught up in something else, I
will update them ASAP.
Also, suggest me on what kind of stats do I need to maintain ? Both per
device and per queue
or only per queue would be sufficient ?
--
Thanks
Sandeep
^ permalink raw reply
* Re: [RFC] gianfar: multi queue stuff not complete
From: Eric Dumazet @ 2009-11-19 9:13 UTC (permalink / raw)
To: Kumar Gopalpet-B05799; +Cc: David S. Miller, Linux Netdev List
In-Reply-To: <9F4C7D19E8361D4C94921B95BE08B81B950E25@zin33exm22.fsl.freescale.net>
Kumar Gopalpet-B05799 a écrit :
>
> Eric, Yes I agree that still there are a couple of changes left and I am
> working on it.
> One of them being the stats. Currently caught up in something else, I
> will update them ASAP.
>
> Also, suggest me on what kind of stats do I need to maintain ? Both per
> device and per queue
> or only per queue would be sufficient ?
>
Optimum would be per queue only, to avoid locking and let each queue be really independant.
^ permalink raw reply
* RE: [RFC] gianfar: multi queue stuff not complete
From: Kumar Gopalpet-B05799 @ 2009-11-19 9:14 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List
In-Reply-To: <4B050C25.5010309@gmail.com>
>> Eric, Yes I agree that still there are a couple of changes
>left and I
>> am working on it.
>> One of them being the stats. Currently caught up in
>something else, I
>> will update them ASAP.
>>
>> Also, suggest me on what kind of stats do I need to maintain ? Both
>> per device and per queue or only per queue would be sufficient ?
>>
>Optimum would be per queue only, to avoid locking and let each
>queue be really independant.
>
Thanks Eric, I will proceed with per queue stats then.
^ permalink raw reply
* Re: [PATCH 1/2] rps: core implementation
From: Jarek Poplawski @ 2009-11-19 9:57 UTC (permalink / raw)
To: Tom Herbert; +Cc: David Miller, netdev
In-Reply-To: <65634d660911102253o2b4f7a19kfed5849e5c88bfe1@mail.gmail.com>
On 11-11-2009 07:53, Tom Herbert wrote:
> Third version of RPS.
>
> Signed-off-by: Tom Herbert <therbert@google.com>
...
> @@ -2266,10 +2401,10 @@ void netif_nit_deliver(struct sk_buff *skb)
> }
>
> /**
> - * netif_receive_skb - process receive buffer from network
> + * __netif_receive_skb - process receive buffer from network
> * @skb: buffer to process
> *
> - * netif_receive_skb() is the main receive data processing function.
> + * __netif__napireceive_skb() is the main receive data processing function.
--------------->^^^^^^^^^^^^ ?
> * It always succeeds. The buffer may be dropped during processing
> * for congestion control or by the protocol layers.
> *
> @@ -2280,7 +2415,8 @@ void netif_nit_deliver(struct sk_buff *skb)
> * NET_RX_SUCCESS: no congestion
> * NET_RX_DROP: packet was dropped
> */
> -int netif_receive_skb(struct sk_buff *skb)
> +
> +int __netif_receive_skb(struct sk_buff *skb)
> {
> struct packet_type *ptype, *pt_prev;
> struct net_device *orig_dev;
> @@ -2378,6 +2514,16 @@ out:
> }
> EXPORT_SYMBOL(netif_receive_skb);
>
> +int netif_receive_skb(struct sk_buff *skb)
> +{
> + int cpu = get_rps_cpu(skb->dev, skb);
> +
> + if (cpu < 0)
The description reads: "This solution queues packets early on in the
receive path on the backlog queues of other CPUs.", so I'm not sure
it's intended. Did you test it like this (and it was visibly worse)?:
if (cpu < 0 || cpu == smp_processor_id())
> + return __netif_receive_skb(skb);
> + else
> + return enqueue_to_backlog(skb, cpu);
> +}
> +
Jarek P.
^ permalink raw reply
* Re: [PATCH 1/2] rps: core implementation
From: Andi Kleen @ 2009-11-19 10:08 UTC (permalink / raw)
To: Tom Herbert; +Cc: Andi Kleen, David Miller, netdev
In-Reply-To: <65634d660911160902t677a4fb4r71602cb0d10f1cce@mail.gmail.com>
On Mon, Nov 16, 2009 at 09:02:32AM -0800, Tom Herbert wrote:
Sorry for the late answer.
> >> + case __constant_htons(ETH_P_IPV6):
> >> + if (!pskb_may_pull(skb, sizeof(*ip6)))
> >> + return -1;
> >> +
> >> + ip6 = (struct ipv6hdr *) skb->data;
> >> + ip_proto = ip6->nexthdr;
> >> + addr1 = ip6->saddr.s6_addr32[3];
> >> + addr2 = ip6->daddr.s6_addr32[3];
> >
> > Why only [3] ? Is this future proof?
> >
> No. But it's same as inet6_ehashfn :-)
Perhaps it would be good to consolidate all these ipv6 hashes
into one place where they could be at least fixed easily.
>
> >> + for_each_cpu_mask_nr(cpu, __get_cpu_var(rps_remote_softirq_cpus)) {
> >> + struct softnet_data *queue = &per_cpu(softnet_data, cpu);
> >> + __smp_call_function_single(cpu, &queue->csd, 0);
> >
> > How do you get around the standard deadlocks with IPI called from
> > irq disabled section?
> >
>
> What are the standard deadlocks? Looks like __send_remote_softirq
> will call __smp_call_function with irq's disabled...
The traditional deadlock (that was before the queue smp_call_function)
was
A B
grab lock
interrupts off
spin on lock
send IPI
wait for specific CPU
never answers because
interrupts are off
hangs forever
I think with the queued smp_call_function it's better because
the locks are only hold much shorter and that particular scenario
is gone, but I'm not sure the problem has fully gone away.
At least there are still plenty of WARN_ON( ... irqs_disabled()) in
kernel/smp.c
> > It's a standard pet peeve of me, but it's quite unlikely you'll
> > get any useful entropy at this time of kernel startup.
> >
> > Normally it's always the same.
> >
> Would it make sense to just use skb_tx_hashrnd for the receive hash
> key also (renaming it to be more general)?
That has the same problem, although it's at least a bit later,
but I suspect it would be still not very random.
You could just drop it and always use a constant hash rnd?
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply
* [PATCH-v2 0/3] TI EMAC driver : Make driver re-usable on non-davinci platforms.
From: Sriramakrishnan @ 2009-11-19 10:28 UTC (permalink / raw)
To: davinci-linux-open-source; +Cc: netdev, Sriramakrishnan
The Davinci EMAC peripheral is also available on other TI platforms -
notably TI AM3517 SoC. The following series of patches modify the driver
suitably to make it platform agnostic.
This patch has been generated against the tip of linux-davinci git.
Sriramakrishnan (3):
TI Davinci EMAC : Re-use driver for other platforms.
TI Davinci EMAC : add platform specific interrupt enable/disable
logic.
TI Davinci EMAC : Abstract Buffer address translation logic.
arch/arm/mach-davinci/common.c | 2 +-
arch/arm/mach-davinci/include/mach/da8xx.h | 2 +-
arch/arm/mach-davinci/include/mach/dm365.h | 2 +-
arch/arm/mach-davinci/include/mach/dm644x.h | 2 +-
arch/arm/mach-davinci/include/mach/dm646x.h | 2 +-
arch/arm/mach-davinci/include/mach/emac.h | 36 -----------------
drivers/net/Kconfig | 2 +-
drivers/net/davinci_emac.c | 55 +++++++++++++++++---------
include/linux/davinci_emac.h | 39 +++++++++++++++++++
9 files changed, 81 insertions(+), 61 deletions(-)
delete mode 100644 arch/arm/mach-davinci/include/mach/emac.h
create mode 100644 include/linux/davinci_emac.h
^ permalink raw reply
* [PATCH-v2 2/3] TI Davinci EMAC : add platform specific interrupt enable/disable logic.
From: Sriramakrishnan @ 2009-11-19 10:28 UTC (permalink / raw)
To: davinci-linux-open-source; +Cc: netdev, Sriramakrishnan
In-Reply-To: <1258626507-5570-2-git-send-email-srk@ti.com>
On certain SOCs, the EMAC controller is interfaced with a wrapper logic
for handling interrupts. This patch implements a platform
specific hook to cater to platforms that require custom interrupt
handling logic
Signed-off-by: Sriramakrishnan <srk@ti.com>
Acked-by: Chaithrika U S <chaithrika@ti.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
drivers/net/davinci_emac.c | 11 +++++++++++
include/linux/davinci_emac.h | 2 ++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 6aec8f5..5372582 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -487,6 +487,9 @@ struct emac_priv {
struct mii_bus *mii_bus;
struct phy_device *phydev;
spinlock_t lock;
+ /*platform specific members*/
+ void (*int_enable) (void);
+ void (*int_disable) (void);
};
/* clock frequency for EMAC */
@@ -1001,6 +1004,8 @@ static void emac_int_disable(struct emac_priv *priv)
emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0x0);
emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0x0);
/* NOTE: Rx Threshold and Misc interrupts are not disabled */
+ if (priv->int_disable)
+ priv->int_disable();
local_irq_restore(flags);
@@ -1020,6 +1025,9 @@ static void emac_int_disable(struct emac_priv *priv)
static void emac_int_enable(struct emac_priv *priv)
{
if (priv->version == EMAC_VERSION_2) {
+ if (priv->int_enable)
+ priv->int_enable();
+
emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0xff);
emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0xff);
@@ -2662,6 +2670,9 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
priv->phy_mask = pdata->phy_mask;
priv->rmii_en = pdata->rmii_en;
priv->version = pdata->version;
+ priv->int_enable = pdata->interrupt_enable;
+ priv->int_disable = pdata->interrupt_disable;
+
emac_dev = &ndev->dev;
/* Get EMAC platform data */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h
index ff55487..6d894ef 100644
--- a/include/linux/davinci_emac.h
+++ b/include/linux/davinci_emac.h
@@ -25,6 +25,8 @@ struct emac_platform_data {
u32 mdio_max_freq;
u8 rmii_en;
u8 version;
+ void (*interrupt_enable) (void);
+ void (*interrupt_disable) (void);
};
enum {
--
1.6.2.4
^ permalink raw reply related
* [PATCH-v2 1/3] TI Davinci EMAC : Re-use driver for other platforms.
From: Sriramakrishnan @ 2009-11-19 10:28 UTC (permalink / raw)
To: davinci-linux-open-source; +Cc: netdev, Sriramakrishnan
In-Reply-To: <1258626507-5570-1-git-send-email-srk@ti.com>
The davinci EMAC peripheral is also available on other TI
platforms -notably TI AM3517 SoC. This patch modifies the
config option and the platform structure header files so that
the driver can be reused on non-davinci platforms as well.
Signed-off-by: Sriramakrishnan <srk@ti.com>
Acked-by: Chaithrika U S <chaithrika@ti.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
arch/arm/mach-davinci/common.c | 2 +-
arch/arm/mach-davinci/include/mach/da8xx.h | 2 +-
arch/arm/mach-davinci/include/mach/dm365.h | 2 +-
arch/arm/mach-davinci/include/mach/dm644x.h | 2 +-
arch/arm/mach-davinci/include/mach/dm646x.h | 2 +-
arch/arm/mach-davinci/include/mach/emac.h | 36 ---------------------------
drivers/net/Kconfig | 2 +-
drivers/net/davinci_emac.c | 3 +-
include/linux/davinci_emac.h | 36 +++++++++++++++++++++++++++
9 files changed, 43 insertions(+), 44 deletions(-)
delete mode 100644 arch/arm/mach-davinci/include/mach/emac.h
create mode 100644 include/linux/davinci_emac.h
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index c2de94c..94f27cb 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -11,13 +11,13 @@
#include <linux/module.h>
#include <linux/io.h>
#include <linux/etherdevice.h>
+#include <linux/davinci_emac.h>
#include <asm/tlb.h>
#include <asm/mach/map.h>
#include <mach/common.h>
#include <mach/cputype.h>
-#include <mach/emac.h>
#include "clock.h"
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 9070491..2af95ff 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -13,10 +13,10 @@
#include <video/da8xx-fb.h>
+#include <linux/davinci_emac.h>
#include <mach/serial.h>
#include <mach/edma.h>
#include <mach/i2c.h>
-#include <mach/emac.h>
#include <mach/asp.h>
#include <mach/mmc.h>
#include <mach/usb.h>
diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h
index f1710a3..3c07a88 100644
--- a/arch/arm/mach-davinci/include/mach/dm365.h
+++ b/arch/arm/mach-davinci/include/mach/dm365.h
@@ -14,8 +14,8 @@
#define __ASM_ARCH_DM665_H
#include <linux/platform_device.h>
+#include <linux/davinci_emac.h>
#include <mach/hardware.h>
-#include <mach/emac.h>
#include <mach/asp.h>
#include <mach/keyscan.h>
diff --git a/arch/arm/mach-davinci/include/mach/dm644x.h b/arch/arm/mach-davinci/include/mach/dm644x.h
index 44e8f0f..1a8b09c 100644
--- a/arch/arm/mach-davinci/include/mach/dm644x.h
+++ b/arch/arm/mach-davinci/include/mach/dm644x.h
@@ -22,8 +22,8 @@
#ifndef __ASM_ARCH_DM644X_H
#define __ASM_ARCH_DM644X_H
+#include <linux/davinci_emac.h>
#include <mach/hardware.h>
-#include <mach/emac.h>
#include <mach/asp.h>
#include <media/davinci/vpfe_capture.h>
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h
index 8cec746..5c92dfb 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -12,10 +12,10 @@
#define __ASM_ARCH_DM646X_H
#include <mach/hardware.h>
-#include <mach/emac.h>
#include <mach/asp.h>
#include <linux/i2c.h>
#include <linux/videodev2.h>
+#include <linux/davinci_emac.h>
#define DM646X_EMAC_BASE (0x01C80000)
#define DM646X_EMAC_CNTRL_OFFSET (0x0000)
diff --git a/arch/arm/mach-davinci/include/mach/emac.h b/arch/arm/mach-davinci/include/mach/emac.h
deleted file mode 100644
index beff4fb..0000000
--- a/arch/arm/mach-davinci/include/mach/emac.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * TI DaVinci EMAC platform support
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * 2007 (c) Deep Root Systems, LLC. This file is licensed under
- * the terms of the GNU General Public License version 2. This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-#ifndef _MACH_DAVINCI_EMAC_H
-#define _MACH_DAVINCI_EMAC_H
-
-#include <linux/if_ether.h>
-#include <linux/memory.h>
-
-struct emac_platform_data {
- char mac_addr[ETH_ALEN];
- u32 ctrl_reg_offset;
- u32 ctrl_mod_reg_offset;
- u32 ctrl_ram_offset;
- u32 mdio_reg_offset;
- u32 ctrl_ram_size;
- u32 phy_mask;
- u32 mdio_max_freq;
- u8 rmii_en;
- u8 version;
-};
-
-enum {
- EMAC_VERSION_1, /* DM644x */
- EMAC_VERSION_2, /* DM646x */
-};
-
-void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context);
-#endif
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e19ca4b..2d3443c 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -920,7 +920,7 @@ config NET_NETX
config TI_DAVINCI_EMAC
tristate "TI DaVinci EMAC Support"
- depends on ARM && ARCH_DAVINCI
+ depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 )
select PHYLIB
help
This driver supports TI's DaVinci Ethernet .
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 4cf80ec..6aec8f5 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -62,12 +62,11 @@
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/uaccess.h>
+#include <linux/davinci_emac.h>
#include <asm/irq.h>
#include <asm/page.h>
-#include <mach/emac.h>
-
static int debug_level;
module_param(debug_level, int, 0);
MODULE_PARM_DESC(debug_level, "DaVinci EMAC debug level (NETIF_MSG bits)");
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h
new file mode 100644
index 0000000..ff55487
--- /dev/null
+++ b/include/linux/davinci_emac.h
@@ -0,0 +1,36 @@
+/*
+ * TI DaVinci EMAC platform support
+ *
+ * Author: Kevin Hilman, Deep Root Systems, LLC
+ *
+ * 2007 (c) Deep Root Systems, LLC. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+#ifndef _LINUX_DAVINCI_EMAC_H
+#define _LINUX_DAVINCI_EMAC_H
+
+#include <linux/if_ether.h>
+#include <linux/memory.h>
+
+struct emac_platform_data {
+ char mac_addr[ETH_ALEN];
+ u32 ctrl_reg_offset;
+ u32 ctrl_mod_reg_offset;
+ u32 ctrl_ram_offset;
+ u32 mdio_reg_offset;
+ u32 ctrl_ram_size;
+ u32 phy_mask;
+ u32 mdio_max_freq;
+ u8 rmii_en;
+ u8 version;
+};
+
+enum {
+ EMAC_VERSION_1, /* DM644x */
+ EMAC_VERSION_2, /* DM646x */
+};
+
+void davinci_get_mac_addr(struct memory_accessor *mem_acc, void *context);
+#endif
--
1.6.2.4
^ permalink raw reply related
* [PATCH-v2 3/3] TI Davinci EMAC : Abstract Buffer address translation logic.
From: Sriramakrishnan @ 2009-11-19 10:28 UTC (permalink / raw)
To: davinci-linux-open-source; +Cc: netdev, Sriramakrishnan
In-Reply-To: <1258626507-5570-3-git-send-email-srk@ti.com>
When programming the DMA engine, the next pointers must be
programmed with physical address as seen from the DMA master
address space. This address may be different from physical
address of the buffer RAM area. This patch abstracts the
buffer address translation logic.
Signed-off-by: Sriramakrishnan <srk@ti.com>
Acked-by: Chaithrika U S <chaithrika@ti.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
drivers/net/davinci_emac.c | 41 ++++++++++++++++++++++++-----------------
include/linux/davinci_emac.h | 1 +
2 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 5372582..9fed476 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -464,6 +464,7 @@ struct emac_priv {
void __iomem *ctrl_base;
void __iomem *emac_ctrl_ram;
u32 ctrl_ram_size;
+ u32 hw_ram_addr;
struct emac_txch *txch[EMAC_DEF_MAX_TX_CH];
struct emac_rxch *rxch[EMAC_DEF_MAX_RX_CH];
u32 link; /* 1=link on, 0=link off */
@@ -497,11 +498,9 @@ static struct clk *emac_clk;
static unsigned long emac_bus_frequency;
static unsigned long mdio_max_freq;
-/* EMAC internal utility function */
-static inline u32 emac_virt_to_phys(void __iomem *addr)
-{
- return (u32 __force) io_v2p(addr);
-}
+#define emac_virt_to_phys(addr, priv) \
+ (((u32 __force)(addr) - (u32 __force)(priv->emac_ctrl_ram)) \
+ + priv->hw_ram_addr)
/* Cache macros - Packet buffers would be from skb pool which is cached */
#define EMAC_VIRT_NOCACHE(addr) (addr)
@@ -1309,7 +1308,7 @@ static int emac_tx_bdproc(struct emac_priv *priv, u32 ch, u32 budget)
curr_bd = txch->active_queue_head;
if (NULL == curr_bd) {
emac_write(EMAC_TXCP(ch),
- emac_virt_to_phys(txch->last_hw_bdprocessed));
+ emac_virt_to_phys(txch->last_hw_bdprocessed, priv));
txch->no_active_pkts++;
spin_unlock_irqrestore(&priv->tx_lock, flags);
return 0;
@@ -1319,7 +1318,7 @@ static int emac_tx_bdproc(struct emac_priv *priv, u32 ch, u32 budget)
while ((curr_bd) &&
((frame_status & EMAC_CPPI_OWNERSHIP_BIT) == 0) &&
(pkts_processed < budget)) {
- emac_write(EMAC_TXCP(ch), emac_virt_to_phys(curr_bd));
+ emac_write(EMAC_TXCP(ch), emac_virt_to_phys(curr_bd, priv));
txch->active_queue_head = curr_bd->next;
if (frame_status & EMAC_CPPI_EOQ_BIT) {
if (curr_bd->next) { /* misqueued packet */
@@ -1406,7 +1405,7 @@ static int emac_send(struct emac_priv *priv, struct emac_netpktobj *pkt, u32 ch)
txch->active_queue_tail = curr_bd;
if (1 != txch->queue_active) {
emac_write(EMAC_TXHDP(ch),
- emac_virt_to_phys(curr_bd));
+ emac_virt_to_phys(curr_bd, priv));
txch->queue_active = 1;
}
++txch->queue_reinit;
@@ -1418,10 +1417,11 @@ static int emac_send(struct emac_priv *priv, struct emac_netpktobj *pkt, u32 ch)
tail_bd->next = curr_bd;
txch->active_queue_tail = curr_bd;
tail_bd = EMAC_VIRT_NOCACHE(tail_bd);
- tail_bd->h_next = (int)emac_virt_to_phys(curr_bd);
+ tail_bd->h_next = (int)emac_virt_to_phys(curr_bd, priv);
frame_status = tail_bd->mode;
if (frame_status & EMAC_CPPI_EOQ_BIT) {
- emac_write(EMAC_TXHDP(ch), emac_virt_to_phys(curr_bd));
+ emac_write(EMAC_TXHDP(ch),
+ emac_virt_to_phys(curr_bd, priv));
frame_status &= ~(EMAC_CPPI_EOQ_BIT);
tail_bd->mode = frame_status;
++txch->end_of_queue_add;
@@ -1611,7 +1611,8 @@ static int emac_init_rxch(struct emac_priv *priv, u32 ch, char *param)
}
/* populate the hardware descriptor */
- curr_bd->h_next = emac_virt_to_phys(rxch->active_queue_head);
+ curr_bd->h_next = emac_virt_to_phys(rxch->active_queue_head,
+ priv);
/* FIXME buff_ptr = dma_map_single(... data_ptr ...) */
curr_bd->buff_ptr = virt_to_phys(curr_bd->data_ptr);
curr_bd->off_b_len = rxch->buf_size;
@@ -1886,7 +1887,7 @@ static void emac_addbd_to_rx_queue(struct emac_priv *priv, u32 ch,
rxch->active_queue_tail = curr_bd;
if (0 != rxch->queue_active) {
emac_write(EMAC_RXHDP(ch),
- emac_virt_to_phys(rxch->active_queue_head));
+ emac_virt_to_phys(rxch->active_queue_head, priv));
rxch->queue_active = 1;
}
} else {
@@ -1897,11 +1898,11 @@ static void emac_addbd_to_rx_queue(struct emac_priv *priv, u32 ch,
rxch->active_queue_tail = curr_bd;
tail_bd->next = curr_bd;
tail_bd = EMAC_VIRT_NOCACHE(tail_bd);
- tail_bd->h_next = emac_virt_to_phys(curr_bd);
+ tail_bd->h_next = emac_virt_to_phys(curr_bd, priv);
frame_status = tail_bd->mode;
if (frame_status & EMAC_CPPI_EOQ_BIT) {
emac_write(EMAC_RXHDP(ch),
- emac_virt_to_phys(curr_bd));
+ emac_virt_to_phys(curr_bd, priv));
frame_status &= ~(EMAC_CPPI_EOQ_BIT);
tail_bd->mode = frame_status;
++rxch->end_of_queue_add;
@@ -1994,7 +1995,7 @@ static int emac_rx_bdproc(struct emac_priv *priv, u32 ch, u32 budget)
curr_pkt->num_bufs = 1;
curr_pkt->pkt_length =
(frame_status & EMAC_RX_BD_PKT_LENGTH_MASK);
- emac_write(EMAC_RXCP(ch), emac_virt_to_phys(curr_bd));
+ emac_write(EMAC_RXCP(ch), emac_virt_to_phys(curr_bd, priv));
++rxch->processed_bd;
last_bd = curr_bd;
curr_bd = last_bd->next;
@@ -2005,7 +2006,7 @@ static int emac_rx_bdproc(struct emac_priv *priv, u32 ch, u32 budget)
if (curr_bd) {
++rxch->mis_queued_packets;
emac_write(EMAC_RXHDP(ch),
- emac_virt_to_phys(curr_bd));
+ emac_virt_to_phys(curr_bd, priv));
} else {
++rxch->end_of_queue;
rxch->queue_active = 0;
@@ -2106,7 +2107,7 @@ static int emac_hw_enable(struct emac_priv *priv)
emac_write(EMAC_RXINTMASKSET, BIT(ch));
rxch->queue_active = 1;
emac_write(EMAC_RXHDP(ch),
- emac_virt_to_phys(rxch->active_queue_head));
+ emac_virt_to_phys(rxch->active_queue_head, priv));
}
/* Enable MII */
@@ -2705,6 +2706,12 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
priv->ctrl_ram_size = pdata->ctrl_ram_size;
priv->emac_ctrl_ram = priv->remap_addr + pdata->ctrl_ram_offset;
+ if (pdata->hw_ram_addr)
+ priv->hw_ram_addr = pdata->hw_ram_addr;
+ else
+ priv->hw_ram_addr = (u32 __force)res->start +
+ pdata->ctrl_ram_offset;
+
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
dev_err(emac_dev, "DaVinci EMAC: Error getting irq res\n");
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h
index 6d894ef..7c930db 100644
--- a/include/linux/davinci_emac.h
+++ b/include/linux/davinci_emac.h
@@ -19,6 +19,7 @@ struct emac_platform_data {
u32 ctrl_reg_offset;
u32 ctrl_mod_reg_offset;
u32 ctrl_ram_offset;
+ u32 hw_ram_addr;
u32 mdio_reg_offset;
u32 ctrl_ram_size;
u32 phy_mask;
--
1.6.2.4
^ permalink raw reply related
* [PATCH] ieee802154: dont leak skbs in ieee802154_fake_xmit()
From: Eric Dumazet @ 2009-11-19 11:28 UTC (permalink / raw)
To: David S. Miller; +Cc: Dmitry Eremin-Solenikov, Linux Netdev List
ieee802154_fake_xmit() should free skbs since it returns NETDEV_TX_OK
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c
index 96a2959..7c544f7 100644
--- a/drivers/ieee802154/fakehard.c
+++ b/drivers/ieee802154/fakehard.c
@@ -260,15 +260,12 @@ static int ieee802154_fake_close(struct net_device *dev)
static netdev_tx_t ieee802154_fake_xmit(struct sk_buff *skb,
struct net_device *dev)
{
- skb->iif = dev->ifindex;
- skb->dev = dev;
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
- dev->trans_start = jiffies;
-
/* FIXME: do hardware work here ... */
+ dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
^ permalink raw reply related
* Re: [PATCH 1/3] macvlan: Reflect macvlan packets meant for other macvlan devices
From: Arnd Bergmann @ 2009-11-19 11:44 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Eric Dumazet, linux-kernel, netdev, David Miller,
Stephen Hemminger, Herbert Xu, Patrick McHardy, Patrick Mullaney,
Edge Virtual Bridging, Anna Fischer, bridge, virtualization,
Jens Osterkamp, Gerhard Stenzel
In-Reply-To: <m1bpiz8k1x.fsf@fess.ebiederm.org>
On Thursday 19 November 2009, Eric W. Biederman wrote:
> > It seems that we should never drop dst then. We either forward the frame to
> > netif_rx or to dev_queue_xmit, and from how I read it now, we want to keep
> > the dst in both cases.
>
> When we loop back on our selves we certainly need to have dst clear because
> we don't know how to cache routes through multiple network namespaces.
Ah, right. So should I add the explicit dst_drop to the new dev_forward_skb()
then? The veth driver doesn't need it, but it also looks like it won't hurt.
Arnd <><
^ permalink raw reply
* Oops in Unix sockets code
From: Blaschka @ 2009-11-19 13:20 UTC (permalink / raw)
To: netdev, linux-s390
Hi,
running disk tests on s390x (kernel 2.6.31) we get following Oops in Unix domain
socket code (hald process). Can somebody help? We do get this Oops from time to
time so we are willing to test a patch or provide additional debug data if
required.
Thanks,
Frank
<1>Unable to handle kernel pointer dereference at virtual kernel address 000000007575e000
<4>Oops: 0011 [#1] PREEMPT SMP DEBUG_PAGEALLOC
<4>Modules linked in: sunrpc qeth_l3 dm_multipath dm_mod qeth ccwgroup chsc_sch
<4>CPU: 0 Not tainted 2.6.31-39.x.20091102-s390xdefault #1
<4>Process hald (pid: 2117, task: 000000007d200c40, ksp: 000000007ab33880)
<4>Krnl PSW : 0704100180000000 00000000003a15f8 (_raw_read_trylock+0x0/0x28)
<4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0 EA:3
<4>Krnl GPRS: 16c8a00000000000 000000007d200c40 000000007575ed18 0000000000000003
<4> 00000000005853d2 000000007d201470 0000000000000002 000000007ab33c30
<4> 0000000075746c78 000000007a74da48 000000000051a16a 000000007575ed18
<4> 000000007575ed30 00000000005da190 00000000005853dc 000000007ab338c8
<4>Krnl Code: 00000000003a15e8: c03000185811 larl %r3,6ac60a
<4> 00000000003a15ee: c0e5fffffdd9 brasl %r14,3a11a0
<4> 00000000003a15f4: a7f4ffce brc 15,3a1590
<4> >00000000003a15f8: 58302000 l %r3,0(%r2)
<4> 00000000003a15fc: b9170033 llgtr %r3,%r3
<4> 00000000003a1600: 1853 lr %r5,%r3
<4> 00000000003a1602: 1813 lr %r1,%r3
<4> 00000000003a1604: a75a0001 ahi %r5,1
<4>Call Trace:
<4>([<00000000005853d2>] _read_lock+0x5a/0x98)
<4> [<000000000051a16a>] unix_write_space+0x36/0xb0
<4> [<00000000004788a8>] sock_wfree+0x80/0x84
<4> [<000000000047dc08>] skb_release_head_state+0x88/0x140
<4> [<000000000047d7ec>] __kfree_skb+0x28/0x10c
<4> [<0000000000481d7e>] skb_free_datagram+0x32/0x6c
<4> [<0000000000517a46>] unix_dgram_recvmsg+0x246/0x38c
<4> [<0000000000474036>] sock_recvmsg+0xe2/0x118
<4> [<00000000004754f8>] SyS_recvmsg+0x134/0x310
<4> [<0000000000472f14>] SyS_socketcall+0xfc/0x31c
<4> [<0000000000117f9e>] sysc_noemu+0x10/0x16
<4> [<0000004f131a95ae>] 0x4f131a95ae
<4>INFO: lockdep is turned off.
<4>Last Breaking-Event-Address:
<4> [<00000000005853d6>] _read_lock+0x5e/0x98
<4>
<0>Kernel panic - not syncing: Fatal exception: panic_on_oops
<4>CPU: 0 Tainted: G D 2.6.31-39.x.20091102-s390xdefault #1
<4>Process hald (pid: 2117, task: 000000007d200c40, ksp: 000000007ab33880)
<4>0000000000000000 000000007ab33588 0000000000000002 0000000000000000
<4> 000000007ab33628 000000007ab335a0 000000007ab335a0 00000000005801b8
<4> 0000000000000001 0000000000000000 000000007ab33c30 0000000000000000
<4> 000000000000000d 0000000000000000 000000007ab335f8 000000000000000e
<4> 000000000058fc18 0000000000105700 000000007ab33588 000000007ab335d0
<4>Call Trace:
<4>([<00000000001055fc>] show_trace+0xf0/0x148)
<4> [<0000000000580022>] panic+0xa2/0x1e4
<4> [<0000000000105bf8>] die+0x14c/0x168
<4> [<00000000001012d8>] do_no_context+0xa8/0xe8
<4> [<000000000058597c>] do_dat_exception+0x134/0x338
<4> [<0000000000117fa4>] sysc_return+0x0/0x8
<4> [<00000000003a15f8>] _raw_read_trylock+0x0/0x28
<4>([<00000000005853d2>] _read_lock+0x5a/0x98)
<4> [<000000000051a16a>] unix_write_space+0x36/0xb0
<4> [<00000000004788a8>] sock_wfree+0x80/0x84
<4> [<000000000047dc08>] skb_release_head_state+0x88/0x140
<4> [<000000000047d7ec>] __kfree_skb+0x28/0x10c
<4> [<0000000000481d7e>] skb_free_datagram+0x32/0x6c
<4> [<0000000000517a46>] unix_dgram_recvmsg+0x246/0x38c
<4> [<0000000000474036>] sock_recvmsg+0xe2/0x118
<4> [<00000000004754f8>] SyS_recvmsg+0x134/0x310
<4> [<0000000000472f14>] SyS_socketcall+0xfc/0x31c
<4> [<0000000000117f9e>] sysc_noemu+0x10/0x16
<4> [<0000004f131a95ae>] 0x4f131a95ae
<4>INFO: lockdep is turned off.
^ permalink raw reply
* Re: Oops in Unix sockets code
From: Christian Borntraeger @ 2009-11-19 13:40 UTC (permalink / raw)
To: Blaschka; +Cc: netdev, linux-s390
In-Reply-To: <20091119132028.GA22427@tuxmaker.boeblingen.de.ibm.com>
Am Donnerstag 19 November 2009 14:20:28 schrieb Blaschka:
> <1>Unable to handle kernel pointer dereference at virtual kernel address 000000007575e000
> <4>Oops: 0011 [#1] PREEMPT SMP DEBUG_PAGEALLOC
0011(page translation excepton) and DEBUG_PAGEALLOC might indicate a use after free.
> <4>Modules linked in: sunrpc qeth_l3 dm_multipath dm_mod qeth ccwgroup chsc_sch
> <4>CPU: 0 Not tainted 2.6.31-39.x.20091102-s390xdefault #1
> <4>Process hald (pid: 2117, task: 000000007d200c40, ksp: 000000007ab33880)
> <4>Krnl PSW : 0704100180000000 00000000003a15f8 (_raw_read_trylock+0x0/0x28)
> <4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0 EA:3
> <4>Krnl GPRS: 16c8a00000000000 000000007d200c40 000000007575ed18 0000000000000003
> <4> 00000000005853d2 000000007d201470 0000000000000002 000000007ab33c30
> <4> 0000000075746c78 000000007a74da48 000000000051a16a 000000007575ed18
> <4> 000000007575ed30 00000000005da190 00000000005853dc 000000007ab338c8
> <4>Krnl Code: 00000000003a15e8: c03000185811 larl %r3,6ac60a
> <4> 00000000003a15ee: c0e5fffffdd9 brasl %r14,3a11a0
> <4> 00000000003a15f4: a7f4ffce brc 15,3a1590
> <4> >00000000003a15f8: 58302000 l %r3,0(%r2)
> <4> 00000000003a15fc: b9170033 llgtr %r3,%r3
> <4> 00000000003a1600: 1853 lr %r5,%r3
> <4> 00000000003a1602: 1813 lr %r1,%r3
> <4> 00000000003a1604: a75a0001 ahi %r5,1
> <4>Call Trace:
> <4>([<00000000005853d2>] _read_lock+0x5a/0x98)
> <4> [<000000000051a16a>] unix_write_space+0x36/0xb0
[...]
So it looks like that struct sock *sk is already gone in unix_write_space.
Since I have no clue about the socket code, I can only guess that there is a
locking or refcount issue.
Christian
^ permalink raw reply
* Re: Oops in Unix sockets code
From: Eric Dumazet @ 2009-11-19 14:20 UTC (permalink / raw)
To: Christian Borntraeger; +Cc: Blaschka, netdev, linux-s390
In-Reply-To: <200911191440.18949.borntraeger@de.ibm.com>
Christian Borntraeger a écrit :
> Am Donnerstag 19 November 2009 14:20:28 schrieb Blaschka:
>> <1>Unable to handle kernel pointer dereference at virtual kernel address 000000007575e000
>> <4>Oops: 0011 [#1] PREEMPT SMP DEBUG_PAGEALLOC
> 0011(page translation excepton) and DEBUG_PAGEALLOC might indicate a use after free.
>
>> <4>Modules linked in: sunrpc qeth_l3 dm_multipath dm_mod qeth ccwgroup chsc_sch
>> <4>CPU: 0 Not tainted 2.6.31-39.x.20091102-s390xdefault #1
>> <4>Process hald (pid: 2117, task: 000000007d200c40, ksp: 000000007ab33880)
>> <4>Krnl PSW : 0704100180000000 00000000003a15f8 (_raw_read_trylock+0x0/0x28)
>> <4> R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0 EA:3
>> <4>Krnl GPRS: 16c8a00000000000 000000007d200c40 000000007575ed18 0000000000000003
>> <4> 00000000005853d2 000000007d201470 0000000000000002 000000007ab33c30
>> <4> 0000000075746c78 000000007a74da48 000000000051a16a 000000007575ed18
>> <4> 000000007575ed30 00000000005da190 00000000005853dc 000000007ab338c8
>> <4>Krnl Code: 00000000003a15e8: c03000185811 larl %r3,6ac60a
>> <4> 00000000003a15ee: c0e5fffffdd9 brasl %r14,3a11a0
>> <4> 00000000003a15f4: a7f4ffce brc 15,3a1590
>> <4> >00000000003a15f8: 58302000 l %r3,0(%r2)
>> <4> 00000000003a15fc: b9170033 llgtr %r3,%r3
>> <4> 00000000003a1600: 1853 lr %r5,%r3
>> <4> 00000000003a1602: 1813 lr %r1,%r3
>> <4> 00000000003a1604: a75a0001 ahi %r5,1
>> <4>Call Trace:
>> <4>([<00000000005853d2>] _read_lock+0x5a/0x98)
>> <4> [<000000000051a16a>] unix_write_space+0x36/0xb0
> [...]
>
> So it looks like that struct sock *sk is already gone in unix_write_space.
> Since I have no clue about the socket code, I can only guess that there is a
> locking or refcount issue.
2.6.31 has a known bug
2.6.31.4 should correct it
commit 657453424a3c382035983f9a47306fafea730f6d
Author: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu Sep 24 10:49:24 2009 +0000
net: Fix sock_wfree() race
[ Upstream commit d99927f4d93f36553699573b279e0ff98ad7dea6 ]
Commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
(net: No more expensive sock_hold()/sock_put() on each tx)
opens a window in sock_wfree() where another cpu
might free the socket we are working on.
A fix is to call sk->sk_write_space(sk) while still
holding a reference on sk.
Reported-by: Jike Song <albcamus@gmail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Please try 2.6.31.6 ;)
^ permalink raw reply
* NET: Questions about supporting older kernel's with kmods
From: Gregory Haskins @ 2009-11-19 14:21 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1165 bytes --]
Hi All,
So I was in the process of packaging up my venet driver so that it could
not only support the in-tree build (in -next), but also build as a KMP
for inclusion in existing distros that already shipped (like SLE, RHEL,
CentOS, etc).
The problem I ran into is that the ethtool and netdev_ops components of
the in-tree version do not necessarily align with the substrate
capabilities of older kernels. What are the best-practices surrounding
this issue?
Q1) Is there any official CONFIG tags (e.g. HAVE_NETDEV_OPS) I can key
off of, or should I simply look at the kernel version? If the latter,
any recommendation on what to use for the aforementioned features? (I
can always try to git-annotate to figure it out, but I wonder if there
are best-practices already in place).
Q2) Is it considered "bad form" to include such compile-time directives
in the version of the code going upstream? E.g. can my driver in -next
have "#ifdef CONFIG_HAVE_NETDEV_OPS" or other version/capability deps,
or do I need to patch these externally into the code destined for the
kmod, and leave the upstream code "pure"?
Thanks in advance,
-Greg
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 267 bytes --]
^ permalink raw reply
* Re: netlink: remove subscriptions check on notifier
From: Patrick McHardy @ 2009-11-19 14:22 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev
In-Reply-To: <1258409134.1375.0.camel@johannes.local>
Johannes Berg wrote:
> The netlink URELEASE notifier doesn't notify for
> sockets that have been used to receive multicast
> but it should be called for such sockets as well
> since they might _also_ be used for sending and
> not solely for receiving multicast. We will need
> that for nl80211 (generic netlink sockets) in the
> future.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> Cc: Patrick McHardy <kaber@trash.net>
I've audited all users of this (all within netfilter) and this
change makes sense for them as well.
Acked-by: Patrick McHardy <kaber@trash.net>
^ permalink raw reply
* Re: [PATCH 3/3] macvlan: export macvlan mode through netlink
From: Patrick McHardy @ 2009-11-19 14:38 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Eric Dumazet, linux-kernel, netdev, David Miller,
Stephen Hemminger, Herbert Xu, Patrick Mullaney,
Eric W. Biederman, Edge Virtual Bridging, Anna Fischer, bridge,
virtualization, Jens Osterkamp, Gerhard Stenzel
In-Reply-To: <200911181059.45331.arnd@arndb.de>
Arnd Bergmann wrote:
> On Wednesday 18 November 2009, Eric Dumazet wrote:
>>> --- a/drivers/net/macvlan.c
>>> +++ b/drivers/net/macvlan.c
>>> @@ -33,12 +33,6 @@
>>>
>>> #define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE)
>>>
>>> -enum macvlan_type {
>>> - MACVLAN_PRIVATE = 1,
>>> - MACVLAN_VEPA = 2,
>>> - MACVLAN_BRIDGE = 4,
>>> -};
>> I realize you defined MACVLAN_PRIVATE in patch 2, but used MACVLAN_MODE_PRIVATE,
>> so patch 2 is not compilable and breaks bisection ?
>>
>
> Hmm, right. I'll fix that up as well.
> +enum ifla_macvlan_mode {
> + MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */
> + MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */
> + MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
> +};
Please also keep the enum named something without ifla_ since
the mode values themselves are not netlink attributes. Just
macvlan_mode seems fine.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox