/*
* drivers/s390/net/qeth_l2_main.c
*
* Copyright IBM Corp. 2007
* Author(s): Utz Bacher <utz.bacher@de.ibm.com>,
* Frank Pavlic <fpavlic@de.ibm.com>,
* Thomas Spatzier <tspat@de.ibm.com>,
* Frank Blaschka <frank.blaschka@de.ibm.com>
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/etherdevice.h>
#include <linux/mii.h>
#include <linux/ip.h>
#include <asm/s390_rdev.h>
#include "qeth_core.h"
#include "qeth_core_offl.h"
static int qeth_l2_set_offline(struct ccwgroup_device *);
static int qeth_l2_stop(struct net_device *);
static int qeth_l2_send_delmac(struct qeth_card *, __u8 *);
static int qeth_l2_send_setdelmac(struct qeth_card *, __u8 *,
enum qeth_ipa_cmds,
int (*reply_cb) (struct qeth_card *,
struct qeth_reply*,
unsigned long));
static void qeth_l2_set_multicast_list(struct net_device *);
static int qeth_l2_recover(void *);
static int qeth_l2_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct qeth_card *card = netdev_priv(dev);
struct mii_ioctl_data *mii_data;
int rc = 0;
if (!card)
return -ENODEV;
if ((card->state != CARD_STATE_UP) &&
(card->state != CARD_STATE_SOFTSETUP))
return -ENODEV;
if (card->info.type == QETH_CARD_TYPE_OSN)
return -EPERM;
switch (cmd) {
case SIOC_QETH_ADP_SET_SNMP_CONTROL:
rc = qeth_snmp_command(card, rq->ifr_ifru.ifru_data);
break;
case SIOC_QETH_GET_CARD_TYPE:
if ((card->info.type == QETH_CARD_TYPE_OSAE) &&
!card->info.guestlan)
return 1;
return 0;
break;
case SIOCGMIIPHY:
mii_data = if_mii(rq);
mii_data->phy_id = 0;
break;
case SIOCGMIIREG:
mii_data = if_mii(rq);
if (mii_data->phy_id != 0)
rc = -EINVAL;
else
mii_data->val_out = qeth_mdio_read(dev,
mii_data->phy_id, mii_data->reg_num);
break;
default:
rc = -EOPNOTSUPP;
}
if (rc)
QETH_DBF_TEXT_(TRACE, 2, "ioce%d", rc);
return rc;
}
static int qeth_l2_verify_dev(struct net_device *dev)
{
struct qeth_card *card;
unsigned long flags;
int rc = 0;
read_lock_irqsave(