Beispiel #1
0
/*
  Process the upper socket ioctl command
*/
static int dmfe_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
	board_info_t *db = (board_info_t *)dev->priv;
	#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) /* for kernel 2.6.7 */
    struct mii_ioctl_data *data=(struct mii_ioctl_data *)&ifr->ifr_data; 
	#endif
  int rc=0;
    	
	DMFE_DBUG(0, "dmfe_do_ioctl()", 0);
	
    	if (!netif_running(dev))
    		return -EINVAL;

    	if (cmd == SIOCETHTOOL)
        rc = dmfe_ethtool_ioctl(dev, (void *) ifr->ifr_data);
	else {
		spin_lock_irq(&db->lock);
		#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) /* for kernel 2.6.7 */
			rc = generic_mii_ioctl(&db->mii, data, cmd, NULL);
		#else
			rc = generic_mii_ioctl(&db->mii, if_mii(ifr), cmd, NULL);
		#endif
		spin_unlock_irq(&db->lock);
	}

	return rc;
}
Beispiel #2
0
/* optional */
static int ftmac100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
{
	struct ftmac100 *priv = netdev_priv(netdev);
	struct mii_ioctl_data *data = if_mii(ifr);

	return generic_mii_ioctl(&priv->mii, data, cmd, NULL);
}
Beispiel #3
0
static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
	struct mii_ioctl_data *data = if_mii(ifr);
	struct b44 *bp = netdev_priv(dev);
	int err;

	spin_lock_irq(&bp->lock);
	err = generic_mii_ioctl(&bp->mii_if, data, cmd, NULL);
	spin_unlock_irq(&bp->lock);

	return err;
}
Beispiel #4
0
static int enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
	struct tangox_enet_priv *priv;
	int ret;

	priv = netdev_priv(dev);

	spin_lock_bh(&priv->mii);
	ret = generic_mii_ioctl(&priv->mii, if_mii(rq), cmd, NULL);
	spin_unlock_bh(&priv->mii);

	return ret;
}
Beispiel #5
0
int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
	struct octeon_ethernet *priv = netdev_priv(dev);
	struct mii_ioctl_data *data = if_mii(rq);
	unsigned int duplex_chg;
	int ret;

	down(&mdio_sem);
	ret = generic_mii_ioctl(&priv->mii_info, data, cmd, &duplex_chg);
	up(&mdio_sem);

	return ret;
}
Beispiel #6
0
static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{
	struct cp_private *cp = netdev_priv(dev);
	int rc;
	unsigned long flags;

	if (!netif_running(dev))
		return -EINVAL;

	spin_lock_irqsave(&cp->lock, flags);
	rc = generic_mii_ioctl(&cp->mii_if, if_mii(rq), cmd, NULL);
	spin_unlock_irqrestore(&cp->lock, flags);
	return rc;
}
Beispiel #7
0
static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
	struct fs_enet_private *fep = netdev_priv(dev);
	struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&rq->ifr_data;
	unsigned long flags;
	int rc;

	if (!netif_running(dev))
		return -EINVAL;

	spin_lock_irqsave(&fep->lock, flags);
	rc = generic_mii_ioctl(&fep->mii_if, mii, cmd, NULL);
	spin_unlock_irqrestore(&fep->lock, flags);
	return rc;
}
Beispiel #8
0
static int gt64240_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
	struct gt64240_private *gp = netdev_priv(dev);
	struct mii_ioctl_data *data =
	    (struct mii_ioctl_data *) &rq->ifr_data;
	int retval;

	if (!netif_running(dev))
		return -EINVAL;

	spin_lock_irq(&gp->lock);
	retval = generic_mii_ioctl(&gp->mii_if, data, cmd, NULL);
	spin_unlock_irq(&gp->lock);

	return retval;
}
Beispiel #9
0
static int wrn_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
	struct wrn_ep *ep = netdev_priv(dev);
	int res;
	u32 reg;

	switch (cmd) {
	case SIOCSHWTSTAMP:
		return wrn_tstamp_ioctl(dev, rq, cmd);
	case PRIV_IOCGCALIBRATE:
		return wrn_calib_ioctl(dev, rq, cmd);
	case PRIV_IOCGGETPHASE:
		return wrn_phase_ioctl(dev, rq, cmd);
	case PRIV_IOCREADREG:
		if (get_user(reg, (u32 *)rq->ifr_data) < 0)
			return -EFAULT;
		if (reg > sizeof(struct EP_WB) || reg & 3)
			return -EINVAL;
		reg = readl((void *)ep->ep_regs + reg);
		if (put_user(reg, (u32 *)rq->ifr_data) < 0)
			return -EFAULT;
		return 0;
	case PRIV_IOCPHYREG:
		/* this command allows to read and write a phy register */
		if (get_user(reg, (u32 *)rq->ifr_data) < 0)
			return -EFAULT;
		if (reg & (1<<31)) {
			wrn_phy_write(dev, 0, (reg >> 16) & 0xff,
				      reg & 0xffff);
			return 0;
		}
		reg = wrn_phy_read(dev, 0, (reg >> 16) & 0xff);
		if (put_user(reg, (u32 *)rq->ifr_data) < 0)
			return -EFAULT;
		return 0;

	default:
		spin_lock_irq(&ep->lock);
		res = generic_mii_ioctl(&ep->mii, if_mii(rq), cmd, NULL);
		spin_unlock_irq(&ep->lock);
		return res;
	}
Beispiel #10
0
static int bcm_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
	struct bcm_enet_priv *priv;

	priv = netdev_priv(dev);
	if (priv->has_phy) {
		if (!priv->phydev)
			return -ENODEV;
		return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
	} else {
		struct mii_if_info mii;

		mii.dev = dev;
		mii.mdio_read = bcm_enet_mdio_read_mii;
		mii.mdio_write = bcm_enet_mdio_write_mii;
		mii.phy_id = 0;
		mii.phy_id_mask = 0x3f;
		mii.reg_num_mask = 0x1f;
		return generic_mii_ioctl(&mii, if_mii(rq), cmd, NULL);
	}
}
Beispiel #11
0
static int qf9700_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
{
	struct usbnet *dev = netdev_priv(net);

	return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
}