s390/qeth: move common ioctl handling to core
There's a number of layer-independent ioctls that we can handle in core, and reduce code duplication. For layer-specific ioctls, add a do_ioctl() discipline hook. Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com> Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
40077e0cf6
commit
942d6984aa
@@ -16,7 +16,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/hash.h>
|
||||
@@ -34,56 +33,6 @@ static void qeth_bridge_state_change(struct qeth_card *card,
|
||||
static void qeth_bridge_host_event(struct qeth_card *card,
|
||||
struct qeth_ipa_cmd *cmd);
|
||||
|
||||
static int qeth_l2_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
{
|
||||
struct qeth_card *card = dev->ml_priv;
|
||||
struct mii_ioctl_data *mii_data;
|
||||
int rc = 0;
|
||||
|
||||
if (!card)
|
||||
return -ENODEV;
|
||||
|
||||
if (!qeth_card_hw_is_reachable(card))
|
||||
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_OSD ||
|
||||
card->info.type == QETH_CARD_TYPE_OSM ||
|
||||
card->info.type == QETH_CARD_TYPE_OSX) &&
|
||||
!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;
|
||||
case SIOC_QETH_QUERY_OAT:
|
||||
rc = qeth_query_oat_command(card, rq->ifr_ifru.ifru_data);
|
||||
break;
|
||||
default:
|
||||
rc = -EOPNOTSUPP;
|
||||
}
|
||||
if (rc)
|
||||
QETH_CARD_TEXT_(card, 2, "ioce%d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int qeth_l2_verify_dev(struct net_device *dev)
|
||||
{
|
||||
struct qeth_card *card;
|
||||
@@ -1059,7 +1008,7 @@ static const struct net_device_ops qeth_l2_netdev_ops = {
|
||||
.ndo_start_xmit = qeth_l2_hard_start_xmit,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_rx_mode = qeth_l2_set_rx_mode,
|
||||
.ndo_do_ioctl = qeth_l2_do_ioctl,
|
||||
.ndo_do_ioctl = qeth_do_ioctl,
|
||||
.ndo_set_mac_address = qeth_l2_set_mac_address,
|
||||
.ndo_change_mtu = qeth_change_mtu,
|
||||
.ndo_vlan_rx_add_vid = qeth_l2_vlan_rx_add_vid,
|
||||
@@ -1417,6 +1366,7 @@ struct qeth_discipline qeth_l2_discipline = {
|
||||
.freeze = qeth_l2_pm_suspend,
|
||||
.thaw = qeth_l2_pm_resume,
|
||||
.restore = qeth_l2_pm_resume,
|
||||
.do_ioctl = NULL,
|
||||
.control_event_handler = qeth_l2_control_event,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(qeth_l2_discipline);
|
||||
|
Reference in New Issue
Block a user