]> err.no Git - linux-2.6/blobdiff - drivers/s390/net/netiucv.c
Merge branch 'for-2.6.26' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer...
[linux-2.6] / drivers / s390 / net / netiucv.c
index f3d893cfe61d4339799bb91ab9db5fb5f9698e75..e4ba6a0372acb6360124839afe6e651c1a6cec87 100644 (file)
@@ -97,12 +97,22 @@ MODULE_DESCRIPTION ("Linux for S/390 IUCV network driver");
 
 DECLARE_PER_CPU(char[256], iucv_dbf_txt_buf);
 
-#define IUCV_DBF_TEXT_(name,level,text...)                             \
-       do {                                                            \
-               char* iucv_dbf_txt_buf = get_cpu_var(iucv_dbf_txt_buf); \
-               sprintf(iucv_dbf_txt_buf, text);                        \
-               debug_text_event(iucv_dbf_##name,level,iucv_dbf_txt_buf); \
-               put_cpu_var(iucv_dbf_txt_buf);                          \
+/* Allow to sort out low debug levels early to avoid wasted sprints */
+static inline int iucv_dbf_passes(debug_info_t *dbf_grp, int level)
+{
+       return (level <= dbf_grp->level);
+}
+
+#define IUCV_DBF_TEXT_(name, level, text...) \
+       do { \
+               if (iucv_dbf_passes(iucv_dbf_##name, level)) { \
+                       char* iucv_dbf_txt_buf = \
+                                       get_cpu_var(iucv_dbf_txt_buf); \
+                       sprintf(iucv_dbf_txt_buf, text); \
+                       debug_text_event(iucv_dbf_##name, level, \
+                                               iucv_dbf_txt_buf); \
+                       put_cpu_var(iucv_dbf_txt_buf); \
+               } \
        } while (0)
 
 #define IUCV_DBF_SPRINTF(name,level,text...) \
@@ -137,6 +147,7 @@ PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
 #define PRINTK_HEADER " iucv: "       /* for debugging */
 
 static struct device_driver netiucv_driver = {
+       .owner = THIS_MODULE,
        .name = "netiucv",
        .bus  = &iucv_bus,
 };
@@ -572,9 +583,9 @@ static void netiucv_callback_connres(struct iucv_path *path, u8 ipuser[16])
 }
 
 /**
- * Dummy NOP action for all statemachines
+ * NOP action for statemachines
  */
-static void fsm_action_nop(fsm_instance *fi, int event, void *arg)
+static void netiucv_action_nop(fsm_instance *fi, int event, void *arg)
 {
 }
 
@@ -659,7 +670,7 @@ static void conn_action_rx(fsm_instance *fi, int event, void *arg)
        struct netiucv_priv *privptr = netdev_priv(conn->netdev);
        int rc;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
 
        if (!conn->netdev) {
                iucv_message_reject(conn->path, msg);
@@ -707,7 +718,7 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg)
        struct ll_header header;
        int rc;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
 
        if (conn && conn->netdev)
                privptr = netdev_priv(conn->netdev);
@@ -788,7 +799,7 @@ static void conn_action_connaccept(fsm_instance *fi, int event, void *arg)
        struct netiucv_priv *privptr = netdev_priv(netdev);
        int rc;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        conn->path = path;
        path->msglim = NETIUCV_QUEUELEN_DEFAULT;
@@ -810,7 +821,7 @@ static void conn_action_connreject(fsm_instance *fi, int event, void *arg)
        struct iucv_event *ev = arg;
        struct iucv_path *path = ev->data;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        iucv_path_sever(path, NULL);
 }
 
@@ -820,7 +831,7 @@ static void conn_action_connack(fsm_instance *fi, int event, void *arg)
        struct net_device *netdev = conn->netdev;
        struct netiucv_priv *privptr = netdev_priv(netdev);
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        fsm_deltimer(&conn->timer);
        fsm_newstate(fi, CONN_STATE_IDLE);
        netdev->tx_queue_len = conn->path->msglim;
@@ -831,7 +842,7 @@ static void conn_action_conntimsev(fsm_instance *fi, int event, void *arg)
 {
        struct iucv_connection *conn = arg;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        fsm_deltimer(&conn->timer);
        iucv_path_sever(conn->path, NULL);
        fsm_newstate(fi, CONN_STATE_STARTWAIT);
@@ -843,7 +854,7 @@ static void conn_action_connsever(fsm_instance *fi, int event, void *arg)
        struct net_device *netdev = conn->netdev;
        struct netiucv_priv *privptr = netdev_priv(netdev);
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        fsm_deltimer(&conn->timer);
        iucv_path_sever(conn->path, NULL);
@@ -859,7 +870,7 @@ static void conn_action_start(fsm_instance *fi, int event, void *arg)
        struct iucv_connection *conn = arg;
        int rc;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        fsm_newstate(fi, CONN_STATE_STARTWAIT);
        PRINT_DEBUG("%s('%s'): connecting ...\n",
@@ -937,7 +948,7 @@ static void conn_action_stop(fsm_instance *fi, int event, void *arg)
        struct net_device *netdev = conn->netdev;
        struct netiucv_priv *privptr = netdev_priv(netdev);
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        fsm_deltimer(&conn->timer);
        fsm_newstate(fi, CONN_STATE_STOPPED);
@@ -1013,7 +1024,7 @@ static void dev_action_start(fsm_instance *fi, int event, void *arg)
        struct net_device   *dev = arg;
        struct netiucv_priv *privptr = netdev_priv(dev);
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        fsm_newstate(fi, DEV_STATE_STARTWAIT);
        fsm_event(privptr->conn->fsm, CONN_EVENT_START, privptr->conn);
@@ -1033,7 +1044,7 @@ dev_action_stop(fsm_instance *fi, int event, void *arg)
        struct netiucv_priv *privptr = netdev_priv(dev);
        struct iucv_event   ev;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        ev.conn = privptr->conn;
 
@@ -1055,7 +1066,7 @@ dev_action_connup(fsm_instance *fi, int event, void *arg)
        struct net_device   *dev = arg;
        struct netiucv_priv *privptr = netdev_priv(dev);
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        switch (fsm_getstate(fi)) {
                case DEV_STATE_STARTWAIT:
@@ -1086,7 +1097,7 @@ dev_action_connup(fsm_instance *fi, int event, void *arg)
 static void
 dev_action_conndown(fsm_instance *fi, int event, void *arg)
 {
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        switch (fsm_getstate(fi)) {
                case DEV_STATE_RUNNING:
@@ -1110,7 +1121,7 @@ static const fsm_node dev_fsm[] = {
 
        { DEV_STATE_RUNNING,    DEV_EVENT_STOP,    dev_action_stop     },
        { DEV_STATE_RUNNING,    DEV_EVENT_CONDOWN, dev_action_conndown },
-       { DEV_STATE_RUNNING,    DEV_EVENT_CONUP,   fsm_action_nop      },
+       { DEV_STATE_RUNNING,    DEV_EVENT_CONUP,   netiucv_action_nop  },
 };
 
 static const int DEV_FSM_LEN = sizeof(dev_fsm) / sizeof(fsm_node);
@@ -1277,7 +1288,7 @@ static int netiucv_tx(struct sk_buff *skb, struct net_device *dev)
        struct netiucv_priv *privptr = netdev_priv(dev);
        int rc;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
        /**
         * Some sanity checks ...
         */
@@ -1302,8 +1313,6 @@ static int netiucv_tx(struct sk_buff *skb, struct net_device *dev)
         * and throw away packet.
         */
        if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) {
-               if (!in_atomic())
-                       fsm_event(privptr->fsm, DEV_EVENT_START, dev);
                dev_kfree_skb(skb);
                privptr->stats.tx_dropped++;
                privptr->stats.tx_errors++;
@@ -1333,7 +1342,7 @@ static struct net_device_stats *netiucv_stats (struct net_device * dev)
 {
        struct netiucv_priv *priv = netdev_priv(dev);
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return &priv->stats;
 }
 
@@ -1349,7 +1358,7 @@ static struct net_device_stats *netiucv_stats (struct net_device * dev)
  */
 static int netiucv_change_mtu(struct net_device * dev, int new_mtu)
 {
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        if (new_mtu < 576 || new_mtu > NETIUCV_MTU_MAX) {
                IUCV_DBF_TEXT(setup, 2, "given MTU out of valid range\n");
                return -EINVAL;
@@ -1367,7 +1376,7 @@ static ssize_t user_show(struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%s\n", netiucv_printname(priv->conn->userid));
 }
 
@@ -1382,7 +1391,7 @@ static ssize_t user_write(struct device *dev, struct device_attribute *attr,
        int     i;
        struct iucv_connection *cp;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        if (count > 9) {
                PRINT_WARN("netiucv: username too long (%d)!\n", (int) count);
                IUCV_DBF_TEXT_(setup, 2,
@@ -1438,7 +1447,7 @@ static ssize_t buffer_show (struct device *dev, struct device_attribute *attr,
                            char *buf)
 {      struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%d\n", priv->conn->max_buffsize);
 }
 
@@ -1450,7 +1459,7 @@ static ssize_t buffer_write (struct device *dev, struct device_attribute *attr,
        char         *e;
        int          bs1;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        if (count >= 39)
                return -EINVAL;
 
@@ -1502,7 +1511,7 @@ static ssize_t dev_fsm_show (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%s\n", fsm_getstate_str(priv->fsm));
 }
 
@@ -1513,7 +1522,7 @@ static ssize_t conn_fsm_show (struct device *dev,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%s\n", fsm_getstate_str(priv->conn->fsm));
 }
 
@@ -1524,7 +1533,7 @@ static ssize_t maxmulti_show (struct device *dev,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti);
 }
 
@@ -1534,7 +1543,7 @@ static ssize_t maxmulti_write (struct device *dev,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
        priv->conn->prof.maxmulti = 0;
        return count;
 }
@@ -1546,7 +1555,7 @@ static ssize_t maxcq_show (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue);
 }
 
@@ -1555,7 +1564,7 @@ static ssize_t maxcq_write (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
        priv->conn->prof.maxcqueue = 0;
        return count;
 }
@@ -1567,7 +1576,7 @@ static ssize_t sdoio_show (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%ld\n", priv->conn->prof.doios_single);
 }
 
@@ -1576,7 +1585,7 @@ static ssize_t sdoio_write (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
        priv->conn->prof.doios_single = 0;
        return count;
 }
@@ -1588,7 +1597,7 @@ static ssize_t mdoio_show (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi);
 }
 
@@ -1597,7 +1606,7 @@ static ssize_t mdoio_write (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        priv->conn->prof.doios_multi = 0;
        return count;
 }
@@ -1609,7 +1618,7 @@ static ssize_t txlen_show (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%ld\n", priv->conn->prof.txlen);
 }
 
@@ -1618,7 +1627,7 @@ static ssize_t txlen_write (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
        priv->conn->prof.txlen = 0;
        return count;
 }
@@ -1630,7 +1639,7 @@ static ssize_t txtime_show (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%ld\n", priv->conn->prof.tx_time);
 }
 
@@ -1639,7 +1648,7 @@ static ssize_t txtime_write (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
        priv->conn->prof.tx_time = 0;
        return count;
 }
@@ -1651,7 +1660,7 @@ static ssize_t txpend_show (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%ld\n", priv->conn->prof.tx_pending);
 }
 
@@ -1660,7 +1669,7 @@ static ssize_t txpend_write (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
        priv->conn->prof.tx_pending = 0;
        return count;
 }
@@ -1672,7 +1681,7 @@ static ssize_t txmpnd_show (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 5, __func__);
        return sprintf(buf, "%ld\n", priv->conn->prof.tx_max_pending);
 }
 
@@ -1681,7 +1690,7 @@ static ssize_t txmpnd_write (struct device *dev, struct device_attribute *attr,
 {
        struct netiucv_priv *priv = dev->driver_data;
 
-       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __func__);
        priv->conn->prof.tx_max_pending = 0;
        return count;
 }
@@ -1721,7 +1730,7 @@ static int netiucv_add_files(struct device *dev)
 {
        int ret;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        ret = sysfs_create_group(&dev->kobj, &netiucv_attr_group);
        if (ret)
                return ret;
@@ -1733,7 +1742,7 @@ static int netiucv_add_files(struct device *dev)
 
 static void netiucv_remove_files(struct device *dev)
 {
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        sysfs_remove_group(&dev->kobj, &netiucv_stat_attr_group);
        sysfs_remove_group(&dev->kobj, &netiucv_attr_group);
 }
@@ -1745,7 +1754,7 @@ static int netiucv_register_device(struct net_device *ndev)
        int ret;
 
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        if (dev) {
                snprintf(dev->bus_id, BUS_ID_SIZE, "net%s", ndev->name);
@@ -1781,7 +1790,7 @@ out_unreg:
 
 static void netiucv_unregister_device(struct device *dev)
 {
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        netiucv_remove_files(dev);
        device_unregister(dev);
 }
@@ -1846,7 +1855,7 @@ out:
  */
 static void netiucv_remove_connection(struct iucv_connection *conn)
 {
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        write_lock_bh(&iucv_connection_rwlock);
        list_del_init(&conn->list);
        write_unlock_bh(&iucv_connection_rwlock);
@@ -1870,7 +1879,7 @@ static void netiucv_free_netdevice(struct net_device *dev)
 {
        struct netiucv_priv *privptr = netdev_priv(dev);
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
        if (!dev)
                return;
@@ -1952,7 +1961,7 @@ static ssize_t conn_write(struct device_driver *drv,
        struct netiucv_priv *priv;
        struct iucv_connection *cp;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        if (count>9) {
                PRINT_WARN("netiucv: username too long (%d)!\n", (int)count);
                IUCV_DBF_TEXT(setup, 2, "conn_write: too long\n");
@@ -2037,7 +2046,7 @@ static ssize_t remove_write (struct device_driver *drv,
        const char *p;
         int i;
 
-        IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
 
         if (count >= IFNAMSIZ)
                 count = IFNAMSIZ - 1;;
@@ -2105,7 +2114,7 @@ static void __exit netiucv_exit(void)
        struct netiucv_priv *priv;
        struct device *dev;
 
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        while (!list_empty(&iucv_connection_list)) {
                cp = list_entry(iucv_connection_list.next,
                                struct iucv_connection, list);
@@ -2135,7 +2144,7 @@ static int __init netiucv_init(void)
        rc = iucv_register(&netiucv_handler, 1);
        if (rc)
                goto out_dbf;
-       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __func__);
        netiucv_driver.groups = netiucv_drv_attr_groups;
        rc = driver_register(&netiucv_driver);
        if (rc) {