MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tap_ioctl

Function tap_ioctl

dpdk/drivers/net/tap/rte_eth_tap.c:777–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775}
776
777static int
778tap_ioctl(struct pmd_internals *pmd, unsigned long request,
779 struct ifreq *ifr, int set, enum ioctl_mode mode)
780{
781 short req_flags = ifr->ifr_flags;
782 int remote = pmd->remote_if_index &&
783 (mode == REMOTE_ONLY || mode == LOCAL_AND_REMOTE);
784
785 if (!pmd->remote_if_index && mode == REMOTE_ONLY)
786 return 0;
787 /*
788 * If there is a remote netdevice, apply ioctl on it, then apply it on
789 * the tap netdevice.
790 */
791apply:
792 if (remote)
793 strlcpy(ifr->ifr_name, pmd->remote_iface, IFNAMSIZ);
794 else if (mode == LOCAL_ONLY || mode == LOCAL_AND_REMOTE)
795 strlcpy(ifr->ifr_name, pmd->name, IFNAMSIZ);
796 switch (request) {
797 case SIOCSIFFLAGS:
798 /* fetch current flags to leave other flags untouched */
799 if (ioctl(pmd->ioctl_sock, SIOCGIFFLAGS, ifr) < 0)
800 goto error;
801 if (set)
802 ifr->ifr_flags |= req_flags;
803 else
804 ifr->ifr_flags &= ~req_flags;
805 break;
806 case SIOCGIFFLAGS:
807 case SIOCGIFHWADDR:
808 case SIOCSIFHWADDR:
809 case SIOCSIFMTU:
810 break;
811 default:
812 TAP_LOG(WARNING, "%s: ioctl() called with wrong arg",
813 pmd->name);
814 return -EINVAL;
815 }
816 if (ioctl(pmd->ioctl_sock, request, ifr) < 0)
817 goto error;
818 if (remote-- && mode == LOCAL_AND_REMOTE)
819 goto apply;
820 return 0;
821
822error:
823 TAP_LOG(DEBUG, "%s(%s) failed: %s(%d)", ifr->ifr_name,
824 tap_ioctl_req2str(request), strerror(errno), errno);
825 return -errno;
826}
827
828static int
829tap_link_set_down(struct rte_eth_dev *dev)

Callers 10

tap_link_set_downFunction · 0.85
tap_link_set_upFunction · 0.85
tap_link_updateFunction · 0.85
tap_promisc_enableFunction · 0.85
tap_promisc_disableFunction · 0.85
tap_allmulti_enableFunction · 0.85
tap_allmulti_disableFunction · 0.85
tap_mac_setFunction · 0.85
tap_mtu_setFunction · 0.85
eth_dev_tap_createFunction · 0.85

Calls 3

tap_ioctl_req2strFunction · 0.85
strlcpyFunction · 0.50
ioctlFunction · 0.50

Tested by

no test coverage detected