You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-misc/ixp4xx/files/2.1/50-oemod-ixp400_eth.patch

172 lines
4.9 KiB

--- ixp400_eth.c
+++ ixp400_eth.c
@@ -128,6 +128,7 @@ static int dev_max_count = 2; /* only NP
static int dev_max_count = 3; /* all NPEs are used */
#endif
+static int dev_max_count = 1;
#ifndef CONFIG_IXP400_NAPI
/* netdev_max_backlog: ideally /proc/sys/net/core/netdev_max_backlog, but any
* value > 46 looks to work. This is used to control the maximum number of
@@ -157,7 +158,11 @@ MODULE_PARM(dev_max_count, "i");
MODULE_PARM_DESC(dev_max_count, "Number of devices to initialize");
/* devices will be called ixp0 and ixp1 */
+#ifdef IX_DEVICE_NAME_ETH
+#define DEVICE_NAME "eth"
+#else
#define DEVICE_NAME "ixp"
+#endif
/* boolean values for PHY link speed, duplex, and autonegotiation */
#define PHY_SPEED_10 0
@@ -347,6 +352,12 @@ static int dev_pmu_timer_init(void);
extern void
ixEthTxFrameDoneQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/* poll controller (needed for netconsole et al) */
+static void
+ixp425eth_poll_controller(struct net_device *dev);
+#endif
+
/* Private device data */
typedef struct {
spinlock_t lock; /* multicast management lock */
@@ -1838,7 +1849,11 @@ static inline void dev_eth_type_trans(un
skb->len -= header_len;
/* fill the pkt arrival time (set at the irq callback entry) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
skb->stamp = irq_stamp;
+#else
+ skb_set_timestamp(skb, &irq_stamp);
+#endif
/* fill the input device field */
skb->dev = dev;
@@ -2028,6 +2043,16 @@ static void rx_cb(UINT32 callbackTag, IX
skb->tail = skb->data + len;
skb->len = len;
+#ifndef __ARMEB__
+ {
+ /* Byte swap all words containing data from the buffer. */
+ unsigned long *p = (unsigned long*)((unsigned)skb->data & ~0x3);
+ unsigned long *e = (unsigned long*)(((unsigned)skb->data + skb->len + 3) & ~0x3);
+ while (p < e)
+ *p = ntohl(*p), ++p;
+ }
+#endif
+
#ifdef DEBUG_DUMP
skb_dump("rx", skb);
#endif
@@ -2418,6 +2443,16 @@ static int dev_hard_start_xmit(struct sk
return 0;
}
+#ifndef __ARMEB__
+ {
+ /* Byte swap all words containing data from the buffer. */
+ unsigned long *p = (unsigned long*)((unsigned)skb->data & ~0x3);
+ unsigned long *e = (unsigned long*)(((unsigned)skb->data + skb->len + 3) & ~0x3);
+ while (p < e)
+ *p = ntohl(*p), ++p;
+ }
+#endif
+
#ifdef DEBUG_DUMP
skb_dump("tx", skb);
#endif
@@ -3014,7 +3049,7 @@ static int phy_init(void)
}
/* set port MAC addr and update the dev struct if successfull */
-int dev_set_mac_address(struct net_device *dev, void *addr)
+static int set_mac_address(struct net_device *dev, void *addr)
{
int res;
IxEthAccMacAddr npeMacAddr;
@@ -3052,6 +3087,19 @@ int dev_set_mac_address(struct net_devic
return 0;
}
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling receive - used by netconsole and other diagnostic tools
+ * to allow network i/o with interrupts disabled.
+ * (stolen from 8139too.c by siddy)
+ */
+static void ixp425eth_poll_controller(struct net_device *dev)
+{
+ disable_irq(dev->irq);
+ dev_qmgr_os_isr(dev->irq, dev, NULL);
+ enable_irq(dev->irq);
+}
+#endif
/*
* TX QDISC
@@ -3241,6 +3289,8 @@ static int __devinit dev_eth_probe(struc
kmalloc(sizeof(struct semaphore), GFP_KERNEL);
if (!priv->maintenanceCheckThreadComplete)
{
+ P_ERROR("%s: Failed to allocate maintenance semaphore %d\n",
+ ndev->name, priv->port_id);
goto error;
}
priv->lock = SPIN_LOCK_UNLOCKED;
@@ -3265,8 +3315,11 @@ static int __devinit dev_eth_probe(struc
ndev->get_stats = dev_get_stats;
ndev->set_multicast_list = dev_set_multicast_list;
ndev->flags |= IFF_MULTICAST;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ ndev->poll_controller = ixp425eth_poll_controller;
+#endif
- ndev->set_mac_address = dev_set_mac_address;
+ ndev->set_mac_address = set_mac_address;
#ifdef CONFIG_IXP400_NAPI
ndev->poll = &dev_rx_poll;
@@ -3347,7 +3400,11 @@ static int __devinit dev_eth_probe(struc
#if IS_KERNEL26
if (register_netdev(ndev))
+ {
+ P_ERROR("%s: Failed to register netdevice %d\n",
+ ndev->name, priv->port_id);
goto error;
+ }
#else
found_devices++;
#endif /* IS_KERNEL26 */
@@ -3357,6 +3414,8 @@ static int __devinit dev_eth_probe(struc
/* register EthAcc callbacks for this port */
if (dev_rxtxcallback_register(portId, (UINT32)ndev))
{
+ P_ERROR("%s: Failed to register callback %d\n",
+ ndev->name, priv->port_id);
goto error;
}
@@ -3380,6 +3439,7 @@ static int __devinit dev_eth_probe(struc
/* Error handling: enter here whenever error detected */
error:
+ P_ERROR("%s: dev_eth_probe fails\n", ndev->name);
TRACE;
#ifdef CONFIG_IXP400_ETH_QDISC_ENABLED
@@ -3515,6 +3575,9 @@ static int __init ixp400_eth_init(void)
TRACE;
P_INFO("Initializing IXP400 NPE Ethernet driver software v. " MOD_VERSION " \n");
+#ifdef IX_OSAL_ENSURE_ON
+ ixOsalLogLevelSet(IX_OSAL_LOG_LVL_ALL);
+#endif
TRACE;