- if (advertise & OFPPF_100MB_HD) {
- ecmd.advertising |= ADVERTISED_100baseT_Half;
- }
- if (advertise & OFPPF_100MB_FD) {
- ecmd.advertising |= ADVERTISED_100baseT_Full;
- }
- if (advertise & OFPPF_1GB_HD) {
- ecmd.advertising |= ADVERTISED_1000baseT_Half;
- }
- if (advertise & OFPPF_1GB_FD) {
- ecmd.advertising |= ADVERTISED_1000baseT_Full;
- }
- if (advertise & OFPPF_10GB_FD) {
- ecmd.advertising |= ADVERTISED_10000baseT_Full;
- }
- if (advertise & OFPPF_COPPER) {
- ecmd.advertising |= ADVERTISED_TP;
- }
- if (advertise & OFPPF_FIBER) {
- ecmd.advertising |= ADVERTISED_FIBRE;
- }
- if (advertise & OFPPF_AUTONEG) {
- ecmd.advertising |= ADVERTISED_Autoneg;
- }
- if (advertise & OFPPF_PAUSE) {
- ecmd.advertising |= ADVERTISED_Pause;
- }
- if (advertise & OFPPF_PAUSE_ASYM) {
- ecmd.advertising |= ADVERTISED_Asym_Pause;
- }
- return do_ethtool(netdev, &ecmd, ETHTOOL_SSET, "ETHTOOL_SSET");
-}
-
-/* If 'netdev' has an assigned IPv4 address, sets '*in4' to that address
- * and '*mask' to the netmask (if they are non-null) and returns true.
- * Otherwise, returns false. */
-bool
-netdev_nodev_get_in4(const char *netdev_name, struct in_addr *in4,
- struct in_addr *mask)
-{
- struct ifreq ifr;
- struct in_addr ip = { INADDR_ANY };
-
- init_netdev();
-
- strncpy(ifr.ifr_name, netdev_name, sizeof ifr.ifr_name);
- ifr.ifr_addr.sa_family = AF_INET;
- COVERAGE_INC(netdev_get_in4);
- if (ioctl(af_inet_sock, SIOCGIFADDR, &ifr) == 0) {
- struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
- ip = sin->sin_addr;
- } else {
- VLOG_DBG_RL(&rl, "%s: ioctl(SIOCGIFADDR) failed: %s",
- netdev_name, strerror(errno));