. Changes in shared code that don't affect open-vm-tools functionality.
. Don't linearize vmxnet3-shm tx packets. We don't need/want to linearize
shm packets, and the re-estimate of the number of TX descriptors needed was
too low. This led to next2fill skipping over next2comp and corruption of the
TX ring. This corruption caused device resets, which uncovered a race between
tq_xmit and reset_work. Finally, remove some suspicious code duplication and
replace with a call to vmxnet3_dev_kfree_skb.
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_GENERATE_NONCE,
VIX_COMMAND_CATEGORY_ALWAYS_ALLOWED),
+
+ VIX_DEFINE_COMMAND_INFO(VIX_COMMAND_CHANGE_DISPLAY_TOPOLOGY_MODES,
+ VIX_COMMAND_CATEGORY_ALWAYS_ALLOWED),
};
} // VixPropertyList_PropertyExists
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixPropertyList_NumItems --
+ *
+ * Returns a count of the properties in the list.
+ *
+ * Results:
+ * int - Number of properties in property list.
+ *
+ * Side effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+int
+VixPropertyList_NumItems(VixPropertyListImpl *propList) // IN
+{
+ VixPropertyValue *prop;
+ int count = 0;
+
+ if (propList == NULL) {
+ return 0;
+ }
+
+ for (prop = propList->properties; prop != NULL; prop = prop->next) {
+ ++count;
+ }
+
+ return count;
+} // VixPropertyList_NumItems
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixPropertyList_Empty --
+ *
+ * Returns whether the property list has no properties.
+ *
+ * Results:
+ * Bool - True iff property list has no properties.
+ *
+ * Side effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+Bool
+VixPropertyList_Empty(VixPropertyListImpl *propList) // IN
+{
+ return (propList == NULL || propList->properties == NULL);
+} // VixPropertyList_Empty
+
+
*/
#define FILEIO_OPEN_NO_TIME_MACHINE (1 << 15)
-// Flag passed to open() to get exclusive VMFS lock. This definition must
-// match USEROBJ_OPEN_EXCLUSIVE_LOCK in user_vsiTypes.h.
-#define O_EXCLUSIVE_LOCK 0x10000000
+/*
+ * Flag passed to open() to not attempt to get the lun attributes as part of
+ * the open operation. Applicable only to opening of SCSI devices. This
+ * definition must match the definition of USEROBJ_OPEN_NOATTR in
+ * user_vsiTypes.h and FS_OPEN_NOATTR in fs_public.h
+ */
+#define O_NOATTR 0x04000000
// Flag passed to open() to get multiwriter VMFS lock. This definition must
// match USEROBJ_OPEN_MULTIWRITER_LOCK in user_vsiTypes.h.
#define O_MULTIWRITER_LOCK 0x08000000
+// Flag passed to open() to get exclusive VMFS lock. This definition must
+// match USEROBJ_OPEN_EXCLUSIVE_LOCK in user_vsiTypes.h.
+#define O_EXCLUSIVE_LOCK 0x10000000
/* File Access check args */
#define FILEIO_ACCESS_READ (1 << 0)
#include "vmware_pack_end.h"
VixMsgFaultToleranceControlRequest;
+typedef
+#include "vmware_pack_begin.h"
+struct VixFaultToleranceControlResponse {
+ VixCommandResponseHeader header;
+ uint32 propertyListBufferSize;
+ // Followed by a serialized property list containing error context.
+}
+#include "vmware_pack_end.h"
+VixFaultToleranceControlResponse;
/*
VIX_COMMAND_GENERATE_NONCE = 174,
+ VIX_COMMAND_CHANGE_DISPLAY_TOPOLOGY_MODES = 175,
+
/*
* HOWTO: Adding a new Vix Command. Step 2a.
*
* Once a new command is added here, a command info field needs to be added
* in bora/lib/foundryMsg. as well.
*/
- VIX_COMMAND_LAST_NORMAL_COMMAND = 175,
+ VIX_COMMAND_LAST_NORMAL_COMMAND = 176,
VIX_TEST_UNSUPPORTED_TOOLS_OPCODE_COMMAND = 998,
VIX_TEST_UNSUPPORTED_VMX_OPCODE_COMMAND = 999,
int propertyID,
void *value);
+int VixPropertyList_NumItems(VixPropertyListImpl *propList);
+
+Bool VixPropertyList_Empty(VixPropertyListImpl *propList);
#endif // VIX_HIDE_FROM_JAVA
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
+# define compat_netif_tx_lock(dev) netif_tx_lock(dev)
+# define compat_netif_tx_unlock(dev) netif_tx_unlock(dev)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
+# define compat_netif_tx_lock(dev) spin_lock(&dev->xmit_lock)
+# define compat_netif_tx_unlock(dev) spin_unlock(&dev->xmit_lock)
+#else
+/* Vendor backporting (SLES 10) has muddled the tx_lock situation. Pick whichever
+ * of the above works for you. */
+# define compat_netif_tx_lock(dev) do {} while (0)
+# define compat_netif_tx_unlock(dev) do {} while (0)
+#endif
+
#endif /* __COMPAT_NETDEVICE_H__ */
tq->stats.drop_too_many_frags++;
goto drop_pkt;
}
- }
+ } else {
+ /* non-tso pkts must not use more than VMXNET3_MAX_TXD_PER_PKT entries */
+ if (compat_skb_linearize(skb) != 0) {
+ tq->stats.drop_too_many_frags++;
+ goto drop_pkt;
+ }
+ tq->stats.linearized++;
- /* non-tso pkts must not use more than VMXNET3_MAX_TXD_PER_PKT entries */
- if (compat_skb_linearize(skb) != 0) {
- tq->stats.drop_too_many_frags++;
- goto drop_pkt;
+ /* recalculate the # of descriptors to use */
+ count = VMXNET3_TXD_NEEDED(vmxnet3_skb_headlen(adapter, skb)) + 1;
}
- tq->stats.linearized++;
-
- /* recalculate the # of descriptors to use */
- count = VMXNET3_TXD_NEEDED(vmxnet3_skb_headlen(adapter, skb)) + 1;
}
}
static int
vmxnet3_shm_consume_user_tx_queue(struct vmxnet3_shm_pool *shm);
+int
+vmxnet3_shm_tq_xmit(struct sk_buff *skb,
+ struct vmxnet3_tx_queue *tq,
+ struct vmxnet3_adapter *adapter,
+ struct net_device *netdev);
/*
*----------------------------------------------------------------------------
*
* Send a packet (collection of ring entries) using h/w tx routine.
*
+ * Protected by shm.tx_lock
+ *
* Results:
* 0 on success. Negative value to indicate error
*
{
struct vmxnet3_tx_queue *tq = &adapter->tx_queue;
int ret;
- skb->protocol = cpu_to_be16(0x86dd);
+ skb->protocol = htons(ETH_P_IPV6);
adapter->shm->ctl.ptr->stats.kernel_tx += frags; // XXX: move to better place
- ret = vmxnet3_tq_xmit(skb, tq, adapter, adapter->netdev);
+ ret = vmxnet3_shm_tq_xmit(skb, tq, adapter, adapter->netdev);
if (ret == COMPAT_NETDEV_TX_BUSY) {
- for (i = 0; i < frags; i++) {
- vmxnet3_shm_free_page(adapter->shm, res[i].idx);
- }
- skb_shinfo(skb)->nr_frags = 0;
- kfree_skb(skb);
+ vmxnet3_dev_kfree_skb(adapter, skb);
}
return ret;
return 0;
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * vmxnet3_shm_tq_xmit --
+ *
+ * Wrap vmxnet3_tq_xmit holding the netdev tx lock to better emulate the
+ * Linux stack. Also check for a stopped tx queue to avoid racing with
+ * vmxnet3_close.
+ *
+ * Results:
+ * Same as vmxnet3_tq_xmit.
+ *
+ * Side effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+int
+vmxnet3_shm_tq_xmit(struct sk_buff *skb,
+ struct vmxnet3_tx_queue *tq,
+ struct vmxnet3_adapter *adapter,
+ struct net_device *netdev)
+{
+ int ret = COMPAT_NETDEV_TX_BUSY;
+ compat_netif_tx_lock(netdev);
+ if (!netif_queue_stopped(netdev)) {
+ ret = vmxnet3_tq_xmit(skb, tq, adapter, netdev);
+ }
+ compat_netif_tx_unlock(netdev);
+ return ret;
+}
+
/*
*-----------------------------------------------------------------------------