Commit d223d194 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'vmxnet3-upgrade-to-version-9'

Ronak Doshi says:

====================
vmxnet3: upgrade to version 9

vmxnet3 emulation has recently added timestamping feature which allows the
hypervisor (ESXi) to calculate latency from guest virtual NIC driver to all
the way up to the physical NIC. This patch series extends vmxnet3 driver
to leverage these new feature.

Compatibility is maintained using existing vmxnet3 versioning mechanism as
follows:
 - new features added to vmxnet3 emulation are associated with new vmxnet3
   version viz. vmxnet3 version 9.
 - emulation advertises all the versions it supports to the driver.
 - during initialization, vmxnet3 driver picks the highest version number
   supported by both the emulation and the driver and configures emulation
   to run at that version.

In particular, following changes are introduced:

Patch 1:
  This patch introduces utility macros for vmxnet3 version 9 comparison
  and updates Copyright information.

Patch 2:
  This patch adds support to timestamp the packets so as to allow latency
  measurement in the ESXi.

Patch 3:
  This patch adds support to disable certain offloads on the device based
  on the request specified by the user in the VM configuration.

Patch 4:
  With all vmxnet3 version 9 changes incorporated in the vmxnet3 driver,
  with this patch, the driver can configure emulation to run at vmxnet3
  version 9.
====================

Link: https://lore.kernel.org/r/20240531193050.4132-1-ronak.doshi@broadcom.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 1467713e 63587234
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Linux driver for VMware's vmxnet3 ethernet NIC. # Linux driver for VMware's vmxnet3 ethernet NIC.
# #
# Copyright (C) 2007-2022, VMware, Inc. All Rights Reserved. # Copyright (C) 2007-2024, VMware, Inc. All Rights Reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the # under the terms of the GNU General Public License as published by the
......
/* /*
* Linux driver for VMware's vmxnet3 ethernet NIC. * Linux driver for VMware's vmxnet3 ethernet NIC.
* *
* Copyright (C) 2008-2022, VMware, Inc. All Rights Reserved. * Copyright (C) 2008-2024, VMware, Inc. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
...@@ -80,6 +80,8 @@ enum { ...@@ -80,6 +80,8 @@ enum {
#define VMXNET3_IO_TYPE(addr) ((addr) >> 24) #define VMXNET3_IO_TYPE(addr) ((addr) >> 24)
#define VMXNET3_IO_REG(addr) ((addr) & 0xFFFFFF) #define VMXNET3_IO_REG(addr) ((addr) & 0xFFFFFF)
#define VMXNET3_PMC_PSEUDO_TSC 0x10003
enum { enum {
VMXNET3_CMD_FIRST_SET = 0xCAFE0000, VMXNET3_CMD_FIRST_SET = 0xCAFE0000,
VMXNET3_CMD_ACTIVATE_DEV = VMXNET3_CMD_FIRST_SET, VMXNET3_CMD_ACTIVATE_DEV = VMXNET3_CMD_FIRST_SET,
...@@ -123,6 +125,8 @@ enum { ...@@ -123,6 +125,8 @@ enum {
VMXNET3_CMD_GET_RESERVED4, VMXNET3_CMD_GET_RESERVED4,
VMXNET3_CMD_GET_MAX_CAPABILITIES, VMXNET3_CMD_GET_MAX_CAPABILITIES,
VMXNET3_CMD_GET_DCR0_REG, VMXNET3_CMD_GET_DCR0_REG,
VMXNET3_CMD_GET_TSRING_DESC_SIZE,
VMXNET3_CMD_GET_DISABLED_OFFLOADS,
}; };
/* /*
...@@ -254,6 +258,24 @@ struct Vmxnet3_RxDesc { ...@@ -254,6 +258,24 @@ struct Vmxnet3_RxDesc {
#define VMXNET3_RCD_HDR_INNER_SHIFT 13 #define VMXNET3_RCD_HDR_INNER_SHIFT 13
struct Vmxnet3TSInfo {
u64 tsData:56;
u64 tsType:4;
u64 tsi:1; //bit to indicate to set ts
u64 pad:3;
u64 pad2;
};
struct Vmxnet3_TxTSDesc {
struct Vmxnet3TSInfo ts;
u64 pad[14];
};
struct Vmxnet3_RxTSDesc {
struct Vmxnet3TSInfo ts;
u64 pad[14];
};
struct Vmxnet3_RxCompDesc { struct Vmxnet3_RxCompDesc {
#ifdef __BIG_ENDIAN_BITFIELD #ifdef __BIG_ENDIAN_BITFIELD
u32 ext2:1; u32 ext2:1;
...@@ -427,6 +449,13 @@ union Vmxnet3_GenericDesc { ...@@ -427,6 +449,13 @@ union Vmxnet3_GenericDesc {
#define VMXNET3_RXDATA_DESC_SIZE_ALIGN 64 #define VMXNET3_RXDATA_DESC_SIZE_ALIGN 64
#define VMXNET3_RXDATA_DESC_SIZE_MASK (VMXNET3_RXDATA_DESC_SIZE_ALIGN - 1) #define VMXNET3_RXDATA_DESC_SIZE_MASK (VMXNET3_RXDATA_DESC_SIZE_ALIGN - 1)
/* Rx TS Ring buffer size must be a multiple of 64 bytes */
#define VMXNET3_RXTS_DESC_SIZE_ALIGN 64
#define VMXNET3_RXTS_DESC_SIZE_MASK (VMXNET3_RXTS_DESC_SIZE_ALIGN - 1)
/* Tx TS Ring buffer size must be a multiple of 64 bytes */
#define VMXNET3_TXTS_DESC_SIZE_ALIGN 64
#define VMXNET3_TXTS_DESC_SIZE_MASK (VMXNET3_TXTS_DESC_SIZE_ALIGN - 1)
/* Max ring size */ /* Max ring size */
#define VMXNET3_TX_RING_MAX_SIZE 4096 #define VMXNET3_TX_RING_MAX_SIZE 4096
#define VMXNET3_TC_RING_MAX_SIZE 4096 #define VMXNET3_TC_RING_MAX_SIZE 4096
...@@ -439,6 +468,9 @@ union Vmxnet3_GenericDesc { ...@@ -439,6 +468,9 @@ union Vmxnet3_GenericDesc {
#define VMXNET3_RXDATA_DESC_MAX_SIZE 2048 #define VMXNET3_RXDATA_DESC_MAX_SIZE 2048
#define VMXNET3_TXTS_DESC_MAX_SIZE 256
#define VMXNET3_RXTS_DESC_MAX_SIZE 256
/* a list of reasons for queue stop */ /* a list of reasons for queue stop */
enum { enum {
...@@ -546,6 +578,24 @@ struct Vmxnet3_RxQueueConf { ...@@ -546,6 +578,24 @@ struct Vmxnet3_RxQueueConf {
}; };
struct Vmxnet3_LatencyConf {
u16 sampleRate;
u16 pad;
};
struct Vmxnet3_TxQueueTSConf {
__le64 txTSRingBasePA;
__le16 txTSRingDescSize; /* size of tx timestamp ring buffer */
u16 pad;
struct Vmxnet3_LatencyConf latencyConf;
};
struct Vmxnet3_RxQueueTSConf {
__le64 rxTSRingBasePA;
__le16 rxTSRingDescSize; /* size of rx timestamp ring buffer */
u16 pad[3];
};
enum vmxnet3_intr_mask_mode { enum vmxnet3_intr_mask_mode {
VMXNET3_IMM_AUTO = 0, VMXNET3_IMM_AUTO = 0,
VMXNET3_IMM_ACTIVE = 1, VMXNET3_IMM_ACTIVE = 1,
...@@ -679,7 +729,8 @@ struct Vmxnet3_TxQueueDesc { ...@@ -679,7 +729,8 @@ struct Vmxnet3_TxQueueDesc {
/* Driver read after a GET command */ /* Driver read after a GET command */
struct Vmxnet3_QueueStatus status; struct Vmxnet3_QueueStatus status;
struct UPT1_TxStats stats; struct UPT1_TxStats stats;
u8 _pad[88]; /* 128 aligned */ struct Vmxnet3_TxQueueTSConf tsConf;
u8 _pad[72]; /* 128 aligned */
}; };
...@@ -689,7 +740,8 @@ struct Vmxnet3_RxQueueDesc { ...@@ -689,7 +740,8 @@ struct Vmxnet3_RxQueueDesc {
/* Driver read after a GET commad */ /* Driver read after a GET commad */
struct Vmxnet3_QueueStatus status; struct Vmxnet3_QueueStatus status;
struct UPT1_RxStats stats; struct UPT1_RxStats stats;
u8 __pad[88]; /* 128 aligned */ struct Vmxnet3_RxQueueTSConf tsConf;
u8 __pad[72]; /* 128 aligned */
}; };
struct Vmxnet3_SetPolling { struct Vmxnet3_SetPolling {
...@@ -861,4 +913,7 @@ struct Vmxnet3_DriverShared { ...@@ -861,4 +913,7 @@ struct Vmxnet3_DriverShared {
/* when new capability is introduced, update VMXNET3_CAP_MAX */ /* when new capability is introduced, update VMXNET3_CAP_MAX */
#define VMXNET3_CAP_MAX VMXNET3_CAP_VERSION_7_MAX #define VMXNET3_CAP_MAX VMXNET3_CAP_VERSION_7_MAX
#define VMXNET3_OFFLOAD_TSO BIT(0)
#define VMXNET3_OFFLOAD_LRO BIT(1)
#endif /* _VMXNET3_DEFS_H_ */ #endif /* _VMXNET3_DEFS_H_ */
This diff is collapsed.
/* /*
* Linux driver for VMware's vmxnet3 ethernet NIC. * Linux driver for VMware's vmxnet3 ethernet NIC.
* *
* Copyright (C) 2008-2022, VMware, Inc. All Rights Reserved. * Copyright (C) 2008-2024, VMware, Inc. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
......
/* /*
* Linux driver for VMware's vmxnet3 ethernet NIC. * Linux driver for VMware's vmxnet3 ethernet NIC.
* *
* Copyright (C) 2008-2022, VMware, Inc. All Rights Reserved. * Copyright (C) 2008-2024, VMware, Inc. All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
...@@ -72,18 +72,20 @@ ...@@ -72,18 +72,20 @@
/* /*
* Version numbers * Version numbers
*/ */
#define VMXNET3_DRIVER_VERSION_STRING "1.7.0.0-k" #define VMXNET3_DRIVER_VERSION_STRING "1.9.0.0-k"
/* Each byte of this 32-bit integer encodes a version number in /* Each byte of this 32-bit integer encodes a version number in
* VMXNET3_DRIVER_VERSION_STRING. * VMXNET3_DRIVER_VERSION_STRING.
*/ */
#define VMXNET3_DRIVER_VERSION_NUM 0x01070000 #define VMXNET3_DRIVER_VERSION_NUM 0x01090000
#if defined(CONFIG_PCI_MSI) #if defined(CONFIG_PCI_MSI)
/* RSS only makes sense if MSI-X is supported. */ /* RSS only makes sense if MSI-X is supported. */
#define VMXNET3_RSS #define VMXNET3_RSS
#endif #endif
#define VMXNET3_REV_9 8 /* Vmxnet3 Rev. 9 */
#define VMXNET3_REV_8 7 /* Vmxnet3 Rev. 8 */
#define VMXNET3_REV_7 6 /* Vmxnet3 Rev. 7 */ #define VMXNET3_REV_7 6 /* Vmxnet3 Rev. 7 */
#define VMXNET3_REV_6 5 /* Vmxnet3 Rev. 6 */ #define VMXNET3_REV_6 5 /* Vmxnet3 Rev. 6 */
#define VMXNET3_REV_5 4 /* Vmxnet3 Rev. 5 */ #define VMXNET3_REV_5 4 /* Vmxnet3 Rev. 5 */
...@@ -191,6 +193,11 @@ struct vmxnet3_tx_data_ring { ...@@ -191,6 +193,11 @@ struct vmxnet3_tx_data_ring {
dma_addr_t basePA; dma_addr_t basePA;
}; };
struct vmxnet3_tx_ts_ring {
struct Vmxnet3_TxTSDesc *base;
dma_addr_t basePA;
};
#define VMXNET3_MAP_NONE 0 #define VMXNET3_MAP_NONE 0
#define VMXNET3_MAP_SINGLE BIT(0) #define VMXNET3_MAP_SINGLE BIT(0)
#define VMXNET3_MAP_PAGE BIT(1) #define VMXNET3_MAP_PAGE BIT(1)
...@@ -243,6 +250,7 @@ struct vmxnet3_tx_ctx { ...@@ -243,6 +250,7 @@ struct vmxnet3_tx_ctx {
u32 copy_size; /* # of bytes copied into the data ring */ u32 copy_size; /* # of bytes copied into the data ring */
union Vmxnet3_GenericDesc *sop_txd; union Vmxnet3_GenericDesc *sop_txd;
union Vmxnet3_GenericDesc *eop_txd; union Vmxnet3_GenericDesc *eop_txd;
struct Vmxnet3_TxTSDesc *ts_txd;
}; };
struct vmxnet3_tx_queue { struct vmxnet3_tx_queue {
...@@ -252,6 +260,7 @@ struct vmxnet3_tx_queue { ...@@ -252,6 +260,7 @@ struct vmxnet3_tx_queue {
struct vmxnet3_cmd_ring tx_ring; struct vmxnet3_cmd_ring tx_ring;
struct vmxnet3_tx_buf_info *buf_info; struct vmxnet3_tx_buf_info *buf_info;
struct vmxnet3_tx_data_ring data_ring; struct vmxnet3_tx_data_ring data_ring;
struct vmxnet3_tx_ts_ring ts_ring;
struct vmxnet3_comp_ring comp_ring; struct vmxnet3_comp_ring comp_ring;
struct Vmxnet3_TxQueueCtrl *shared; struct Vmxnet3_TxQueueCtrl *shared;
struct vmxnet3_tq_driver_stats stats; struct vmxnet3_tq_driver_stats stats;
...@@ -260,6 +269,8 @@ struct vmxnet3_tx_queue { ...@@ -260,6 +269,8 @@ struct vmxnet3_tx_queue {
* stopped */ * stopped */
int qid; int qid;
u16 txdata_desc_size; u16 txdata_desc_size;
u16 tx_ts_desc_size;
u16 tsPktCount;
} ____cacheline_aligned; } ____cacheline_aligned;
enum vmxnet3_rx_buf_type { enum vmxnet3_rx_buf_type {
...@@ -307,6 +318,11 @@ struct vmxnet3_rx_data_ring { ...@@ -307,6 +318,11 @@ struct vmxnet3_rx_data_ring {
u16 desc_size; u16 desc_size;
}; };
struct vmxnet3_rx_ts_ring {
struct Vmxnet3_RxTSDesc *base;
dma_addr_t basePA;
};
struct vmxnet3_rx_queue { struct vmxnet3_rx_queue {
char name[IFNAMSIZ + 8]; /* To identify interrupt */ char name[IFNAMSIZ + 8]; /* To identify interrupt */
struct vmxnet3_adapter *adapter; struct vmxnet3_adapter *adapter;
...@@ -314,6 +330,7 @@ struct vmxnet3_rx_queue { ...@@ -314,6 +330,7 @@ struct vmxnet3_rx_queue {
struct vmxnet3_cmd_ring rx_ring[2]; struct vmxnet3_cmd_ring rx_ring[2];
struct vmxnet3_rx_data_ring data_ring; struct vmxnet3_rx_data_ring data_ring;
struct vmxnet3_comp_ring comp_ring; struct vmxnet3_comp_ring comp_ring;
struct vmxnet3_rx_ts_ring ts_ring;
struct vmxnet3_rx_ctx rx_ctx; struct vmxnet3_rx_ctx rx_ctx;
u32 qid; /* rqID in RCD for buffer from 1st ring */ u32 qid; /* rqID in RCD for buffer from 1st ring */
u32 qid2; /* rqID in RCD for buffer from 2nd ring */ u32 qid2; /* rqID in RCD for buffer from 2nd ring */
...@@ -323,6 +340,7 @@ struct vmxnet3_rx_queue { ...@@ -323,6 +340,7 @@ struct vmxnet3_rx_queue {
struct vmxnet3_rq_driver_stats stats; struct vmxnet3_rq_driver_stats stats;
struct page_pool *page_pool; struct page_pool *page_pool;
struct xdp_rxq_info xdp_rxq; struct xdp_rxq_info xdp_rxq;
u16 rx_ts_desc_size;
} ____cacheline_aligned; } ____cacheline_aligned;
#define VMXNET3_DEVICE_MAX_TX_QUEUES 32 #define VMXNET3_DEVICE_MAX_TX_QUEUES 32
...@@ -432,6 +450,11 @@ struct vmxnet3_adapter { ...@@ -432,6 +450,11 @@ struct vmxnet3_adapter {
u16 rx_prod_offset; u16 rx_prod_offset;
u16 rx_prod2_offset; u16 rx_prod2_offset;
struct bpf_prog __rcu *xdp_bpf_prog; struct bpf_prog __rcu *xdp_bpf_prog;
struct Vmxnet3_LatencyConf *latencyConf;
/* Size of buffer in the ts ring */
u16 tx_ts_desc_size;
u16 rx_ts_desc_size;
u32 disabledOffloads;
}; };
#define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \ #define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \
...@@ -463,6 +486,10 @@ struct vmxnet3_adapter { ...@@ -463,6 +486,10 @@ struct vmxnet3_adapter {
(adapter->version >= VMXNET3_REV_6 + 1) (adapter->version >= VMXNET3_REV_6 + 1)
#define VMXNET3_VERSION_GE_7(adapter) \ #define VMXNET3_VERSION_GE_7(adapter) \
(adapter->version >= VMXNET3_REV_7 + 1) (adapter->version >= VMXNET3_REV_7 + 1)
#define VMXNET3_VERSION_GE_8(adapter) \
(adapter->version >= VMXNET3_REV_8 + 1)
#define VMXNET3_VERSION_GE_9(adapter) \
(adapter->version >= VMXNET3_REV_9 + 1)
/* must be a multiple of VMXNET3_RING_SIZE_ALIGN */ /* must be a multiple of VMXNET3_RING_SIZE_ALIGN */
#define VMXNET3_DEF_TX_RING_SIZE 512 #define VMXNET3_DEF_TX_RING_SIZE 512
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment