Lines Matching refs:ifr

21 static int dev_ifname(struct net *net, struct ifreq *ifr)  in dev_ifname()  argument
23 ifr->ifr_name[IFNAMSIZ-1] = 0; in dev_ifname()
24 return netdev_get_name(net, ifr->ifr_name, ifr->ifr_ifindex); in dev_ifname()
103 static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cmd) in dev_ifsioc_locked() argument
106 struct net_device *dev = dev_get_by_name_rcu(net, ifr->ifr_name); in dev_ifsioc_locked()
113 ifr->ifr_flags = (short) dev_get_flags(dev); in dev_ifsioc_locked()
118 ifr->ifr_metric = 0; in dev_ifsioc_locked()
122 ifr->ifr_mtu = dev->mtu; in dev_ifsioc_locked()
127 memset(ifr->ifr_hwaddr.sa_data, 0, in dev_ifsioc_locked()
128 sizeof(ifr->ifr_hwaddr.sa_data)); in dev_ifsioc_locked()
130 memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, in dev_ifsioc_locked()
131 min(sizeof(ifr->ifr_hwaddr.sa_data), in dev_ifsioc_locked()
133 ifr->ifr_hwaddr.sa_family = dev->type; in dev_ifsioc_locked()
141 ifr->ifr_map.mem_start = dev->mem_start; in dev_ifsioc_locked()
142 ifr->ifr_map.mem_end = dev->mem_end; in dev_ifsioc_locked()
143 ifr->ifr_map.base_addr = dev->base_addr; in dev_ifsioc_locked()
144 ifr->ifr_map.irq = dev->irq; in dev_ifsioc_locked()
145 ifr->ifr_map.dma = dev->dma; in dev_ifsioc_locked()
146 ifr->ifr_map.port = dev->if_port; in dev_ifsioc_locked()
150 ifr->ifr_ifindex = dev->ifindex; in dev_ifsioc_locked()
154 ifr->ifr_qlen = dev->tx_queue_len; in dev_ifsioc_locked()
169 static int net_hwtstamp_validate(struct ifreq *ifr) in net_hwtstamp_validate() argument
177 if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) in net_hwtstamp_validate()
224 static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) in dev_ifsioc() argument
227 struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); in dev_ifsioc()
237 return dev_change_flags(dev, ifr->ifr_flags); in dev_ifsioc()
244 return dev_set_mtu(dev, ifr->ifr_mtu); in dev_ifsioc()
249 return dev_set_mac_address(dev, &ifr->ifr_hwaddr); in dev_ifsioc()
252 if (ifr->ifr_hwaddr.sa_family != dev->type) in dev_ifsioc()
254 memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, in dev_ifsioc()
255 min(sizeof(ifr->ifr_hwaddr.sa_data), in dev_ifsioc()
264 return ops->ndo_set_config(dev, &ifr->ifr_map); in dev_ifsioc()
270 ifr->ifr_hwaddr.sa_family != AF_UNSPEC) in dev_ifsioc()
274 return dev_mc_add_global(dev, ifr->ifr_hwaddr.sa_data); in dev_ifsioc()
278 ifr->ifr_hwaddr.sa_family != AF_UNSPEC) in dev_ifsioc()
282 return dev_mc_del_global(dev, ifr->ifr_hwaddr.sa_data); in dev_ifsioc()
285 if (ifr->ifr_qlen < 0) in dev_ifsioc()
287 return dev_change_tx_queue_len(dev, ifr->ifr_qlen); in dev_ifsioc()
290 ifr->ifr_newname[IFNAMSIZ-1] = '\0'; in dev_ifsioc()
291 return dev_change_name(dev, ifr->ifr_newname); in dev_ifsioc()
294 err = net_hwtstamp_validate(ifr); in dev_ifsioc()
322 err = ops->ndo_do_ioctl(dev, ifr, cmd); in dev_ifsioc()
377 int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr, bool *need_copyout) in dev_ioctl() argument
385 return dev_ifname(net, ifr); in dev_ioctl()
387 ifr->ifr_name[IFNAMSIZ-1] = 0; in dev_ioctl()
389 colon = strchr(ifr->ifr_name, ':'); in dev_ioctl()
412 dev_load(net, ifr->ifr_name); in dev_ioctl()
414 ret = dev_ifsioc_locked(net, ifr, cmd); in dev_ioctl()
421 dev_load(net, ifr->ifr_name); in dev_ioctl()
423 ret = dev_ethtool(net, ifr); in dev_ioctl()
438 dev_load(net, ifr->ifr_name); in dev_ioctl()
442 ret = dev_ifsioc(net, ifr, cmd); in dev_ioctl()
486 dev_load(net, ifr->ifr_name); in dev_ioctl()
488 ret = dev_ifsioc(net, ifr, cmd); in dev_ioctl()
511 dev_load(net, ifr->ifr_name); in dev_ioctl()
513 ret = dev_ifsioc(net, ifr, cmd); in dev_ioctl()