aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netback
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 19:07:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 19:07:55 -0500
commitaa3ecf388adc90bde90776bba71a7f2d278fc4e3 (patch)
treeeab9a54822048f3cb4a280ab70d3eaea3c1c4e14 /drivers/net/xen-netback
parentb5cab0da75c292ffa0fbd68dd2c820066b2842de (diff)
parent709613ad2b3c9eaeb2a3e24284b7c8feffc17326 (diff)
Merge tag 'for-linus-4.10-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen updates from Juergen Gross: "Xen features and fixes for 4.10 These are some fixes, a move of some arm related headers to share them between arm and arm64 and a series introducing a helper to make code more readable. The most notable change is David stepping down as maintainer of the Xen hypervisor interface. This results in me sending you the pull requests for Xen related code from now on" * tag 'for-linus-4.10-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: (29 commits) xen/balloon: Only mark a page as managed when it is released xenbus: fix deadlock on writes to /proc/xen/xenbus xen/scsifront: don't request a slot on the ring until request is ready xen/x86: Increase xen_e820_map to E820_X_MAX possible entries x86: Make E820_X_MAX unconditionally larger than E820MAX xen/pci: Bubble up error and fix description. xen: xenbus: set error code on failure xen: set error code on failures arm/xen: Use alloc_percpu rather than __alloc_percpu arm/arm64: xen: Move shared architecture headers to include/xen/arm xen/events: use xen_vcpu_id mapping for EVTCHNOP_status xen/gntdev: Use VM_MIXEDMAP instead of VM_IO to avoid NUMA balancing xen-scsifront: Add a missing call to kfree MAINTAINERS: update XEN HYPERVISOR INTERFACE xenfs: Use proc_create_mount_point() to create /proc/xen xen-platform: use builtin_pci_driver xen-netback: fix error handling output xen: make use of xenbus_read_unsigned() in xenbus xen: make use of xenbus_read_unsigned() in xen-pciback xen: make use of xenbus_read_unsigned() in xen-fbfront ...
Diffstat (limited to 'drivers/net/xen-netback')
-rw-r--r--drivers/net/xen-netback/xenbus.c52
1 files changed, 15 insertions, 37 deletions
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 55a4488633e4..3124eaec9427 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -785,12 +785,9 @@ static void xen_mcast_ctrl_changed(struct xenbus_watch *watch,
785 struct xenvif *vif = container_of(watch, struct xenvif, 785 struct xenvif *vif = container_of(watch, struct xenvif,
786 mcast_ctrl_watch); 786 mcast_ctrl_watch);
787 struct xenbus_device *dev = xenvif_to_xenbus_device(vif); 787 struct xenbus_device *dev = xenvif_to_xenbus_device(vif);
788 int val;
789 788
790 if (xenbus_scanf(XBT_NIL, dev->otherend, 789 vif->multicast_control = !!xenbus_read_unsigned(dev->otherend,
791 "request-multicast-control", "%d", &val) < 0) 790 "request-multicast-control", 0);
792 val = 0;
793 vif->multicast_control = !!val;
794} 791}
795 792
796static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev, 793static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
@@ -934,14 +931,11 @@ static void connect(struct backend_info *be)
934 /* Check whether the frontend requested multiple queues 931 /* Check whether the frontend requested multiple queues
935 * and read the number requested. 932 * and read the number requested.
936 */ 933 */
937 err = xenbus_scanf(XBT_NIL, dev->otherend, 934 requested_num_queues = xenbus_read_unsigned(dev->otherend,
938 "multi-queue-num-queues", 935 "multi-queue-num-queues", 1);
939 "%u", &requested_num_queues); 936 if (requested_num_queues > xenvif_max_queues) {
940 if (err < 0) {
941 requested_num_queues = 1; /* Fall back to single queue */
942 } else if (requested_num_queues > xenvif_max_queues) {
943 /* buggy or malicious guest */ 937 /* buggy or malicious guest */
944 xenbus_dev_fatal(dev, err, 938 xenbus_dev_fatal(dev, -EINVAL,
945 "guest requested %u queues, exceeding the maximum of %u.", 939 "guest requested %u queues, exceeding the maximum of %u.",
946 requested_num_queues, xenvif_max_queues); 940 requested_num_queues, xenvif_max_queues);
947 return; 941 return;
@@ -1134,7 +1128,7 @@ static int read_xenbus_vif_flags(struct backend_info *be)
1134 struct xenvif *vif = be->vif; 1128 struct xenvif *vif = be->vif;
1135 struct xenbus_device *dev = be->dev; 1129 struct xenbus_device *dev = be->dev;
1136 unsigned int rx_copy; 1130 unsigned int rx_copy;
1137 int err, val; 1131 int err;
1138 1132
1139 err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy", "%u", 1133 err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy", "%u",
1140 &rx_copy); 1134 &rx_copy);
@@ -1150,10 +1144,7 @@ static int read_xenbus_vif_flags(struct backend_info *be)
1150 if (!rx_copy) 1144 if (!rx_copy)
1151 return -EOPNOTSUPP; 1145 return -EOPNOTSUPP;
1152 1146
1153 if (xenbus_scanf(XBT_NIL, dev->otherend, 1147 if (!xenbus_read_unsigned(dev->otherend, "feature-rx-notify", 0)) {
1154 "feature-rx-notify", "%d", &val) < 0)
1155 val = 0;
1156 if (!val) {
1157 /* - Reduce drain timeout to poll more frequently for 1148 /* - Reduce drain timeout to poll more frequently for
1158 * Rx requests. 1149 * Rx requests.
1159 * - Disable Rx stall detection. 1150 * - Disable Rx stall detection.
@@ -1162,34 +1153,21 @@ static int read_xenbus_vif_flags(struct backend_info *be)
1162 be->vif->stall_timeout = 0; 1153 be->vif->stall_timeout = 0;
1163 } 1154 }
1164 1155
1165 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", 1156 vif->can_sg = !!xenbus_read_unsigned(dev->otherend, "feature-sg", 0);
1166 "%d", &val) < 0)
1167 val = 0;
1168 vif->can_sg = !!val;
1169 1157
1170 vif->gso_mask = 0; 1158 vif->gso_mask = 0;
1171 1159
1172 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4", 1160 if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv4", 0))
1173 "%d", &val) < 0)
1174 val = 0;
1175 if (val)
1176 vif->gso_mask |= GSO_BIT(TCPV4); 1161 vif->gso_mask |= GSO_BIT(TCPV4);
1177 1162
1178 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6", 1163 if (xenbus_read_unsigned(dev->otherend, "feature-gso-tcpv6", 0))
1179 "%d", &val) < 0)
1180 val = 0;
1181 if (val)
1182 vif->gso_mask |= GSO_BIT(TCPV6); 1164 vif->gso_mask |= GSO_BIT(TCPV6);
1183 1165
1184 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload", 1166 vif->ip_csum = !xenbus_read_unsigned(dev->otherend,
1185 "%d", &val) < 0) 1167 "feature-no-csum-offload", 0);
1186 val = 0;
1187 vif->ip_csum = !val;
1188 1168
1189 if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ipv6-csum-offload", 1169 vif->ipv6_csum = !!xenbus_read_unsigned(dev->otherend,
1190 "%d", &val) < 0) 1170 "feature-ipv6-csum-offload", 0);
1191 val = 0;
1192 vif->ipv6_csum = !!val;
1193 1171
1194 return 0; 1172 return 0;
1195} 1173}