Lines Matching +full:cfg +full:- +full:space

1 // SPDX-License-Identifier: GPL-2.0
24 * match. --pb
29 ifr->ifr_name[IFNAMSIZ-1] = 0; in dev_ifname()
30 return netdev_get_name(net, ifr->ifr_name, ifr->ifr_ifindex); in dev_ifname()
50 return -EFAULT; in dev_ifconf()
59 return -EFAULT; in dev_ifconf()
73 len - total, size); in dev_ifconf()
76 return -EFAULT; in dev_ifconf()
82 return put_user(total, &uifc->ifc_len); in dev_ifconf()
87 struct ifmap *ifmap = &ifr->ifr_map; in dev_getifmap()
92 cifmap->mem_start = dev->mem_start; in dev_getifmap()
93 cifmap->mem_end = dev->mem_end; in dev_getifmap()
94 cifmap->base_addr = dev->base_addr; in dev_getifmap()
95 cifmap->irq = dev->irq; in dev_getifmap()
96 cifmap->dma = dev->dma; in dev_getifmap()
97 cifmap->port = dev->if_port; in dev_getifmap()
102 ifmap->mem_start = dev->mem_start; in dev_getifmap()
103 ifmap->mem_end = dev->mem_end; in dev_getifmap()
104 ifmap->base_addr = dev->base_addr; in dev_getifmap()
105 ifmap->irq = dev->irq; in dev_getifmap()
106 ifmap->dma = dev->dma; in dev_getifmap()
107 ifmap->port = dev->if_port; in dev_getifmap()
114 struct compat_ifmap *cifmap = (struct compat_ifmap *)&ifr->ifr_map; in dev_setifmap()
116 if (!dev->netdev_ops->ndo_set_config) in dev_setifmap()
117 return -EOPNOTSUPP; in dev_setifmap()
121 .mem_start = cifmap->mem_start, in dev_setifmap()
122 .mem_end = cifmap->mem_end, in dev_setifmap()
123 .base_addr = cifmap->base_addr, in dev_setifmap()
124 .irq = cifmap->irq, in dev_setifmap()
125 .dma = cifmap->dma, in dev_setifmap()
126 .port = cifmap->port, in dev_setifmap()
129 return dev->netdev_ops->ndo_set_config(dev, &ifmap); in dev_setifmap()
132 return dev->netdev_ops->ndo_set_config(dev, &ifr->ifr_map); in dev_setifmap()
141 struct net_device *dev = dev_get_by_name_rcu(net, ifr->ifr_name); in dev_ifsioc_locked()
144 return -ENODEV; in dev_ifsioc_locked()
148 ifr->ifr_flags = (short) dev_get_flags(dev); in dev_ifsioc_locked()
153 ifr->ifr_metric = 0; in dev_ifsioc_locked()
157 ifr->ifr_mtu = dev->mtu; in dev_ifsioc_locked()
161 err = -EINVAL; in dev_ifsioc_locked()
168 ifr->ifr_ifindex = dev->ifindex; in dev_ifsioc_locked()
172 ifr->ifr_qlen = dev->tx_queue_len; in dev_ifsioc_locked()
180 err = -ENOTTY; in dev_ifsioc_locked()
187 static int net_hwtstamp_validate(const struct kernel_hwtstamp_config *cfg) in net_hwtstamp_validate() argument
194 if (cfg->flags & ~HWTSTAMP_FLAG_MASK) in net_hwtstamp_validate()
195 return -EINVAL; in net_hwtstamp_validate()
197 tx_type = cfg->tx_type; in net_hwtstamp_validate()
198 rx_filter = cfg->rx_filter; in net_hwtstamp_validate()
237 return -ERANGE; in net_hwtstamp_validate()
245 const struct net_device_ops *ops = dev->netdev_ops; in dev_eth_ioctl()
247 if (!ops->ndo_eth_ioctl) in dev_eth_ioctl()
248 return -EOPNOTSUPP; in dev_eth_ioctl()
251 return -ENODEV; in dev_eth_ioctl()
253 return ops->ndo_eth_ioctl(dev, ifr, cmd); in dev_eth_ioctl()
257 * dev_get_hwtstamp_phylib() - Get hardware timestamping settings of NIC
260 * @cfg: Timestamping configuration structure
267 * there only exists a phydev->mii_ts->hwtstamp() method. So this will return
268 * -EOPNOTSUPP for phylib for now, which is still more accurate than letting
272 struct kernel_hwtstamp_config *cfg) in dev_get_hwtstamp_phylib() argument
274 if (phy_has_hwtstamp(dev->phydev)) in dev_get_hwtstamp_phylib()
275 return phy_hwtstamp_get(dev->phydev, cfg); in dev_get_hwtstamp_phylib()
277 return dev->netdev_ops->ndo_hwtstamp_get(dev, cfg); in dev_get_hwtstamp_phylib()
282 const struct net_device_ops *ops = dev->netdev_ops; in dev_get_hwtstamp()
284 struct hwtstamp_config cfg; in dev_get_hwtstamp() local
287 if (!ops->ndo_hwtstamp_get) in dev_get_hwtstamp()
291 return -ENODEV; in dev_get_hwtstamp()
302 hwtstamp_config_from_kernel(&cfg, &kernel_cfg); in dev_get_hwtstamp()
304 if (copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg))) in dev_get_hwtstamp()
305 return -EFAULT; in dev_get_hwtstamp()
312 * dev_set_hwtstamp_phylib() - Change hardware timestamping of NIC
315 * @cfg: Timestamping configuration structure
323 * dev->priv_flags.
326 struct kernel_hwtstamp_config *cfg, in dev_set_hwtstamp_phylib() argument
329 const struct net_device_ops *ops = dev->netdev_ops; in dev_set_hwtstamp_phylib()
330 bool phy_ts = phy_has_hwtstamp(dev->phydev); in dev_set_hwtstamp_phylib()
335 cfg->source = phy_ts ? HWTSTAMP_SOURCE_PHYLIB : HWTSTAMP_SOURCE_NETDEV; in dev_set_hwtstamp_phylib()
337 if (phy_ts && (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)) { in dev_set_hwtstamp_phylib()
338 err = ops->ndo_hwtstamp_get(dev, &old_cfg); in dev_set_hwtstamp_phylib()
343 if (!phy_ts || (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)) { in dev_set_hwtstamp_phylib()
344 err = ops->ndo_hwtstamp_set(dev, cfg, extack); in dev_set_hwtstamp_phylib()
346 if (extack->_msg) in dev_set_hwtstamp_phylib()
347 netdev_err(dev, "%s\n", extack->_msg); in dev_set_hwtstamp_phylib()
352 if (phy_ts && (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)) in dev_set_hwtstamp_phylib()
353 changed = kernel_hwtstamp_config_changed(&old_cfg, cfg); in dev_set_hwtstamp_phylib()
356 err = phy_hwtstamp_set(dev->phydev, cfg, extack); in dev_set_hwtstamp_phylib()
359 ops->ndo_hwtstamp_set(dev, &old_cfg, NULL); in dev_set_hwtstamp_phylib()
369 const struct net_device_ops *ops = dev->netdev_ops; in dev_set_hwtstamp()
372 struct hwtstamp_config cfg; in dev_set_hwtstamp() local
375 if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) in dev_set_hwtstamp()
376 return -EFAULT; in dev_set_hwtstamp()
378 hwtstamp_config_to_kernel(&kernel_cfg, &cfg); in dev_set_hwtstamp()
392 if (!ops->ndo_hwtstamp_set) in dev_set_hwtstamp()
396 return -ENODEV; in dev_set_hwtstamp()
403 * updated version of it back to user space in dev_set_hwtstamp()
406 hwtstamp_config_from_kernel(&cfg, &kernel_cfg); in dev_set_hwtstamp()
408 if (copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg))) in dev_set_hwtstamp()
409 return -EFAULT; in dev_set_hwtstamp()
421 strscpy_pad(ifrr.ifr_name, dev->name, IFNAMSIZ); in generic_hwtstamp_ioctl_lower()
422 ifrr.ifr_ifru = kernel_cfg->ifr->ifr_ifru; in generic_hwtstamp_ioctl_lower()
428 kernel_cfg->ifr->ifr_ifru = ifrr.ifr_ifru; in generic_hwtstamp_ioctl_lower()
429 kernel_cfg->copied_to_user = true; in generic_hwtstamp_ioctl_lower()
437 const struct net_device_ops *ops = dev->netdev_ops; in generic_hwtstamp_get_lower()
440 return -ENODEV; in generic_hwtstamp_get_lower()
442 if (ops->ndo_hwtstamp_get) in generic_hwtstamp_get_lower()
454 const struct net_device_ops *ops = dev->netdev_ops; in generic_hwtstamp_set_lower()
457 return -ENODEV; in generic_hwtstamp_set_lower()
459 if (ops->ndo_hwtstamp_set) in generic_hwtstamp_set_lower()
470 const struct net_device_ops *ops = dev->netdev_ops; in dev_siocbond()
472 if (ops->ndo_siocbond) { in dev_siocbond()
474 return ops->ndo_siocbond(dev, ifr, cmd); in dev_siocbond()
476 return -ENODEV; in dev_siocbond()
479 return -EOPNOTSUPP; in dev_siocbond()
485 const struct net_device_ops *ops = dev->netdev_ops; in dev_siocdevprivate()
487 if (ops->ndo_siocdevprivate) { in dev_siocdevprivate()
489 return ops->ndo_siocdevprivate(dev, ifr, data, cmd); in dev_siocdevprivate()
491 return -ENODEV; in dev_siocdevprivate()
494 return -EOPNOTSUPP; in dev_siocdevprivate()
499 const struct net_device_ops *ops = dev->netdev_ops; in dev_siocwandev()
501 if (ops->ndo_siocwandev) { in dev_siocwandev()
503 return ops->ndo_siocwandev(dev, ifs); in dev_siocwandev()
505 return -ENODEV; in dev_siocwandev()
508 return -EOPNOTSUPP; in dev_siocwandev()
518 struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); in dev_ifsioc()
523 return -ENODEV; in dev_ifsioc()
525 ops = dev->netdev_ops; in dev_ifsioc()
529 return dev_change_flags(dev, ifr->ifr_flags, NULL); in dev_ifsioc()
533 return -EOPNOTSUPP; in dev_ifsioc()
536 return dev_set_mtu(dev, ifr->ifr_mtu); in dev_ifsioc()
539 if (dev->addr_len > sizeof(struct sockaddr)) in dev_ifsioc()
540 return -EINVAL; in dev_ifsioc()
541 return dev_set_mac_address_user(dev, &ifr->ifr_hwaddr, NULL); in dev_ifsioc()
544 if (ifr->ifr_hwaddr.sa_family != dev->type) in dev_ifsioc()
545 return -EINVAL; in dev_ifsioc()
546 memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, in dev_ifsioc()
547 min(sizeof(ifr->ifr_hwaddr.sa_data_min), in dev_ifsioc()
548 (size_t)dev->addr_len)); in dev_ifsioc()
556 if (!ops->ndo_set_rx_mode || in dev_ifsioc()
557 ifr->ifr_hwaddr.sa_family != AF_UNSPEC) in dev_ifsioc()
558 return -EINVAL; in dev_ifsioc()
560 return -ENODEV; in dev_ifsioc()
561 return dev_mc_add_global(dev, ifr->ifr_hwaddr.sa_data); in dev_ifsioc()
564 if (!ops->ndo_set_rx_mode || in dev_ifsioc()
565 ifr->ifr_hwaddr.sa_family != AF_UNSPEC) in dev_ifsioc()
566 return -EINVAL; in dev_ifsioc()
568 return -ENODEV; in dev_ifsioc()
569 return dev_mc_del_global(dev, ifr->ifr_hwaddr.sa_data); in dev_ifsioc()
572 if (ifr->ifr_qlen < 0) in dev_ifsioc()
573 return -EINVAL; in dev_ifsioc()
574 return dev_change_tx_queue_len(dev, ifr->ifr_qlen); in dev_ifsioc()
577 ifr->ifr_newname[IFNAMSIZ-1] = '\0'; in dev_ifsioc()
578 return dev_change_name(dev, ifr->ifr_newname); in dev_ifsioc()
581 return dev_siocwandev(dev, &ifr->ifr_settings); in dev_ifsioc()
586 return -ENODEV; in dev_ifsioc()
588 return -EOPNOTSUPP; in dev_ifsioc()
620 err = -EINVAL; in dev_ifsioc()
626 * dev_load - load a network module
646 no_module = request_module("netdev-%s", name); in dev_load()
653 * This function handles all "interface"-type I/O control requests. The actual
658 * dev_ioctl - network device ioctl
661 * @ifr: pointer to a struct ifreq in user space
666 * user space syscall interfaces but can sometimes be useful for
682 ifr->ifr_name[IFNAMSIZ-1] = 0; in dev_ioctl()
684 colon = strchr(ifr->ifr_name, ':'); in dev_ioctl()
694 dev_load(net, ifr->ifr_name); in dev_ioctl()
695 ret = dev_get_mac_address(&ifr->ifr_hwaddr, net, ifr->ifr_name); in dev_ioctl()
701 * - can be done by all. in dev_ioctl()
702 * - atomic and do not require locking. in dev_ioctl()
703 * - return a value in dev_ioctl()
712 dev_load(net, ifr->ifr_name); in dev_ioctl()
721 dev_load(net, ifr->ifr_name); in dev_ioctl()
729 * - require superuser power. in dev_ioctl()
730 * - require strict serialization. in dev_ioctl()
731 * - return a value in dev_ioctl()
736 dev_load(net, ifr->ifr_name); in dev_ioctl()
737 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) in dev_ioctl()
738 return -EPERM; in dev_ioctl()
748 * - require superuser power. in dev_ioctl()
749 * - require strict serialization. in dev_ioctl()
750 * - do not return a value in dev_ioctl()
755 return -EPERM; in dev_ioctl()
759 * - require local superuser power. in dev_ioctl()
760 * - require strict serialization. in dev_ioctl()
761 * - do not return a value in dev_ioctl()
779 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) in dev_ioctl()
780 return -EPERM; in dev_ioctl()
784 dev_load(net, ifr->ifr_name); in dev_ioctl()
793 /* Get the per device memory space. We can add this but in dev_ioctl()
796 /* Set the per device memory buffer space. in dev_ioctl()
799 return -ENOTTY; in dev_ioctl()
809 dev_load(net, ifr->ifr_name); in dev_ioctl()
815 return -ENOTTY; in dev_ioctl()