+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+#ifndef _PORTALS_COMPAT_H
+#define _PORTALS_COMPAT_H
+
// XXX BUG 1511 -- remove this stanza and all callers when bug 1511 is resolved
#if SPINLOCK_DEBUG
# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) || defined(CONFIG_RH_2_4_20)
// XXX BUG 1511 -- remove this stanza and all callers when bug 1511 is resolved
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) || defined(CONFIG_RH_2_4_20)
-# define SIGNAL_MASK_LOCK(task, flags) \
+
+# define SIGNAL_MASK_LOCK(task, flags) \
spin_lock_irqsave(&task->sighand->siglock, flags)
-# define SIGNAL_MASK_UNLOCK(task, flags) \
+# define SIGNAL_MASK_UNLOCK(task, flags) \
spin_unlock_irqrestore(&task->sighand->siglock, flags)
+# define USERMODEHELPER(path, argv, envp) \
+ call_usermodehelper(path, argv, envp, 1)
# define RECALC_SIGPENDING recalc_sigpending()
-#else
-# define SIGNAL_MASK_LOCK(task, flags) \
+# define CURRENT_SECONDS get_seconds()
+
+#else /* 2.4.x */
+
+# define SIGNAL_MASK_LOCK(task, flags) \
spin_lock_irqsave(&task->sigmask_lock, flags)
-# define SIGNAL_MASK_UNLOCK(task, flags) \
+# define SIGNAL_MASK_UNLOCK(task, flags) \
spin_unlock_irqrestore(&task->sigmask_lock, flags)
+# define USERMODEHELPER(path, argv, envp) \
+ call_usermodehelper(path, argv, envp)
# define RECALC_SIGPENDING recalc_sigpending(current)
+# define CURRENT_SECONDS CURRENT_TIME
+
#endif
#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# define THREAD_NAME(comm, fmt, a...) \
+# define THREAD_NAME(comm, fmt, a...) \
sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
#else
# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt, ## a)
+ sprintf(comm, fmt, ## a)
#endif
+
+#endif /* _PORTALS_COMPAT_H */
+++ /dev/null
- 0 files changed
-
---- linux-2.4.20-rh/drivers/net/netconsole.c~netconsole_sysrq 2003-04-11 14:04:57.000000000 +0800
-+++ linux-2.4.20-rh-root/drivers/net/netconsole.c 2003-07-01 11:10:26.000000000 +0800
-@@ -988,7 +988,15 @@ static void netconsole_netdump (struct p
- reply.info = 0;
- send_netdump_skb(dev, tmp, strlen(tmp), &reply);
- break;
--
-+ case COMM_SYSRQ:
-+ Dprintk("got SYSRQ command.\n");
-+ printk("netdump: got SYSRQ command %d \n", req->from);
-+ handle_sysrq(req->from, regs, NULL, NULL);
-+ reply.code = REPLY_SYSRQ;
-+ reply.nr = req->nr;
-+ reply.info = req->from;
-+ send_netdump_skb(dev, tmp, strlen(tmp), &reply);
-+ break;
- default:
- reply.code = REPLY_ERROR;
- reply.nr = req->nr;
---- linux-2.4.20-rh/drivers/net/netconsole.h~netconsole_sysrq 2003-04-11 14:04:57.000000000 +0800
-+++ linux-2.4.20-rh-root/drivers/net/netconsole.h 2003-07-01 11:11:29.000000000 +0800
-@@ -42,6 +42,7 @@ enum netdump_commands {
- COMM_START_NETDUMP_ACK = 7,
- COMM_GET_REGS = 8,
- COMM_SHOW_STATE = 9,
-+ COMM_SYSRQ=10,
- };
-
- #define NETDUMP_REQ_SIZE (8+4*4)
-@@ -69,6 +70,7 @@ enum netdump_replies {
- REPLY_REGS = 10,
- REPLY_MAGIC = 11,
- REPLY_SHOW_STATE = 12,
-+ REPLY_SYSRQ=13,
- };
-
- typedef struct netdump_reply_s {
-
-_
+++ /dev/null
- 0 files changed
-
---- linux-2.4.20-rh/drivers/net/tg3.c~tg3_netconsole 2003-04-11 14:04:56.000000000 +0800
-+++ linux-2.4.20-rh-root/drivers/net/tg3.c 2003-07-01 11:27:46.000000000 +0800
-@@ -170,6 +170,10 @@ static void tg3_write_indirect_reg32(str
- }
- }
-
-+#ifdef HAVE_POLL_CONTROLLER
-+static void Poll_tg3(struct net_device *);
-+#endif
-+
- #define tw32(reg,val) tg3_write_indirect_reg32(tp,(reg),(val))
- #define tw32_mailbox(reg, val) writel(((val) & 0xffffffff), tp->regs + (reg))
- #define tw16(reg,val) writew(((val) & 0xffff), tp->regs + (reg))
-@@ -1899,7 +1903,138 @@ static int tg3_vlan_rx(struct tg3 *tp, s
- return vlan_hwaccel_receive_skb(skb, tp->vlgrp, vlan_tag);
- }
- #endif
-+/* for netconsole */
-+static int upcall_rx_hook(struct net_device *dev)
-+{
-+ struct tg3 *tp = dev->priv;
-+ u32 work_mask;
-+ u32 rx_rcb_ptr = tp->rx_rcb_ptr;
-+ u16 hw_idx, sw_idx;
-+ int received;
-+
-+ hw_idx = tp->hw_status->idx[0].rx_producer;
-+ sw_idx = rx_rcb_ptr % TG3_RX_RCB_RING_SIZE;
-+ work_mask = 0;
-+ received = 0;
-+ while (sw_idx != hw_idx) {
-+ struct tg3_rx_buffer_desc *desc = &tp->rx_rcb[sw_idx];
-+ unsigned int len;
-+ struct sk_buff *skb;
-+ dma_addr_t dma_addr;
-+ u32 opaque_key, desc_idx, *post_ptr;
-+
-+ desc_idx = desc->opaque & RXD_OPAQUE_INDEX_MASK;
-+ opaque_key = desc->opaque & RXD_OPAQUE_RING_MASK;
-+ if (opaque_key == RXD_OPAQUE_RING_STD) {
-+ dma_addr = pci_unmap_addr(&tp->rx_std_buffers[desc_idx],
-+ mapping);
-+ skb = tp->rx_std_buffers[desc_idx].skb;
-+ post_ptr = &tp->rx_std_ptr;
-+ } else if (opaque_key == RXD_OPAQUE_RING_JUMBO) {
-+ dma_addr = pci_unmap_addr(&tp->rx_jumbo_buffers[desc_idx],
-+ mapping);
-+ skb = tp->rx_jumbo_buffers[desc_idx].skb;
-+ post_ptr = &tp->rx_jumbo_ptr;
-+ }
-+ else {
-+ goto next_pkt_nopost;
-+ }
-+
-+ work_mask |= opaque_key;
-+
-+ if ((desc->err_vlan & RXD_ERR_MASK) != 0 &&
-+ (desc->err_vlan != RXD_ERR_ODD_NIBBLE_RCVD_MII)) {
-+ drop_it:
-+ tg3_recycle_rx(tp, opaque_key,
-+ desc_idx, *post_ptr);
-+ drop_it_no_recycle:
-+ /* Other statistics kept track of by card. */
-+ tp->net_stats.rx_dropped++;
-+ goto next_pkt;
-+ }
-+
-+ len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) - 4; /* omit crc */
-+
-+ if (len > RX_COPY_THRESHOLD) {
-+ int skb_size;
-+
-+ skb_size = tg3_alloc_rx_skb(tp, opaque_key,
-+ desc_idx, *post_ptr);
-+ if (skb_size < 0)
-+ goto drop_it;
-+
-+ pci_unmap_single(tp->pdev, dma_addr,
-+ skb_size - tp->rx_offset,
-+ PCI_DMA_FROMDEVICE);
-+
-+ skb_put(skb, len);
-+ } else {
-+ struct sk_buff *copy_skb;
-+
-+ tg3_recycle_rx(tp, opaque_key,
-+ desc_idx, *post_ptr);
-+
-+ copy_skb = dev_alloc_skb(len + 2);
-+ if (copy_skb == NULL)
-+ goto drop_it_no_recycle;
-+
-+ copy_skb->dev = tp->dev;
-+ skb_reserve(copy_skb, 2);
-+ skb_put(copy_skb, len);
-+ pci_dma_sync_single(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE);
-+ memcpy(copy_skb->data, skb->data, len);
-+
-+ /* We'll reuse the original ring buffer. */
-+ skb = copy_skb;
-+ }
-+
-+ if ((tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) &&
-+ (desc->type_flags & RXD_FLAG_TCPUDP_CSUM) &&
-+ (((desc->ip_tcp_csum & RXD_TCPCSUM_MASK)
-+ >> RXD_TCPCSUM_SHIFT) == 0xffff))
-+ skb->ip_summed = CHECKSUM_UNNECESSARY;
-+ else
-+ skb->ip_summed = CHECKSUM_NONE;
-+
-+ skb->protocol = eth_type_trans(skb, tp->dev);
-+/*into netconsole driver*/
-+ dev->rx_hook(skb);
-+ kfree_skb(skb);
-+ tp->dev->last_rx = jiffies;
-+ received++;
-+next_pkt:
-+ (*post_ptr)++;
-+next_pkt_nopost:
-+ rx_rcb_ptr++;
-+ sw_idx = rx_rcb_ptr % TG3_RX_RCB_RING_SIZE;
-+ }
-+
-+ /* ACK the status ring. */
-+ tp->rx_rcb_ptr = rx_rcb_ptr;
-+ tw32_mailbox(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW,
-+ (rx_rcb_ptr % TG3_RX_RCB_RING_SIZE));
-+ if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)
-+ tr32(MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW);
-
-+ /* Refill RX ring(s). */
-+ if (work_mask & RXD_OPAQUE_RING_STD) {
-+ sw_idx = tp->rx_std_ptr % TG3_RX_RING_SIZE;
-+ tw32_mailbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW,
-+ sw_idx);
-+ if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)
-+ tr32(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW);
-+ }
-+ if (work_mask & RXD_OPAQUE_RING_JUMBO) {
-+ sw_idx = tp->rx_jumbo_ptr % TG3_RX_JUMBO_RING_SIZE;
-+ tw32_mailbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW,
-+ sw_idx);
-+ if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)
-+ tr32(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW);
-+ }
-+
-+ return received;
-+
-+}
- /* The RX ring scheme is composed of multiple rings which post fresh
- * buffers to the chip, and one special ring the chip uses to report
- * status back to the host.
-@@ -2006,7 +2141,7 @@ static int tg3_rx(struct tg3 *tp, int bu
- /* We'll reuse the original ring buffer. */
- skb = copy_skb;
- }
--
-+
- if ((tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) &&
- (desc->type_flags & RXD_FLAG_TCPUDP_CSUM) &&
- (((desc->ip_tcp_csum & RXD_TCPCSUM_MASK)
-@@ -2016,6 +2151,8 @@ static int tg3_rx(struct tg3 *tp, int bu
- skb->ip_summed = CHECKSUM_NONE;
-
- skb->protocol = eth_type_trans(skb, tp->dev);
-+
-+
- #if TG3_VLAN_TAG_USED
- if (tp->vlgrp != NULL &&
- desc->type_flags & RXD_FLAG_VLAN) {
-@@ -2058,7 +2195,6 @@ next_pkt_nopost:
- if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER)
- tr32(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW);
- }
--
- return received;
- }
-
-@@ -2151,7 +2287,6 @@ static void tg3_interrupt(int irq, void
- unsigned long flags;
-
- spin_lock_irqsave(&tp->lock, flags);
--
- if (sblk->status & SD_STATUS_UPDATED) {
- /*
- * writing any value to intr-mbox-0 clears PCI INTA# and
-@@ -2169,8 +2304,17 @@ static void tg3_interrupt(int irq, void
- tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
- sblk->status &= ~SD_STATUS_UPDATED;
-
-- if (likely(tg3_has_work(dev, tp)))
-- netif_rx_schedule(dev); /* schedule NAPI poll */
-+ if (likely(tg3_has_work(dev, tp))){
-+ if (unlikely(dev->rx_hook != NULL) && netdump_mode) {
-+ int ret;
-+ struct sk_buff *skb;
-+ ret = upcall_rx_hook(dev);
-+ if (!ret){
-+ goto out;
-+ }
-+ }
-+ netif_rx_schedule(dev); /* schedule NAPI poll */
-+ }
- else {
- /* no work, shared interrupt perhaps? re-enable
- * interrupts, and flush that PCI write
-@@ -2180,7 +2324,7 @@ static void tg3_interrupt(int irq, void
- tr32(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW);
- }
- }
--
-+out:
- spin_unlock_irqrestore(&tp->lock, flags);
- }
-
-@@ -6804,7 +6948,10 @@ static int __devinit tg3_init_one(struct
- dev->watchdog_timeo = TG3_TX_TIMEOUT;
- dev->change_mtu = tg3_change_mtu;
- dev->irq = pdev->irq;
--
-+#ifdef HAVE_POLL_CONTROLLER
-+ dev->poll_controller = &Poll_tg3;
-+#endif
-+
- err = tg3_get_invariants(tp);
- if (err) {
- printk(KERN_ERR PFX "Problem fetching invariants of chip, "
-@@ -6882,6 +7029,15 @@ err_out_disable_pdev:
- return err;
- }
-
-+#ifdef HAVE_POLL_CONTROLLER
-+static void Poll_tg3(struct net_device *dev)
-+{
-+ if (!netdump_mode) disable_irq(dev->irq);
-+ tg3_interrupt(dev->irq, dev, NULL);
-+ if (!netdump_mode) enable_irq(dev->irq);
-+}
-+#endif
-+
- static void __devexit tg3_remove_one(struct pci_dev *pdev)
- {
- struct net_device *dev = pci_get_drvdata(pdev);
-
-_
+++ /dev/null
-drivers/net/netconsole.c
-drivers/net/netconsole.h
+++ /dev/null
-drivers/net/tg3.c
+++ /dev/null
-# Copyright (C) 2001 Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-DEFS=
-
-modulefs_DATA = mgmt_svc.o mgmt_cli.o
-EXTRA_PROGRAMS = mgmt_svc mgmt_cli
-
-include $(top_srcdir)/Rules
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Implementation of the management/health monitoring service.
- *
- * Copyright (c) 2003 Cluster File Systems, Inc.
- * Author: Mike Shaver <shaver@clusterfs.com>
- *
- * This file is part of Lustre, http://www.lustre.org.
- *
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define EXPORT_SYMTAB
-#define DEBUG_SUBSYSTEM S_FILTER
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include <linux/obd_class.h>
-#include <linux/lustre_net.h>
-
-#define MGMT_NEVENTS 1024UL
-#define MGMT_NBUFS 128UL
-#define MGMT_BUFSIZE 8192
-#define MGMT_MAXREQSIZE 512
-#define MGMT_NUM_THREADS 4
-#define MGMT_DEVICE_NAME "mgmt"
-
-static int mgmt_initialized;
-static struct ptlrpc_service *mgmt_service;
-
-static int mgmt_ping(struct ptlrpc_request *req)
-{
- /* handle_incoming_request will have already updated the export's
- * last_request_time, so we don't need to do anything else.
- */
- return lustre_pack_msg(0, NULL, NULL, &req->rq_replen, &req->rq_repmsg);
-}
-
-static int mgmt_handler(struct ptlrpc_request *req)
-{
- int rc;
- ENTRY;
-
- switch (req->rq_reqmsg->opc) {
- case OBD_PING:
- DEBUG_REQ(D_RPCTRACE, req, "ping");
- rc = mgmt_ping(req);
- break;
- case MGMT_CONNECT:
- DEBUG_REQ(D_RPCTRACE, req, "connect");
- rc = target_handle_connect(req, NULL /* no recovery handler */);
- break;
- case MGMT_DISCONNECT:
- DEBUG_REQ(D_RPCTRACE, req, "disconnect");
- rc = target_handle_disconnect(req);
- break;
- default:
- DEBUG_REQ(D_RPCTRACE, req, "UNKNOWN OP");
- rc = -EINVAL;
- }
-
- if (rc)
- ptlrpc_error(req);
- else
- ptlrpc_reply(req);
-
- RETURN(0);
-}
-
-static int mgmt_setup(struct obd_device *obd, obd_count len, void *buf)
-{
- int i, rc;
- ENTRY;
-
- if (mgmt_initialized)
- RETURN(-EALREADY);
-
- mgmt_service = ptlrpc_init_svc(MGMT_NEVENTS, MGMT_NBUFS, MGMT_BUFSIZE,
- MGMT_MAXREQSIZE, MGMT_REQUEST_PORTAL,
- MGMT_REPLY_PORTAL, mgmt_handler,
- "mgmt", obd);
- if (!mgmt_service) {
- CERROR("Failed to start mgmt service\n");
- RETURN(-ENOMEM);
- }
-
- for (i = 0; i < MGMT_NUM_THREADS; i++) {
- char name[32];
- sprintf(name, "mgmt_%02d", i);
- rc = ptlrpc_start_thread(obd, mgmt_service, name);
- if (rc) {
- CERROR("failed to start mgmt thread %d: %d\n", i, rc);
- LBUG();
- }
- }
-
- mgmt_initialized = 1;
-
- RETURN(0);
-}
-
-static int mgmt_cleanup(struct obd_device *obd, int flags)
-{
- ENTRY;
-
- if (!mgmt_initialized)
- RETURN(-ENOENT);
-
- ptlrpc_stop_all_threads(mgmt_service);
- ptlrpc_unregister_service(mgmt_service);
-
- mgmt_initialized = 0;
- RETURN(0);
-}
-
-static struct obd_ops mgmt_obd_ops = {
- o_owner: THIS_MODULE,
- o_setup: mgmt_setup,
- o_cleanup: mgmt_cleanup,
- o_connect: class_connect,
- o_disconnect: class_disconnect
-};
-
-static int __init mgmt_init(void)
-{
- int rc = class_register_type(&mgmt_obd_ops, 0, MGMT_DEVICE_NAME);
-
- return rc;
-}
-
-static void __exit mgmt_exit(void)
-{
- class_unregister_type(MGMT_DEVICE_NAME);
-}
-
-#ifdef __KERNEL__
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre monitoring service v0.1");
-MODULE_LICENSE("GPL");
-
-module_init(mgmt_init);
-module_exit(mgmt_exit);
-#endif
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+#ifndef _PORTALS_COMPAT_H
+#define _PORTALS_COMPAT_H
+
// XXX BUG 1511 -- remove this stanza and all callers when bug 1511 is resolved
#if SPINLOCK_DEBUG
# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) || defined(CONFIG_RH_2_4_20)
// XXX BUG 1511 -- remove this stanza and all callers when bug 1511 is resolved
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) || defined(CONFIG_RH_2_4_20)
-# define SIGNAL_MASK_LOCK(task, flags) \
+
+# define SIGNAL_MASK_LOCK(task, flags) \
spin_lock_irqsave(&task->sighand->siglock, flags)
-# define SIGNAL_MASK_UNLOCK(task, flags) \
+# define SIGNAL_MASK_UNLOCK(task, flags) \
spin_unlock_irqrestore(&task->sighand->siglock, flags)
+# define USERMODEHELPER(path, argv, envp) \
+ call_usermodehelper(path, argv, envp, 1)
# define RECALC_SIGPENDING recalc_sigpending()
-#else
-# define SIGNAL_MASK_LOCK(task, flags) \
+# define CURRENT_SECONDS get_seconds()
+
+#else /* 2.4.x */
+
+# define SIGNAL_MASK_LOCK(task, flags) \
spin_lock_irqsave(&task->sigmask_lock, flags)
-# define SIGNAL_MASK_UNLOCK(task, flags) \
+# define SIGNAL_MASK_UNLOCK(task, flags) \
spin_unlock_irqrestore(&task->sigmask_lock, flags)
+# define USERMODEHELPER(path, argv, envp) \
+ call_usermodehelper(path, argv, envp)
# define RECALC_SIGPENDING recalc_sigpending(current)
+# define CURRENT_SECONDS CURRENT_TIME
+
#endif
#if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
-# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
+# define THREAD_NAME(comm, fmt, a...) \
+ sprintf(comm, fmt "|%d", ## a, current->thread.extern_pid)
#elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# define THREAD_NAME(comm, fmt, a...) \
+# define THREAD_NAME(comm, fmt, a...) \
sprintf(comm, fmt "|%d", ## a, current->thread.mode.tt.extern_pid)
#else
# define THREAD_NAME(comm, fmt, a...) \
- sprintf(comm, fmt, ## a)
+ sprintf(comm, fmt, ## a)
#endif
+
+#endif /* _PORTALS_COMPAT_H */