diff options
author | David S. Miller <davem@davemloft.net> | 2014-01-06 17:37:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-06 17:37:45 -0500 |
commit | 56a4342dfe3145cd66f766adccb28fd9b571606d (patch) | |
tree | d1593764488ff8cbb0b83cb9ae35fd968bf81760 /drivers/net/xen-netback | |
parent | 805c1f4aedaba1bc8d839e7c27b128083dd5c2f0 (diff) | |
parent | fe0d692bbc645786bce1a98439e548ae619269f5 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6_vti.c
ipv6 tunnel statistic bug fixes conflicting with consolidation into
generic sw per-cpu net stats.
qlogic conflict between queue counting bug fix and the addition
of multiple MAC address support.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netback')
-rw-r--r-- | drivers/net/xen-netback/common.h | 19 | ||||
-rw-r--r-- | drivers/net/xen-netback/interface.c | 11 | ||||
-rw-r--r-- | drivers/net/xen-netback/netback.c | 18 |
3 files changed, 37 insertions, 11 deletions
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index ba30a6d9fefa..c955fc39d69a 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
@@ -101,6 +101,13 @@ struct xenvif_rx_meta { | |||
101 | 101 | ||
102 | #define MAX_PENDING_REQS 256 | 102 | #define MAX_PENDING_REQS 256 |
103 | 103 | ||
104 | /* It's possible for an skb to have a maximal number of frags | ||
105 | * but still be less than MAX_BUFFER_OFFSET in size. Thus the | ||
106 | * worst-case number of copy operations is MAX_SKB_FRAGS per | ||
107 | * ring slot. | ||
108 | */ | ||
109 | #define MAX_GRANT_COPY_OPS (MAX_SKB_FRAGS * XEN_NETIF_RX_RING_SIZE) | ||
110 | |||
104 | struct xenvif { | 111 | struct xenvif { |
105 | /* Unique identifier for this interface. */ | 112 | /* Unique identifier for this interface. */ |
106 | domid_t domid; | 113 | domid_t domid; |
@@ -141,13 +148,13 @@ struct xenvif { | |||
141 | */ | 148 | */ |
142 | bool rx_event; | 149 | bool rx_event; |
143 | 150 | ||
144 | /* Given MAX_BUFFER_OFFSET of 4096 the worst case is that each | 151 | /* This array is allocated seperately as it is large */ |
145 | * head/fragment page uses 2 copy operations because it | 152 | struct gnttab_copy *grant_copy_op; |
146 | * straddles two buffers in the frontend. | ||
147 | */ | ||
148 | struct gnttab_copy grant_copy_op[2*XEN_NETIF_RX_RING_SIZE]; | ||
149 | struct xenvif_rx_meta meta[2*XEN_NETIF_RX_RING_SIZE]; | ||
150 | 153 | ||
154 | /* We create one meta structure per ring request we consume, so | ||
155 | * the maximum number is the same as the ring size. | ||
156 | */ | ||
157 | struct xenvif_rx_meta meta[XEN_NETIF_RX_RING_SIZE]; | ||
151 | 158 | ||
152 | u8 fe_dev_addr[6]; | 159 | u8 fe_dev_addr[6]; |
153 | 160 | ||
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 1dcb9606e6e0..b9de31ea7fc4 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ethtool.h> | 34 | #include <linux/ethtool.h> |
35 | #include <linux/rtnetlink.h> | 35 | #include <linux/rtnetlink.h> |
36 | #include <linux/if_vlan.h> | 36 | #include <linux/if_vlan.h> |
37 | #include <linux/vmalloc.h> | ||
37 | 38 | ||
38 | #include <xen/events.h> | 39 | #include <xen/events.h> |
39 | #include <asm/xen/hypercall.h> | 40 | #include <asm/xen/hypercall.h> |
@@ -307,6 +308,15 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
307 | SET_NETDEV_DEV(dev, parent); | 308 | SET_NETDEV_DEV(dev, parent); |
308 | 309 | ||
309 | vif = netdev_priv(dev); | 310 | vif = netdev_priv(dev); |
311 | |||
312 | vif->grant_copy_op = vmalloc(sizeof(struct gnttab_copy) * | ||
313 | MAX_GRANT_COPY_OPS); | ||
314 | if (vif->grant_copy_op == NULL) { | ||
315 | pr_warn("Could not allocate grant copy space for %s\n", name); | ||
316 | free_netdev(dev); | ||
317 | return ERR_PTR(-ENOMEM); | ||
318 | } | ||
319 | |||
310 | vif->domid = domid; | 320 | vif->domid = domid; |
311 | vif->handle = handle; | 321 | vif->handle = handle; |
312 | vif->can_sg = 1; | 322 | vif->can_sg = 1; |
@@ -488,6 +498,7 @@ void xenvif_free(struct xenvif *vif) | |||
488 | 498 | ||
489 | unregister_netdev(vif->dev); | 499 | unregister_netdev(vif->dev); |
490 | 500 | ||
501 | vfree(vif->grant_copy_op); | ||
491 | free_netdev(vif->dev); | 502 | free_netdev(vif->dev); |
492 | 503 | ||
493 | module_put(THIS_MODULE); | 504 | module_put(THIS_MODULE); |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 611aebee4583..4f81ac0e2f0a 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -524,7 +524,7 @@ static void xenvif_rx_action(struct xenvif *vif) | |||
524 | if (!npo.copy_prod) | 524 | if (!npo.copy_prod) |
525 | goto done; | 525 | goto done; |
526 | 526 | ||
527 | BUG_ON(npo.copy_prod > ARRAY_SIZE(vif->grant_copy_op)); | 527 | BUG_ON(npo.copy_prod > MAX_GRANT_COPY_OPS); |
528 | gnttab_batch_copy(vif->grant_copy_op, npo.copy_prod); | 528 | gnttab_batch_copy(vif->grant_copy_op, npo.copy_prod); |
529 | 529 | ||
530 | while ((skb = __skb_dequeue(&rxq)) != NULL) { | 530 | while ((skb = __skb_dequeue(&rxq)) != NULL) { |
@@ -1108,8 +1108,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, | |||
1108 | goto out; | 1108 | goto out; |
1109 | 1109 | ||
1110 | if (!skb_partial_csum_set(skb, off, | 1110 | if (!skb_partial_csum_set(skb, off, |
1111 | offsetof(struct tcphdr, check))) | 1111 | offsetof(struct tcphdr, check))) { |
1112 | err = -EPROTO; | ||
1112 | goto out; | 1113 | goto out; |
1114 | } | ||
1113 | 1115 | ||
1114 | if (recalculate_partial_csum) | 1116 | if (recalculate_partial_csum) |
1115 | tcp_hdr(skb)->check = | 1117 | tcp_hdr(skb)->check = |
@@ -1126,8 +1128,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, | |||
1126 | goto out; | 1128 | goto out; |
1127 | 1129 | ||
1128 | if (!skb_partial_csum_set(skb, off, | 1130 | if (!skb_partial_csum_set(skb, off, |
1129 | offsetof(struct udphdr, check))) | 1131 | offsetof(struct udphdr, check))) { |
1132 | err = -EPROTO; | ||
1130 | goto out; | 1133 | goto out; |
1134 | } | ||
1131 | 1135 | ||
1132 | if (recalculate_partial_csum) | 1136 | if (recalculate_partial_csum) |
1133 | udp_hdr(skb)->check = | 1137 | udp_hdr(skb)->check = |
@@ -1249,8 +1253,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, | |||
1249 | goto out; | 1253 | goto out; |
1250 | 1254 | ||
1251 | if (!skb_partial_csum_set(skb, off, | 1255 | if (!skb_partial_csum_set(skb, off, |
1252 | offsetof(struct tcphdr, check))) | 1256 | offsetof(struct tcphdr, check))) { |
1257 | err = -EPROTO; | ||
1253 | goto out; | 1258 | goto out; |
1259 | } | ||
1254 | 1260 | ||
1255 | if (recalculate_partial_csum) | 1261 | if (recalculate_partial_csum) |
1256 | tcp_hdr(skb)->check = | 1262 | tcp_hdr(skb)->check = |
@@ -1267,8 +1273,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, | |||
1267 | goto out; | 1273 | goto out; |
1268 | 1274 | ||
1269 | if (!skb_partial_csum_set(skb, off, | 1275 | if (!skb_partial_csum_set(skb, off, |
1270 | offsetof(struct udphdr, check))) | 1276 | offsetof(struct udphdr, check))) { |
1277 | err = -EPROTO; | ||
1271 | goto out; | 1278 | goto out; |
1279 | } | ||
1272 | 1280 | ||
1273 | if (recalculate_partial_csum) | 1281 | if (recalculate_partial_csum) |
1274 | udp_hdr(skb)->check = | 1282 | udp_hdr(skb)->check = |