diff options
| -rw-r--r-- | drivers/net/xen-netfront.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index f6e7e2726f6b..0cfe4ccf92d2 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
| @@ -1140,6 +1140,42 @@ static void xennet_uninit(struct net_device *dev) | |||
| 1140 | gnttab_free_grant_references(np->gref_rx_head); | 1140 | gnttab_free_grant_references(np->gref_rx_head); |
| 1141 | } | 1141 | } |
| 1142 | 1142 | ||
| 1143 | static u32 xennet_fix_features(struct net_device *dev, u32 features) | ||
| 1144 | { | ||
| 1145 | struct netfront_info *np = netdev_priv(dev); | ||
| 1146 | int val; | ||
| 1147 | |||
| 1148 | if (features & NETIF_F_SG) { | ||
| 1149 | if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, "feature-sg", | ||
| 1150 | "%d", &val) < 0) | ||
| 1151 | val = 0; | ||
| 1152 | |||
| 1153 | if (!val) | ||
| 1154 | features &= ~NETIF_F_SG; | ||
| 1155 | } | ||
| 1156 | |||
| 1157 | if (features & NETIF_F_TSO) { | ||
| 1158 | if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, | ||
| 1159 | "feature-gso-tcpv4", "%d", &val) < 0) | ||
| 1160 | val = 0; | ||
| 1161 | |||
| 1162 | if (!val) | ||
| 1163 | features &= ~NETIF_F_TSO; | ||
| 1164 | } | ||
| 1165 | |||
| 1166 | return features; | ||
| 1167 | } | ||
| 1168 | |||
| 1169 | static int xennet_set_features(struct net_device *dev, u32 features) | ||
| 1170 | { | ||
| 1171 | if (!(features & NETIF_F_SG) && dev->mtu > ETH_DATA_LEN) { | ||
| 1172 | netdev_info(dev, "Reducing MTU because no SG offload"); | ||
| 1173 | dev->mtu = ETH_DATA_LEN; | ||
| 1174 | } | ||
| 1175 | |||
| 1176 | return 0; | ||
| 1177 | } | ||
| 1178 | |||
| 1143 | static const struct net_device_ops xennet_netdev_ops = { | 1179 | static const struct net_device_ops xennet_netdev_ops = { |
| 1144 | .ndo_open = xennet_open, | 1180 | .ndo_open = xennet_open, |
| 1145 | .ndo_uninit = xennet_uninit, | 1181 | .ndo_uninit = xennet_uninit, |
| @@ -1513,42 +1549,6 @@ again: | |||
| 1513 | return err; | 1549 | return err; |
| 1514 | } | 1550 | } |
| 1515 | 1551 | ||
| 1516 | static u32 xennet_fix_features(struct net_device *dev, u32 features) | ||
| 1517 | { | ||
| 1518 | struct netfront_info *np = netdev_priv(dev); | ||
| 1519 | int val; | ||
| 1520 | |||
| 1521 | if (features & NETIF_F_SG) { | ||
| 1522 | if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, "feature-sg", | ||
| 1523 | "%d", &val) < 0) | ||
| 1524 | val = 0; | ||
| 1525 | |||
| 1526 | if (!val) | ||
| 1527 | features &= ~NETIF_F_SG; | ||
| 1528 | } | ||
| 1529 | |||
| 1530 | if (features & NETIF_F_TSO) { | ||
| 1531 | if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, | ||
| 1532 | "feature-gso-tcpv4", "%d", &val) < 0) | ||
| 1533 | val = 0; | ||
| 1534 | |||
| 1535 | if (!val) | ||
| 1536 | features &= ~NETIF_F_TSO; | ||
| 1537 | } | ||
| 1538 | |||
| 1539 | return features; | ||
| 1540 | } | ||
| 1541 | |||
| 1542 | static int xennet_set_features(struct net_device *dev, u32 features) | ||
| 1543 | { | ||
| 1544 | if (!(features & NETIF_F_SG) && dev->mtu > ETH_DATA_LEN) { | ||
| 1545 | netdev_info(dev, "Reducing MTU because no SG offload"); | ||
| 1546 | dev->mtu = ETH_DATA_LEN; | ||
| 1547 | } | ||
| 1548 | |||
| 1549 | return 0; | ||
| 1550 | } | ||
| 1551 | |||
| 1552 | static int xennet_connect(struct net_device *dev) | 1552 | static int xennet_connect(struct net_device *dev) |
| 1553 | { | 1553 | { |
| 1554 | struct netfront_info *np = netdev_priv(dev); | 1554 | struct netfront_info *np = netdev_priv(dev); |
