Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix endless loop in nf_tables, from Phil Sutter. 2) Fix cross namespace ip6_gre tunnel hash list corruption, from Olivier Matz. 3) Don't be too strict in phy_start_aneg() otherwise we might not allow restarting auto negotiation. From Heiner Kallweit. 4) Fix various KMSAN uninitialized value cases in tipc, from Ying Xue. 5) Memory leak in act_tunnel_key, from Davide Caratti. 6) Handle chip errata of mv88e6390 PHY, from Andrew Lunn. 7) Remove linear SKB assumption in fou/fou6, from Eric Dumazet. 8) Missing udplite rehash callbacks, from Alexey Kodanev. 9) Log dirty pages properly in vhost, from Jason Wang. 10) Use consume_skb() in neigh_probe() as this is a normal free not a drop, from Yang Wei. Likewise in macvlan_process_broadcast(). 11) Missing device_del() in mdiobus_register() error paths, from Thomas Petazzoni. 12) Fix checksum handling of short packets in mlx5, from Cong Wang. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (96 commits) bpf: in __bpf_redirect_no_mac pull mac only if present virtio_net: bulk free tx skbs net: phy: phy driver features are mandatory isdn: avm: Fix string plus integer warning from Clang net/mlx5e: Fix cb_ident duplicate in indirect block register net/mlx5e: Fix wrong (zero) TX drop counter indication for representor net/mlx5e: Fix wrong error code return on FEC query failure net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames tools: bpftool: Cleanup license mess bpf: fix inner map masking to prevent oob under speculation bpf: pull in pkt_sched.h header for tooling to fix bpftool build selftests: forwarding: Add a test case for externally learned FDB entries selftests: mlxsw: Test FDB offload indication mlxsw: spectrum_switchdev: Do not treat static FDB entries as sticky net: bridge: Mark FDB entries that were added by user as such mlxsw: spectrum_fid: Update dummy FID index mlxsw: pci: Return error on PCI reset timeout mlxsw: pci: Increase PCI SW reset timeout mlxsw: pci: Ring CQ's doorbell before RDQ's MAINTAINERS: update email addresses of liquidio driver maintainers ...
This commit is contained in:
@@ -1737,13 +1737,87 @@ static int log_write(void __user *log_base,
|
||||
return r;
|
||||
}
|
||||
|
||||
static int log_write_hva(struct vhost_virtqueue *vq, u64 hva, u64 len)
|
||||
{
|
||||
struct vhost_umem *umem = vq->umem;
|
||||
struct vhost_umem_node *u;
|
||||
u64 start, end, l, min;
|
||||
int r;
|
||||
bool hit = false;
|
||||
|
||||
while (len) {
|
||||
min = len;
|
||||
/* More than one GPAs can be mapped into a single HVA. So
|
||||
* iterate all possible umems here to be safe.
|
||||
*/
|
||||
list_for_each_entry(u, &umem->umem_list, link) {
|
||||
if (u->userspace_addr > hva - 1 + len ||
|
||||
u->userspace_addr - 1 + u->size < hva)
|
||||
continue;
|
||||
start = max(u->userspace_addr, hva);
|
||||
end = min(u->userspace_addr - 1 + u->size,
|
||||
hva - 1 + len);
|
||||
l = end - start + 1;
|
||||
r = log_write(vq->log_base,
|
||||
u->start + start - u->userspace_addr,
|
||||
l);
|
||||
if (r < 0)
|
||||
return r;
|
||||
hit = true;
|
||||
min = min(l, min);
|
||||
}
|
||||
|
||||
if (!hit)
|
||||
return -EFAULT;
|
||||
|
||||
len -= min;
|
||||
hva += min;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len)
|
||||
{
|
||||
struct iovec iov[64];
|
||||
int i, ret;
|
||||
|
||||
if (!vq->iotlb)
|
||||
return log_write(vq->log_base, vq->log_addr + used_offset, len);
|
||||
|
||||
ret = translate_desc(vq, (uintptr_t)vq->used + used_offset,
|
||||
len, iov, 64, VHOST_ACCESS_WO);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < ret; i++) {
|
||||
ret = log_write_hva(vq, (uintptr_t)iov[i].iov_base,
|
||||
iov[i].iov_len);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
|
||||
unsigned int log_num, u64 len)
|
||||
unsigned int log_num, u64 len, struct iovec *iov, int count)
|
||||
{
|
||||
int i, r;
|
||||
|
||||
/* Make sure data written is seen before log. */
|
||||
smp_wmb();
|
||||
|
||||
if (vq->iotlb) {
|
||||
for (i = 0; i < count; i++) {
|
||||
r = log_write_hva(vq, (uintptr_t)iov[i].iov_base,
|
||||
iov[i].iov_len);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < log_num; ++i) {
|
||||
u64 l = min(log[i].len, len);
|
||||
r = log_write(vq->log_base, log[i].addr, l);
|
||||
@@ -1773,9 +1847,8 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq)
|
||||
smp_wmb();
|
||||
/* Log used flag write. */
|
||||
used = &vq->used->flags;
|
||||
log_write(vq->log_base, vq->log_addr +
|
||||
(used - (void __user *)vq->used),
|
||||
sizeof vq->used->flags);
|
||||
log_used(vq, (used - (void __user *)vq->used),
|
||||
sizeof vq->used->flags);
|
||||
if (vq->log_ctx)
|
||||
eventfd_signal(vq->log_ctx, 1);
|
||||
}
|
||||
@@ -1793,9 +1866,8 @@ static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event)
|
||||
smp_wmb();
|
||||
/* Log avail event write */
|
||||
used = vhost_avail_event(vq);
|
||||
log_write(vq->log_base, vq->log_addr +
|
||||
(used - (void __user *)vq->used),
|
||||
sizeof *vhost_avail_event(vq));
|
||||
log_used(vq, (used - (void __user *)vq->used),
|
||||
sizeof *vhost_avail_event(vq));
|
||||
if (vq->log_ctx)
|
||||
eventfd_signal(vq->log_ctx, 1);
|
||||
}
|
||||
@@ -2195,10 +2267,8 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq,
|
||||
/* Make sure data is seen before log. */
|
||||
smp_wmb();
|
||||
/* Log used ring entry write. */
|
||||
log_write(vq->log_base,
|
||||
vq->log_addr +
|
||||
((void __user *)used - (void __user *)vq->used),
|
||||
count * sizeof *used);
|
||||
log_used(vq, ((void __user *)used - (void __user *)vq->used),
|
||||
count * sizeof *used);
|
||||
}
|
||||
old = vq->last_used_idx;
|
||||
new = (vq->last_used_idx += count);
|
||||
@@ -2240,9 +2310,8 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads,
|
||||
/* Make sure used idx is seen before log. */
|
||||
smp_wmb();
|
||||
/* Log used index update. */
|
||||
log_write(vq->log_base,
|
||||
vq->log_addr + offsetof(struct vring_used, idx),
|
||||
sizeof vq->used->idx);
|
||||
log_used(vq, offsetof(struct vring_used, idx),
|
||||
sizeof vq->used->idx);
|
||||
if (vq->log_ctx)
|
||||
eventfd_signal(vq->log_ctx, 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user