summarylogtreecommitdiffstats
path: root/vmnet.patch
diff options
context:
space:
mode:
Diffstat (limited to 'vmnet.patch')
-rw-r--r--vmnet.patch80
1 files changed, 41 insertions, 39 deletions
diff --git a/vmnet.patch b/vmnet.patch
index 9413d349ad81..7b3f07e10e8b 100644
--- a/vmnet.patch
+++ b/vmnet.patch
@@ -88,14 +88,16 @@ index 7e7ad99..5f508f6 100644
crc = 0xffffffff; /* init CRC for each address */
for (byte = 0; byte < ETH_ALEN; byte++) { /* for each address byte */
diff --git a/vmnet/userif.c b/vmnet/userif.c
-index 2b976d7..5298406 100644
+index 94146f6..5298406 100644
--- a/vmnet/userif.c
+++ b/vmnet/userif.c
-@@ -113,12 +113,18 @@ UserifLockPage(VA addr) // IN
+@@ -113,14 +113,18 @@ UserifLockPage(VA addr) // IN
int retval;
down_read(&current->mm->mmap_sem);
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+- retval = get_user_pages(addr, 1, FOLL_WRITE, &page, NULL);
+-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
- retval = get_user_pages(addr, 1, 1, 0, &page, NULL);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
+ retval = get_user_pages(addr,
@@ -113,7 +115,7 @@ index 2b976d7..5298406 100644
up_read(&current->mm->mmap_sem);
if (retval != 1) {
-@@ -182,13 +188,13 @@ VNetUserIfMapUint32Ptr(VA uAddr, // IN: pointer to user memory
+@@ -184,13 +188,13 @@ VNetUserIfMapUint32Ptr(VA uAddr, // IN: pointer to user memory
*
* Sets up notification by filling in pollPtr, actPtr, and recvClusterCount
* fields.
@@ -130,7 +132,7 @@ index 2b976d7..5298406 100644
* recvClusterPage are filled in VNetUserIf structure.
*
*-----------------------------------------------------------------------------
-@@ -278,8 +284,8 @@ VNetUserIfSetupNotify(VNetUserIF *userIf, // IN
+@@ -280,8 +284,8 @@ VNetUserIfSetupNotify(VNetUserIF *userIf, // IN
* VNetUserIfUnsetupNotify --
*
* Destroys permanent mapping for notify structure provided by user.
@@ -141,7 +143,7 @@ index 2b976d7..5298406 100644
* None.
*
* Side effects:
-@@ -333,7 +339,7 @@ VNetUserIfUnsetupNotify(VNetUserIF *userIf) // IN
+@@ -335,7 +339,7 @@ VNetUserIfUnsetupNotify(VNetUserIF *userIf) // IN
*
* Free the user interface port.
*
@@ -150,7 +152,7 @@ index 2b976d7..5298406 100644
* None.
*
* Side effects:
-@@ -355,7 +361,7 @@ VNetUserIfFree(VNetJack *this) // IN
+@@ -357,7 +361,7 @@ VNetUserIfFree(VNetJack *this) // IN
}
dev_kfree_skb(skb);
}
@@ -159,7 +161,7 @@ index 2b976d7..5298406 100644
if (userIf->pollPtr) {
VNetUserIfUnsetupNotify(userIf);
}
-@@ -379,7 +385,7 @@ VNetUserIfFree(VNetJack *this) // IN
+@@ -381,7 +385,7 @@ VNetUserIfFree(VNetJack *this) // IN
*
* This jack is receiving a packet. Take appropriate action.
*
@@ -168,7 +170,7 @@ index 2b976d7..5298406 100644
* None.
*
* Side effects:
-@@ -395,12 +401,12 @@ VNetUserIfReceive(VNetJack *this, // IN
+@@ -397,12 +401,12 @@ VNetUserIfReceive(VNetJack *this, // IN
VNetUserIF *userIf = (VNetUserIF*)this->private;
uint8 *dest = SKB_2_DESTMAC(skb);
unsigned long flags;
@@ -183,7 +185,7 @@ index 2b976d7..5298406 100644
if (!VNetPacketMatch(dest,
userIf->port.paddr,
(const uint8 *)userIf->port.exactFilter,
-@@ -410,12 +416,12 @@ VNetUserIfReceive(VNetJack *this, // IN
+@@ -412,12 +416,12 @@ VNetUserIfReceive(VNetJack *this, // IN
userIf->stats.droppedMismatch++;
goto drop_packet;
}
@@ -198,7 +200,7 @@ index 2b976d7..5298406 100644
if (skb->len > ETHER_MAX_QUEUED_PACKET) {
userIf->stats.droppedLargePacket++;
goto drop_packet;
-@@ -439,7 +445,7 @@ VNetUserIfReceive(VNetJack *this, // IN
+@@ -441,7 +445,7 @@ VNetUserIfReceive(VNetJack *this, // IN
wake_up(&userIf->waitQueue);
return;
@@ -207,7 +209,7 @@ index 2b976d7..5298406 100644
drop_packet:
dev_kfree_skb(skb);
}
-@@ -452,7 +458,7 @@ VNetUserIfReceive(VNetJack *this, // IN
+@@ -454,7 +458,7 @@ VNetUserIfReceive(VNetJack *this, // IN
*
* Callback for read operation on this userif entry in vnets proc fs.
*
@@ -216,7 +218,7 @@ index 2b976d7..5298406 100644
* Length of read operation.
*
* Side effects:
-@@ -471,21 +477,21 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into
+@@ -473,21 +477,21 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into
// read
void *data) // IN: client data - not used
{
@@ -244,7 +246,7 @@ index 2b976d7..5298406 100644
"dropped.down %u dropped.mismatch %u "
"dropped.overflow %u dropped.largePacket %u",
userIf->stats.droppedDown,
-@@ -494,7 +500,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into
+@@ -496,7 +500,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into
userIf->stats.droppedLargePacket);
len += sprintf(page+len, "\n");
@@ -253,7 +255,7 @@ index 2b976d7..5298406 100644
*start = 0;
*eof = 1;
return len;
-@@ -508,7 +514,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into
+@@ -510,7 +514,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into
*
* Copy part of datagram to userspace.
*
@@ -262,7 +264,7 @@ index 2b976d7..5298406 100644
* zero on success,
* -EFAULT if buffer is an invalid area
*
-@@ -545,12 +551,12 @@ VNetCopyDatagram(const struct sk_buff *skb, // IN: skb to copy
+@@ -547,12 +551,12 @@ VNetCopyDatagram(const struct sk_buff *skb, // IN: skb to copy
*
* Copy part of datagram to userspace doing checksum at same time.
*
@@ -277,7 +279,7 @@ index 2b976d7..5298406 100644
* folded checksum (non-negative value) on success,
* -EINVAL if offset is too big,
* -EFAULT if buffer is an invalid area
-@@ -572,7 +578,7 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy
+@@ -574,7 +578,7 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy
char *curr = buf;
const skb_frag_t *frag;
@@ -286,7 +288,7 @@ index 2b976d7..5298406 100644
* Something bad happened. We skip only up to skb->nh.raw, and skb->nh.raw
* must be in the header, otherwise we are in the big troubles.
*/
-@@ -629,7 +635,7 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy
+@@ -631,7 +635,7 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy
* Copy complete datagram to the user space. Fill correct checksum
* into the copied datagram if nobody did it yet.
*
@@ -295,7 +297,7 @@ index 2b976d7..5298406 100644
* On success byte count, on failure -EFAULT.
*
* Side effects:
-@@ -658,7 +664,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN
+@@ -660,7 +664,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN
size_t skl;
int csum;
u_int16_t csum16;
@@ -304,7 +306,7 @@ index 2b976d7..5298406 100644
skl = compat_skb_csum_start(skb);
if (VNetCopyDatagram(skb, buf, skl)) {
return -EFAULT;
-@@ -689,7 +695,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN
+@@ -691,7 +695,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN
* The virtual network's read file operation. Reads the next pending
* packet for this network connection.
*
@@ -313,7 +315,7 @@ index 2b976d7..5298406 100644
* On success the len of the packet received,
* else if no packet waiting and nonblocking 0,
* else -errno.
-@@ -700,7 +706,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN
+@@ -702,7 +706,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN
*----------------------------------------------------------------------
*/
@@ -322,7 +324,7 @@ index 2b976d7..5298406 100644
VNetUserIfRead(VNetPort *port, // IN
struct file *filp, // IN
char *buf, // OUT
-@@ -768,7 +774,7 @@ VNetUserIfRead(VNetPort *port, // IN
+@@ -770,7 +774,7 @@ VNetUserIfRead(VNetPort *port, // IN
* The virtual network's write file operation. Send the raw packet
* to the network.
*
@@ -331,7 +333,7 @@ index 2b976d7..5298406 100644
* On success the count of bytes written else errno.
*
* Side effects:
-@@ -777,7 +783,7 @@ VNetUserIfRead(VNetPort *port, // IN
+@@ -779,7 +783,7 @@ VNetUserIfRead(VNetPort *port, // IN
*----------------------------------------------------------------------
*/
@@ -340,7 +342,7 @@ index 2b976d7..5298406 100644
VNetUserIfWrite(VNetPort *port, // IN
struct file *filp, // IN
const char *buf, // IN
-@@ -789,8 +795,8 @@ VNetUserIfWrite(VNetPort *port, // IN
+@@ -791,8 +795,8 @@ VNetUserIfWrite(VNetPort *port, // IN
/*
* Check size
*/
@@ -351,7 +353,7 @@ index 2b976d7..5298406 100644
count > ETHER_MAX_QUEUED_PACKET) {
return -EINVAL;
}
-@@ -807,25 +813,25 @@ VNetUserIfWrite(VNetPort *port, // IN
+@@ -809,25 +813,25 @@ VNetUserIfWrite(VNetPort *port, // IN
/*
* Allocate an sk_buff.
*/
@@ -382,7 +384,7 @@ index 2b976d7..5298406 100644
VNetSend(&userIf->port.jack, skb);
return count;
-@@ -839,7 +845,7 @@ VNetUserIfWrite(VNetPort *port, // IN
+@@ -841,7 +845,7 @@ VNetUserIfWrite(VNetPort *port, // IN
*
* XXX
*
@@ -391,7 +393,7 @@ index 2b976d7..5298406 100644
* 0 on success
* -errno on failure
*
-@@ -862,8 +868,8 @@ VNetUserIfIoctl(VNetPort *port, // IN
+@@ -864,8 +868,8 @@ VNetUserIfIoctl(VNetPort *port, // IN
return -EINVAL;
case SIOCSETNOTIFY2:
#ifdef VMX86_SERVER
@@ -402,7 +404,7 @@ index 2b976d7..5298406 100644
* the console os that are from the VMKernel address space which was the
* only case we used this.
*/
-@@ -906,20 +912,20 @@ VNetUserIfIoctl(VNetPort *port, // IN
+@@ -908,20 +912,20 @@ VNetUserIfIoctl(VNetPort *port, // IN
break;
case SIOCSIFFLAGS:
@@ -428,7 +430,7 @@ index 2b976d7..5298406 100644
spin_lock_irqsave(&q->lock, flags);
if (userIf->pollPtr) {
if (skb_queue_empty(q)) {
-@@ -936,11 +942,11 @@ VNetUserIfIoctl(VNetPort *port, // IN
+@@ -938,11 +942,11 @@ VNetUserIfIoctl(VNetPort *port, // IN
case SIOCINJECTLINKSTATE:
{
uint8 linkUpFromUser;
@@ -442,7 +444,7 @@ index 2b976d7..5298406 100644
if (linkUpFromUser != 0 && linkUpFromUser != 1) {
return -EINVAL;
}
-@@ -952,7 +958,7 @@ VNetUserIfIoctl(VNetPort *port, // IN
+@@ -954,7 +958,7 @@ VNetUserIfIoctl(VNetPort *port, // IN
return -ENOIOCTLCMD;
break;
}
@@ -451,7 +453,7 @@ index 2b976d7..5298406 100644
return 0;
}
-@@ -964,7 +970,7 @@ VNetUserIfIoctl(VNetPort *port, // IN
+@@ -966,7 +970,7 @@ VNetUserIfIoctl(VNetPort *port, // IN
*
* The virtual network's file poll operation.
*
@@ -460,7 +462,7 @@ index 2b976d7..5298406 100644
* Return POLLIN if success, else sleep and return 0.
* FIXME: Should not we always return POLLOUT?
*
-@@ -980,7 +986,7 @@ VNetUserIfPoll(VNetPort *port, // IN
+@@ -982,7 +986,7 @@ VNetUserIfPoll(VNetPort *port, // IN
poll_table *wait) // IN
{
VNetUserIF *userIf = (VNetUserIF*)port->jack.private;
@@ -469,7 +471,7 @@ index 2b976d7..5298406 100644
poll_wait(filp, &userIf->waitQueue, wait);
if (!skb_queue_empty(&userIf->packetQueue)) {
return POLLIN;
-@@ -995,8 +1001,8 @@ VNetUserIfPoll(VNetPort *port, // IN
+@@ -997,8 +1001,8 @@ VNetUserIfPoll(VNetPort *port, // IN
* VNetUserIfSetUplinkState --
*
* Sends link state change event.
@@ -480,7 +482,7 @@ index 2b976d7..5298406 100644
* 0 on success, errno on failure.
*
* Side effects:
-@@ -1038,7 +1044,7 @@ VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp)
+@@ -1040,7 +1044,7 @@ VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp)
event.header.eventId = 0;
event.header.classSet = VNET_EVENT_CLASS_UPLINK;
event.header.type = VNET_EVENT_TYPE_LINK_STATE;
@@ -489,7 +491,7 @@ index 2b976d7..5298406 100644
* XXX kind of a hack, vmx will coalesce linkup/down if they come from the
* same adapter.
*/
-@@ -1063,8 +1069,8 @@ VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp)
+@@ -1065,8 +1069,8 @@ VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp)
*
* Create a user level port to the wonderful world of virtual
* networking.
@@ -500,7 +502,7 @@ index 2b976d7..5298406 100644
* Errno. Also returns an allocated port to connect to,
* NULL on error.
*
-@@ -1080,7 +1086,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT
+@@ -1082,7 +1086,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT
VNetUserIF *userIf;
static unsigned id = 0;
int retval;
@@ -509,7 +511,7 @@ index 2b976d7..5298406 100644
userIf = kmalloc(sizeof *userIf, GFP_USER);
if (!userIf) {
return -ENOMEM;
-@@ -1089,7 +1095,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT
+@@ -1091,7 +1095,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT
/*
* Initialize fields.
*/
@@ -518,7 +520,7 @@ index 2b976d7..5298406 100644
userIf->port.id = id++;
userIf->port.jack.peer = NULL;
-@@ -1134,7 +1140,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT
+@@ -1136,7 +1140,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT
/*
* Rest of fields.
*/
@@ -527,7 +529,7 @@ index 2b976d7..5298406 100644
userIf->port.flags = IFF_RUNNING;
memset(userIf->port.paddr, 0, sizeof userIf->port.paddr);
-@@ -1147,12 +1153,12 @@ VNetUserIf_Create(VNetPort **ret) // OUT
+@@ -1149,12 +1153,12 @@ VNetUserIf_Create(VNetPort **ret) // OUT
userIf->port.fileOpWrite = VNetUserIfWrite;
userIf->port.fileOpIoctl = VNetUserIfIoctl;
userIf->port.fileOpPoll = VNetUserIfPoll;