vmxnet3: upgrade to version 3
Subsystems (3)
v4 cover vmxnet3: upgrade to version 3
This patchset upgrades vmxnet3 to version 3.
Changes in v2:
- Following patch is updated. See that patch for details:
vmxnet3: add support for get_coalesce, set_coalesce ethtool
Changes in v3:
- fix subject line to use vmxnet3: instead of Driver:Vmxnet3
- resubmit when net-next is open
Changes in v4:
- Following patch is updated. See that patch for details:
vmxnet3: add support for get_coalesce, set_coalesce ethtool
Shrikrishna Khare (7):
vmxnet3: prepare for version 3 changes
vmxnet3: introduce generic command interface to configure the device
vmxnet3: allow variable length transmit data ring buffer
vmxnet3: add receive data ring support
vmxnet3: add support for get_coalesce, set_coalesce ethtool operations
vmxnet3: introduce command to register memory region
vmxnet3: update to version 3
drivers/net/vmxnet3/Makefile | 4 +- drivers/net/vmxnet3/upt1_defs.h | 4 +- drivers/net/vmxnet3/vmxnet3_defs.h | 105 ++++++++++++- drivers/net/vmxnet3/vmxnet3_drv.c | 285 ++++++++++++++++++++++++++++------ drivers/net/vmxnet3/vmxnet3_ethtool.c | 215 +++++++++++++++++++++++-- drivers/net/vmxnet3/vmxnet3_int.h | 54 ++++++- 6 files changed, 585 insertions(+), 82 deletions(-)
Signature · 1 line
2.8.2
PATCH v4 1/7 vmxnet3: prepare for version 3 changes
--- drivers/net/vmxnet3/Makefile | 4 ++-- drivers/net/vmxnet3/upt1_defs.h | 4 ++-- drivers/net/vmxnet3/vmxnet3_defs.h | 9 ++++++--- drivers/net/vmxnet3/vmxnet3_drv.c | 22 +++++++++++++--------- drivers/net/vmxnet3/vmxnet3_ethtool.c | 4 ++-- drivers/net/vmxnet3/vmxnet3_int.h | 13 +++++++++++-- 6 files changed, 36 insertions(+), 20 deletions(-)
drivers/net/vmxnet3/Makefile +2 -2
@@ -2,7 +2,7 @@ # # Linux driver for VMware's vmxnet3 ethernet NIC. # -# Copyright (C) 2007-2009, VMware, Inc. All Rights Reserved. +# Copyright (C) 2007-2016, VMware, Inc. All Rights Reserved. # # 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
@@ -21,7 +21,7 @@ # The full GNU General Public License is included in this distribution in # the file called "COPYING". # -# Maintained by: Shreyas Bhatewara <[email protected]> +# Maintained by: [email protected] # # ################################################################################
drivers/net/vmxnet3/upt1_defs.h +2 -2
@@ -1,7 +1,7 @@/* * Linux driver for VMware's vmxnet3 ethernet NIC. * -* Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. +* Copyright (C) 2008-2016, VMware, Inc. All Rights Reserved. * * 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
@@ -20,7 +20,7 @@* The full GNU General Public License is included in this distribution in * the file called "COPYING". * -* Maintained by: Shreyas Bhatewara <[email protected]> +* Maintained by: [email protected] * */
drivers/net/vmxnet3/vmxnet3_defs.h +6 -3
@@ -1,7 +1,7 @@/* * Linux driver for VMware's vmxnet3 ethernet NIC. * -* Copyright (C) 2008-2015, VMware, Inc. All Rights Reserved. +* Copyright (C) 2008-2016, VMware, Inc. All Rights Reserved. * * 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
@@ -20,7 +20,7 @@* The full GNU General Public License is included in this distribution in * the file called "COPYING". * -* Maintained by: Shreyas Bhatewara <[email protected]> +* Maintained by: [email protected] * */
@@ -76,7 +76,9 @@ enum {VMXNET3_CMD_UPDATE_IML ,VMXNET3_CMD_UPDATE_PMCFG ,VMXNET3_CMD_UPDATE_FEATURE , +VMXNET3_CMD_RESERVED1 ,VMXNET3_CMD_LOAD_PLUGIN , +VMXNET3_CMD_RESERVED2 ,VMXNET3_CMD_FIRST_GET =0xF00D0000 , VMXNET3_CMD_GET_QUEUE_STATUS = VMXNET3_CMD_FIRST_GET,
@@ -87,7 +89,8 @@ enum {VMXNET3_CMD_GET_DID_LO ,VMXNET3_CMD_GET_DID_HI ,VMXNET3_CMD_GET_DEV_EXTRA_INFO , - VMXNET3_CMD_GET_CONF_INTR +VMXNET3_CMD_GET_CONF_INTR , + VMXNET3_CMD_GET_RESERVED1, };/*
drivers/net/vmxnet3/vmxnet3_drv.c +13 -9
@@ -1,7 +1,7 @@/* * Linux driver for VMware's vmxnet3 ethernet NIC. * -* Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. +* Copyright (C) 2008-2016, VMware, Inc. All Rights Reserved. * * 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
@@ -20,7 +20,7 @@* The full GNU General Public License is included in this distribution in * the file called "COPYING". * -* Maintained by: Shreyas Bhatewara <[email protected]> +* Maintained by: [email protected] * */
@@ -1363,7 +1363,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, rbi->dma_addr = new_dma_addr; rxd->addr =cpu_to_le64 (rbi->dma_addr); rxd->len = rbi->len; -if (adapter->version ==2 && +if (VMXNET3_VERSION_GE_2 (adapter) && rcd->type ==VMXNET3_CDTYPE_RXCOMP_LRO ) {struct Vmxnet3_RxCompDescExt *rcdlro; rcdlro = (struct Vmxnet3_RxCompDescExt *)rcd;
@@ -3200,12 +3200,16 @@ vmxnet3_probe_device(struct pci_dev *pdev, goto err_alloc_pci; ver =VMXNET3_READ_BAR1_REG (adapter,VMXNET3_REG_VRRS ); -if (ver &2 ) { -VMXNET3_WRITE_BAR1_REG (adapter,VMXNET3_REG_VRRS ,2 ); - adapter->version =2 ; - }else if (ver &1 ) { -VMXNET3_WRITE_BAR1_REG (adapter,VMXNET3_REG_VRRS ,1 ); - adapter->version =1 ; +if (ver & (1 <<VMXNET3_REV_2 )) { +VMXNET3_WRITE_BAR1_REG (adapter, +VMXNET3_REG_VRRS , +1 <<VMXNET3_REV_2 ); + adapter->version =VMXNET3_REV_2 +1 ; + }else if (ver & (1 <<VMXNET3_REV_1 )) { +VMXNET3_WRITE_BAR1_REG (adapter, +VMXNET3_REG_VRRS , +1 <<VMXNET3_REV_1 ); + adapter->version =VMXNET3_REV_1 +1 ; }else {dev_err (&pdev->dev,"Incompatible h/w version (0x%x) for adapter\n" , ver);
drivers/net/vmxnet3/vmxnet3_ethtool.c +2 -2
@@ -1,7 +1,7 @@/* * Linux driver for VMware's vmxnet3 ethernet NIC. * -* Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. +* Copyright (C) 2008-2016, VMware, Inc. All Rights Reserved. * * 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
@@ -20,7 +20,7 @@* The full GNU General Public License is included in this distribution in * the file called "COPYING". * -* Maintained by: Shreyas Bhatewara <[email protected]> +* Maintained by: [email protected] * */
drivers/net/vmxnet3/vmxnet3_int.h +11 -2
@@ -1,7 +1,7 @@/* * Linux driver for VMware's vmxnet3 ethernet NIC. * -* Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. +* Copyright (C) 2008-2016, VMware, Inc. All Rights Reserved. * * 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
@@ -20,7 +20,7 @@* The full GNU General Public License is included in this distribution in * the file called "COPYING". * -* Maintained by: Shreyas Bhatewara <[email protected]> +* Maintained by: [email protected] * */
@@ -79,6 +79,10 @@#define VMXNET3_RSS #endif +#define VMXNET3_REV_3 2/* Vmxnet3 Rev. 3 */ +#define VMXNET3_REV_2 1/* Vmxnet3 Rev. 2 */ +#define VMXNET3_REV_1 0/* Vmxnet3 Rev. 1 */ +/* * Capabilities */
@@ -387,6 +391,11 @@ struct vmxnet3_adapter {#define VMXNET3_GET_ADDR_LO (dma) ((u32)(dma))#define VMXNET3_GET_ADDR_HI (dma) ((u32)(((u64)(dma)) >> 32)) +#define VMXNET3_VERSION_GE_2 (adapter) \ + (adapter->version >= VMXNET3_REV_2 + 1) +#define VMXNET3_VERSION_GE_3 (adapter) \ + (adapter->version >= VMXNET3_REV_3 + 1) +/* must be a multiple of VMXNET3_RING_SIZE_ALIGN */ #define VMXNET3_DEF_TX_RING_SIZE 512#define VMXNET3_DEF_RX_RING_SIZE 256
Signature · 1 line
2.8.2
PATCH v4 3/7 vmxnet3: allow variable length transmit data ring buffer
In reply to Shrikrishna Khare--- drivers/net/vmxnet3/vmxnet3_defs.h | 12 +++++++- drivers/net/vmxnet3/vmxnet3_drv.c | 55 ++++++++++++++++++++++++++--------- drivers/net/vmxnet3/vmxnet3_ethtool.c | 9 +++--- drivers/net/vmxnet3/vmxnet3_int.h | 7 ++++- 4 files changed, 64 insertions(+), 19 deletions(-)
drivers/net/vmxnet3/vmxnet3_defs.h +11 -1
@@ -92,6 +92,7 @@ enum {VMXNET3_CMD_GET_DEV_EXTRA_INFO ,VMXNET3_CMD_GET_CONF_INTR ,VMXNET3_CMD_GET_RESERVED1 , + VMXNET3_CMD_GET_TXDATA_DESC_SIZE };/*
@@ -377,6 +378,10 @@ union Vmxnet3_GenericDesc {#define VMXNET3_RING_SIZE_ALIGN 32#define VMXNET3_RING_SIZE_MASK (VMXNET3_RING_SIZE_ALIGN - 1) +/* Tx Data Ring buffer size must be a multiple of 64 */ +#define VMXNET3_TXDATA_DESC_SIZE_ALIGN 64 +#define VMXNET3_TXDATA_DESC_SIZE_MASK (VMXNET3_TXDATA_DESC_SIZE_ALIGN - 1) +/* Max ring size */ #define VMXNET3_TX_RING_MAX_SIZE 4096#define VMXNET3_TC_RING_MAX_SIZE 4096
@@ -384,6 +389,9 @@ union Vmxnet3_GenericDesc {#define VMXNET3_RX_RING2_MAX_SIZE 4096#define VMXNET3_RC_RING_MAX_SIZE 8192 +#define VMXNET3_TXDATA_DESC_MIN_SIZE 128 +#define VMXNET3_TXDATA_DESC_MAX_SIZE 2048 +/* a list of reasons for queue stop */ enum {
@@ -470,7 +478,9 @@ struct Vmxnet3_TxQueueConf {__le32 compRingSize;/* # of comp desc */ __le32 ddLen;/* size of driver data */ u8 intrIdx; -u8 _pad[7 ]; +u8 _pad1[1 ]; +__le16 txDataRingDescSize; +u8 _pad2[4 ]; };
drivers/net/vmxnet3/vmxnet3_drv.c +42 -13
118 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ethtool.c +5 -4
@@ -396,8 +396,7 @@ vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p) buf[j++] =VMXNET3_GET_ADDR_LO (tq->data_ring.basePA); buf[j++] =VMXNET3_GET_ADDR_HI (tq->data_ring.basePA); buf[j++] = tq->data_ring.size; -/* transmit data ring buffer size */ - buf[j++] =VMXNET3_HDR_COPY_SIZE ; + buf[j++] = tq->txdata_desc_size; buf[j++] =VMXNET3_GET_ADDR_LO (tq->comp_ring.basePA); buf[j++] =VMXNET3_GET_ADDR_HI (tq->comp_ring.basePA);
@@ -591,7 +590,8 @@ vmxnet3_set_ringparam(struct net_device *netdev,vmxnet3_rq_destroy_all (adapter); err =vmxnet3_create_queues (adapter, new_tx_ring_size, - new_rx_ring_size, new_rx_ring2_size); + new_rx_ring_size, new_rx_ring2_size, + adapter->txdata_desc_size);if (err) {/* failed, most likely because of OOM, try default
@@ -604,7 +604,8 @@ vmxnet3_set_ringparam(struct net_device *netdev, err =vmxnet3_create_queues (adapter, new_tx_ring_size, new_rx_ring_size, - new_rx_ring2_size); + new_rx_ring2_size, + adapter->txdata_desc_size);if (err) {netdev_err (netdev,"failed to create queues " "with default sizes. Closing it\n" );
drivers/net/vmxnet3/vmxnet3_int.h +6 -1
@@ -241,6 +241,7 @@ struct vmxnet3_tx_queue {int num_stop;/* # of times the queue is * stopped */ int qid; +u16 txdata_desc_size; } __attribute__((__aligned__(SMP_CACHE_BYTES)));enum vmxnet3_rx_buf_type {
@@ -363,6 +364,9 @@ struct vmxnet3_adapter {u32 rx_ring_size;u32 rx_ring2_size; +/* Size of buffer in the data ring */ +u16 txdata_desc_size; +struct work_struct work;unsigned long state;/* VMXNET3_STATE_BIT_xxx */
@@ -427,7 +431,8 @@ vmxnet3_set_features(struct net_device *netdev, netdev_features_t features);int vmxnet3_create_queues (struct vmxnet3_adapter *adapter, -u32 tx_ring_size,u32 rx_ring_size,u32 rx_ring2_size); +u32 tx_ring_size,u32 rx_ring_size,u32 rx_ring2_size, +u16 txdata_desc_size);void vmxnet3_set_ethtool_ops (struct net_device *netdev);
Signature · 1 line
2.8.2
PATCH v4 5/7 vmxnet3: add support for get_coalesce, set_coalesce ethtool operations
In reply to Shrikrishna Khare---
v1-v2: v1 patch used special values of rx-usecs to differentiate between coalescing modes. v2 uses relevant fields in struct ethtool_coalesce to choose modes. Also, a new command VMXNET3_CMD_GET_COALESCE is introduced which allows driver to query the device for default coalescing configuration.
v3-v4: address Ben's review comments: remove unnecessary memset from vmxnet3_get_coalesce.
--- drivers/net/vmxnet3/vmxnet3_defs.h | 33 ++++++- drivers/net/vmxnet3/vmxnet3_drv.c | 54 ++++++++++++ drivers/net/vmxnet3/vmxnet3_ethtool.c | 158 ++++++++++++++++++++++++++++++++++ drivers/net/vmxnet3/vmxnet3_int.h | 9 ++ 4 files changed, 253 insertions(+), 1 deletion(-)
drivers/net/vmxnet3/vmxnet3_defs.h +32 -1
@@ -80,6 +80,7 @@ enum {VMXNET3_CMD_LOAD_PLUGIN ,VMXNET3_CMD_RESERVED2 ,VMXNET3_CMD_RESERVED3 , +VMXNET3_CMD_SET_COALESCE ,VMXNET3_CMD_FIRST_GET =0xF00D0000 , VMXNET3_CMD_GET_QUEUE_STATUS = VMXNET3_CMD_FIRST_GET,
@@ -92,7 +93,8 @@ enum {VMXNET3_CMD_GET_DEV_EXTRA_INFO ,VMXNET3_CMD_GET_CONF_INTR ,VMXNET3_CMD_GET_RESERVED1 , - VMXNET3_CMD_GET_TXDATA_DESC_SIZE +VMXNET3_CMD_GET_TXDATA_DESC_SIZE , + VMXNET3_CMD_GET_COALESCE, };/*
@@ -637,6 +639,35 @@ struct Vmxnet3_SetPolling {u8 enablePolling; }; +#define VMXNET3_COAL_STATIC_MAX_DEPTH 128 +#define VMXNET3_COAL_RBC_MIN_RATE 100 +#define VMXNET3_COAL_RBC_MAX_RATE 100000 + +enum Vmxnet3_CoalesceMode { +VMXNET3_COALESCE_DISABLED =0 , +VMXNET3_COALESCE_ADAPT =1 , +VMXNET3_COALESCE_STATIC =2 , +VMXNET3_COALESCE_RBC =3 +}; + +struct Vmxnet3_CoalesceRbc { +u32 rbc_rate; +}; + +struct Vmxnet3_CoalesceStatic { +u32 tx_depth; +u32 tx_comp_depth; +u32 rx_depth; +}; + +struct Vmxnet3_CoalesceScheme { +enum Vmxnet3_CoalesceMode coalMode; +union { +struct Vmxnet3_CoalesceRbc coalRbc; +struct Vmxnet3_CoalesceStatic coalStatic; + } coalPara; +}; +/* If the command data <= 16 bytes, use the shared memory directly. * otherwise, use variable length configuration descriptor. */
drivers/net/vmxnet3/vmxnet3_drv.c +54 -0
84 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ethtool.c +158 -0
170 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_int.h +9 -0
@@ -358,6 +358,7 @@ struct vmxnet3_adapter {int rx_buf_per_pkt;/* only apply to the 1st ring */ dma_addr_t shared_pa;dma_addr_t queue_desc_pa; +dma_addr_t coal_conf_pa;/* Wake-on-LAN */ u32 wol;
@@ -384,6 +385,9 @@ struct vmxnet3_adapter {int share_intr; +struct Vmxnet3_CoalesceScheme *coal_conf; +bool default_coal_mode; +dma_addr_t adapter_pa;dma_addr_t pm_conf_pa;dma_addr_t rss_conf_pa;
@@ -429,6 +433,11 @@ struct vmxnet3_adapter { (rqID >=2 * adapter->num_rx_queues && \ rqID < 3 * adapter->num_rx_queues) \ +#define VMXNET3_COAL_STATIC_DEFAULT_DEPTH 64 + +#define VMXNET3_COAL_RBC_RATE (usecs) (1000000 / usecs) +#define VMXNET3_COAL_RBC_USECS (rbc_rate) (1000000 / rbc_rate) +int vmxnet3_quiesce_dev (struct vmxnet3_adapter *adapter);
Signature · 1 line
2.8.2
PATCH v4 2/7 vmxnet3: introduce generic command interface to configure the device
In reply to Shrikrishna Khare--- drivers/net/vmxnet3/vmxnet3_defs.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/net/vmxnet3/vmxnet3_defs.h +21 -1
@@ -79,6 +79,7 @@ enum {VMXNET3_CMD_RESERVED1 ,VMXNET3_CMD_LOAD_PLUGIN ,VMXNET3_CMD_RESERVED2 , +VMXNET3_CMD_RESERVED3 ,VMXNET3_CMD_FIRST_GET =0xF00D0000 , VMXNET3_CMD_GET_QUEUE_STATUS = VMXNET3_CMD_FIRST_GET,
@@ -612,6 +613,18 @@ struct Vmxnet3_RxQueueDesc {u8 __pad[88 ];/* 128 aligned */ }; +struct Vmxnet3_SetPolling { +u8 enablePolling; +}; + +/* If the command data <= 16 bytes, use the shared memory directly. +* otherwise, use variable length configuration descriptor. +*/ +union Vmxnet3_CmdInfo { +struct Vmxnet3_VariableLenConfDesc varConf; +struct Vmxnet3_SetPolling setPolling; +__le64 data[2 ]; +};struct Vmxnet3_DSDevRead {/* read-only region for device, read by dev in response to a SET cmd */
@@ -630,7 +643,14 @@ struct Vmxnet3_DriverShared {__le32 pad;struct Vmxnet3_DSDevRead devRead;__le32 ecr; -__le32 reserved[5 ]; +__le32 reserved; +union { +__le32 reserved1[4 ]; +union Vmxnet3_CmdInfo cmdInfo;/* only valid in the context of +* executing the relevant +* command +*/ + } cu; };
Signature · 1 line
2.8.2
PATCH v4 4/7 vmxnet3: add receive data ring support
In reply to Shrikrishna KhareReceive Data Ring buffer length is configurable via ethtool -G ethX rx-mini
--- drivers/net/vmxnet3/vmxnet3_defs.h | 14 +++- drivers/net/vmxnet3/vmxnet3_drv.c | 153 +++++++++++++++++++++++++++------- drivers/net/vmxnet3/vmxnet3_ethtool.c | 48 ++++++++--- drivers/net/vmxnet3/vmxnet3_int.h | 23 ++++- 4 files changed, 193 insertions(+), 45 deletions(-)
drivers/net/vmxnet3/vmxnet3_defs.h +12 -2
@@ -174,6 +174,8 @@ struct Vmxnet3_TxDataDesc {u8 data[VMXNET3_HDR_COPY_SIZE ]; }; +typedef u8 Vmxnet3_RxDataDesc ; +#define VMXNET3_TCD_GEN_SHIFT 31#define VMXNET3_TCD_GEN_SIZE 1#define VMXNET3_TCD_TXIDX_SHIFT 0
@@ -382,6 +384,10 @@ union Vmxnet3_GenericDesc {#define VMXNET3_TXDATA_DESC_SIZE_ALIGN 64#define VMXNET3_TXDATA_DESC_SIZE_MASK (VMXNET3_TXDATA_DESC_SIZE_ALIGN - 1) +/* Rx Data Ring buffer size must be a multiple of 64 */ +#define VMXNET3_RXDATA_DESC_SIZE_ALIGN 64 +#define VMXNET3_RXDATA_DESC_SIZE_MASK (VMXNET3_RXDATA_DESC_SIZE_ALIGN - 1) +/* Max ring size */ #define VMXNET3_TX_RING_MAX_SIZE 4096#define VMXNET3_TC_RING_MAX_SIZE 4096
@@ -392,6 +398,8 @@ union Vmxnet3_GenericDesc {#define VMXNET3_TXDATA_DESC_MIN_SIZE 128#define VMXNET3_TXDATA_DESC_MAX_SIZE 2048 +#define VMXNET3_RXDATA_DESC_MAX_SIZE 2048 +/* a list of reasons for queue stop */ enum {
@@ -488,12 +496,14 @@ struct Vmxnet3_RxQueueConf {__le64 rxRingBasePA[2 ];__le64 compRingBasePA;__le64 ddPA;/* driver data */ -__le64 reserved; +__le64 rxDataRingBasePA;__le32 rxRingSize[2 ];/* # of rx desc */ __le32 compRingSize;/* # of rx comp desc */ __le32 ddLen;/* size of driver data */ u8 intrIdx; -u8 _pad[7 ]; +u8 _pad1[1 ]; +__le16 rxDataRingDescSize;/* size of rx data ring buffer */ +u8 _pad2[4 ]; };
drivers/net/vmxnet3/vmxnet3_drv.c +122 -31
267 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ethtool.c +37 -11
106 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_int.h +22 -1
@@ -272,15 +272,23 @@ struct vmxnet3_rq_driver_stats {u64 rx_buf_alloc_failure; }; +struct vmxnet3_rx_data_ring { +Vmxnet3_RxDataDesc *base; +dma_addr_t basePA; +u16 desc_size; +}; +struct vmxnet3_rx_queue {char name[IFNAMSIZ +8 ];/* To identify interrupt */ struct vmxnet3_adapter *adapter;struct napi_struct napi;struct vmxnet3_cmd_ring rx_ring[2 ]; +struct vmxnet3_rx_data_ring data_ring;struct vmxnet3_comp_ring comp_ring;struct vmxnet3_rx_ctx rx_ctx;u32 qid;/* rqID in RCD for buffer from 1st ring */ u32 qid2;/* rqID in RCD for buffer from 2nd ring */ +u32 dataRingQid;/* rqID in RCD for buffer from data ring */ struct vmxnet3_rx_buf_info *buf_info[2 ];dma_addr_t buf_info_pa;struct Vmxnet3_RxQueueCtrl *shared;
@@ -366,6 +374,9 @@ struct vmxnet3_adapter {/* Size of buffer in the data ring */ u16 txdata_desc_size; +u16 rxdata_desc_size; + +bool rxdataring_enabled;struct work_struct work;
@@ -405,9 +416,19 @@ struct vmxnet3_adapter {#define VMXNET3_DEF_RX_RING_SIZE 256#define VMXNET3_DEF_RX_RING2_SIZE 128 +#define VMXNET3_DEF_RXDATA_DESC_SIZE 128 +#define VMXNET3_MAX_ETH_HDR_SIZE 22#define VMXNET3_MAX_SKB_BUF_SIZE (3*1024) +#define VMXNET3_GET_RING_IDX (adapter, rqID) \ + ((rqID >= adapter->num_rx_queues && \ + rqID < 2 * adapter->num_rx_queues) ? 1 : 0) \ + +#define VMXNET3_RX_DATA_RING (adapter, rqID) \ + (rqID >= 2 * adapter->num_rx_queues && \ + rqID < 3 * adapter->num_rx_queues) \ +int vmxnet3_quiesce_dev (struct vmxnet3_adapter *adapter);
@@ -432,7 +453,7 @@ vmxnet3_set_features(struct net_device *netdev, netdev_features_t features);int vmxnet3_create_queues (struct vmxnet3_adapter *adapter,u32 tx_ring_size,u32 rx_ring_size,u32 rx_ring2_size, -u16 txdata_desc_size); +u16 txdata_desc_size,u16 rxdata_desc_size);void vmxnet3_set_ethtool_ops (struct net_device *netdev);
Signature · 1 line
2.8.2
PATCH v4 6/7 vmxnet3: introduce command to register memory region
In reply to Shrikrishna Khare--- drivers/net/vmxnet3/vmxnet3_defs.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/vmxnet3/vmxnet3_defs.h +17 -0
@@ -81,6 +81,7 @@ enum {VMXNET3_CMD_RESERVED2 ,VMXNET3_CMD_RESERVED3 ,VMXNET3_CMD_SET_COALESCE , +VMXNET3_CMD_REGISTER_MEMREGS ,VMXNET3_CMD_FIRST_GET =0xF00D0000 , VMXNET3_CMD_GET_QUEUE_STATUS = VMXNET3_CMD_FIRST_GET,
@@ -668,6 +669,22 @@ struct Vmxnet3_CoalesceScheme { } coalPara; }; +struct Vmxnet3_MemoryRegion { +__le64 startPA; +__le32 length; +__le16 txQueueBits; +__le16 rxQueueBits; +}; + +#define MAX_MEMORY_REGION_PER_QUEUE 16 +#define MAX_MEMORY_REGION_PER_DEVICE 256 + +struct Vmxnet3_MemRegs { +__le16 numRegs; +__le16 pad[3 ]; +struct Vmxnet3_MemoryRegion memRegs[1 ]; +}; +/* If the command data <= 16 bytes, use the shared memory directly. * otherwise, use variable length configuration descriptor. */
Signature · 1 line
2.8.2
PATCH v4 7/7 vmxnet3: update to version 3
In reply to Shrikrishna Khare--- drivers/net/vmxnet3/vmxnet3_drv.c | 7 ++++++- drivers/net/vmxnet3/vmxnet3_int.h | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/net/vmxnet3/vmxnet3_drv.c +6 -1
@@ -3345,7 +3345,12 @@ vmxnet3_probe_device(struct pci_dev *pdev, goto err_alloc_pci; ver =VMXNET3_READ_BAR1_REG (adapter,VMXNET3_REG_VRRS ); -if (ver & (1 <<VMXNET3_REV_2 )) { +if (ver & (1 <<VMXNET3_REV_3 )) { +VMXNET3_WRITE_BAR1_REG (adapter, +VMXNET3_REG_VRRS , +1 <<VMXNET3_REV_3 ); + adapter->version =VMXNET3_REV_3 +1 ; + }else if (ver & (1 <<VMXNET3_REV_2 )) {VMXNET3_WRITE_BAR1_REG (adapter,VMXNET3_REG_VRRS ,1 <<VMXNET3_REV_2 );
drivers/net/vmxnet3/vmxnet3_int.h +2 -2
@@ -69,10 +69,10 @@/* * Version numbers */ -#define VMXNET3_DRIVER_VERSION_STRING "1.4.8.0-k" +#define VMXNET3_DRIVER_VERSION_STRING "1.4.9.0-k"/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ -#define VMXNET3_DRIVER_VERSION_NUM 0x01040800 +#define VMXNET3_DRIVER_VERSION_NUM 0x01040900#if defined(CONFIG_PCI_MSI )/* RSS only makes sense if MSI-X is supported. */
Signature · 1 line
2.8.2
Re: [PATCH net-next v4 5/7] vmxnet3: add support for get_coalesce, set_coalesce ethtool operations
In reply to Shrikrishna KhareQuoted 3 lines · Shrikrishna Khare
Signed-off-by Keyong Sun <[email protected]>Signed-off-by Manoj Tammali <[email protected]>Signed-off-by Shrikrishna Khare <[email protected]>
Quoted 378 lines
---
v1-v2: v1 patch used special values of rx-usecs to differentiate between coalescing modes. v2 uses relevant fields in structethtool_coalesceto choose modes. Also, a new commandVMXNET3_CMD_GET_COALESCEis introduced which allows driver to query the device for default coalescing configuration.v3-v4: address Ben's review comments: remove unnecessary memset from
vmxnet3_get_coalesce.---
drivers/net/vmxnet3/vmxnet3_defs.h | 33 ++++++- drivers/net/vmxnet3/vmxnet3_drv.c | 54 ++++++++++++drivers/net/vmxnet3/vmxnet3_ethtool.c| 158 ++++++++++++++++++++++++++++++++++ drivers/net/vmxnet3/vmxnet3_int.h | 9 ++4 files changed, 253 insertions(+), 1 deletion(-)drivers/net/vmxnet3/vmxnet3_defs.h +1
-0@@ -80,6 +80,7 @@ enum { VMXNET3_CMD_LOAD_PLUGIN, VMXNET3_CMD_RESERVED2, VMXNET3_CMD_RESERVED3, + VMXNET3_CMD_SET_COALESCE,
VMXNET3_CMD_FIRST_GET=0xF00D0000,VMXNET3_CMD_GET_QUEUE_STATUS=VMXNET3_CMD_FIRST_GET,drivers/net/vmxnet3/vmxnet3_defs.h +2
-1@@ -92,7 +93,8 @@ enum { VMXNET3_CMD_GET_DEV_EXTRA_INFO, VMXNET3_CMD_GET_CONF_INTR, VMXNET3_CMD_GET_RESERVED1, -VMXNET3_CMD_GET_TXDATA_DESC_SIZE +VMXNET3_CMD_GET_TXDATA_DESC_SIZE , + VMXNET3_CMD_GET_COALESCE, };
/*drivers/net/vmxnet3/vmxnet3_defs.h +0
-0@@ -637,6 +639,35 @@ struct Vmxnet3_SetPolling { u8 enablePolling; };drivers/net/vmxnet3/vmxnet3_defs.h +29
-0+#define VMXNET3_COAL_STATIC_MAX_DEPTH 128 +#define VMXNET3_COAL_RBC_MIN_RATE 100 +#define VMXNET3_COAL_RBC_MAX_RATE 100000 + +enum Vmxnet3_CoalesceMode { + VMXNET3_COALESCE_DISABLED = 0, + VMXNET3_COALESCE_ADAPT = 1, + VMXNET3_COALESCE_STATIC = 2, + VMXNET3_COALESCE_RBC = 3 +}; + +struct Vmxnet3_CoalesceRbc { +u32 rbc_rate; +}; + +struct Vmxnet3_CoalesceStatic { +u32 tx_depth; +u32 tx_comp_depth; +u32 rx_depth; +}; + +struct Vmxnet3_CoalesceScheme { +enum Vmxnet3_CoalesceMode coalMode; +union { +struct Vmxnet3_CoalesceRbc coalRbc; +struct Vmxnet3_CoalesceStatic coalStatic; + } coalPara; +}; +/* If the command data <= 16 bytes, use the shared memory directly.
* otherwise, use variable length configuration descriptor. */drivers/net/vmxnet3/vmxnet3_drv.c +0
-0@@ -2491,6 +2491,32 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter) /* the rest are already zeroed */ }drivers/net/vmxnet3/vmxnet3_drv.c +26
-0+static void +vmxnet3_init_coalesce (struct vmxnet3_adapter *adapter) +{ +struct Vmxnet3_DriverShared *shared = adapter->shared; +union Vmxnet3_CmdInfo *cmdInfo = &shared->cu.cmdInfo; +unsigned long flags; + +if (!VMXNET3_VERSION_GE_3 (adapter)) +return ; + +spin_lock_irqsave (&adapter->cmd_lock, flags); + cmdInfo->varConf.confVer =1 ; + cmdInfo->varConf.confLen = +cpu_to_le32 (sizeof (*adapter->coal_conf)); + cmdInfo->varConf.confPA = cpu_to_le64(adapter->coal_conf_pa); + +if (adapter->default_coal_mode) { +VMXNET3_WRITE_BAR1_REG (adapter,VMXNET3_REG_CMD , + VMXNET3_CMD_GET_COALESCE); + }else { +VMXNET3_WRITE_BAR1_REG (adapter,VMXNET3_REG_CMD , + VMXNET3_CMD_SET_COALESCE); + } + +spin_unlock_irqrestore (&adapter->cmd_lock, flags); +}
int
vmxnet3_activate_dev(structvmxnet3_adapter*adapter)drivers/net/vmxnet3/vmxnet3_drv.c +0
-0@@ -2540,6 +2566,8 @@ vmxnet3_activate_dev(struct vmxnet3_adapter *adapter) goto activate_err; }drivers/net/vmxnet3/vmxnet3_drv.c +2
-0+vmxnet3_init_coalesce (adapter); +for (i = 0; i <
adapter->num_rx_queues; i++) { VMXNET3_WRITE_BAR0_REG(adapter,VMXNET3_REG_RXPROD+ i *VMXNET3_REG_ALIGN,drivers/net/vmxnet3/vmxnet3_drv.c +0
-0@@ -3345,6 +3373,22 @@ vmxnet3_probe_device(struct pci_dev *pdev, goto err_ver; }drivers/net/vmxnet3/vmxnet3_drv.c +16
-0+if (VMXNET3_VERSION_GE_3 (adapter)) { + adapter->coal_conf = +dma_alloc_coherent (&adapter->pdev->dev, + sizeof(struct Vmxnet3_CoalesceScheme) + , + &adapter->coal_conf_pa, + GFP_KERNEL); +if (!adapter->coal_conf) { + err = -ENOMEM ; + goto err_ver; + } +memset (adapter->coal_conf,0 ,sizeof (*adapter->coal_conf)); + adapter->coal_conf->coalMode =VMXNET3_COALESCE_DISABLED ; + adapter->default_coal_mode = true; + } +
SET_NETDEV_DEV(netdev, &pdev->dev);
vmxnet3_declare_features(adapter, dma64);drivers/net/vmxnet3/vmxnet3_drv.c +0
-0@@ -3407,6 +3451,11 @@ vmxnet3_probe_device(struct pci_dev *pdev, return 0;
err_register:drivers/net/vmxnet3/vmxnet3_drv.c +5
-0+if (VMXNET3_VERSION_GE_3 (adapter)) { +dma_free_coherent (&adapter->pdev->dev, + sizeof(struct Vmxnet3_CoalesceScheme), + adapter->coal_conf, adapter->coal_conf_pa); + }
vmxnet3_free_intr_resources(adapter);
err_ver:
vmxnet3_free_pci_resources(adapter);drivers/net/vmxnet3/vmxnet3_drv.c +0
-0@@ -3457,6 +3506,11 @@ vmxnet3_remove_device(struct pci_dev *pdev)
vmxnet3_free_intr_resources(adapter);
vmxnet3_free_pci_resources(adapter);drivers/net/vmxnet3/vmxnet3_drv.c +5
-0+if (VMXNET3_VERSION_GE_3 (adapter)) { +dma_free_coherent (&adapter->pdev->dev, + sizeof(struct Vmxnet3_CoalesceScheme), + adapter->coal_conf, adapter->coal_conf_pa); + }#ifdef
VMXNET3_RSS
dma_free_coherent(&adapter->pdev->dev, sizeof(struct UPT1_RSSConf), adapter->rss_conf, adapter->rss_conf_pa);drivers/net/vmxnet3/vmxnet3_ethtool.c +0
-0@@ -725,6 +725,162 @@ vmxnet3_set_rss(struct net_device *netdev, const u32 *p, const u8 *key, } #endifdrivers/net/vmxnet3/vmxnet3_ethtool.c +156
-0+static int +vmxnet3_get_coalesce (struct net_device *netdev,struct ethtool_coalesce *ec) +{ +struct vmxnet3_adapter *adapter =netdev_priv (netdev); + +if (!VMXNET3_VERSION_GE_3 (adapter)) +return -EOPNOTSUPP ; + +switch (adapter->coal_conf->coalMode) { +case VMXNET3_COALESCE_DISABLED : +/* struct ethtool_coalesce is already initialized to 0 */ +break ; +case VMXNET3_COALESCE_ADAPT : + ec->use_adaptive_rx_coalesce = true; +break ; +case VMXNET3_COALESCE_STATIC : + ec->tx_max_coalesced_frames = + adapter->coal_conf->coalPara.coalStatic.tx_comp_depth; + ec->rx_max_coalesced_frames = + adapter->coal_conf->coalPara.coalStatic.rx_depth; +break ; +case VMXNET3_COALESCE_RBC : { +u32 rbc_rate; + + rbc_rate = adapter->coal_conf->coalPara.coalRbc.rbc_rate; + ec->rx_coalesce_usecs =VMXNET3_COAL_RBC_USECS (rbc_rate); + } +break ; +default : +return -EOPNOTSUPP ; + } + +return 0 ; +} + +static int +vmxnet3_set_coalesce (struct net_device *netdev,struct ethtool_coalesce *ec) +{ +struct vmxnet3_adapter *adapter =netdev_priv (netdev); +struct Vmxnet3_DriverShared *shared = adapter->shared; +union Vmxnet3_CmdInfo *cmdInfo = &shared->cu.cmdInfo; +unsigned long flags; + +if (!VMXNET3_VERSION_GE_3 (adapter)) +return -EOPNOTSUPP ; + +if (ec->rx_coalesce_usecs_irq || + ec->rx_max_coalesced_frames_irq || + ec->tx_coalesce_usecs || + ec->tx_coalesce_usecs_irq || + ec->tx_max_coalesced_frames_irq || + ec->stats_block_coalesce_usecs || + ec->use_adaptive_tx_coalesce || + ec->pkt_rate_low || + ec->rx_coalesce_usecs_low || + ec->rx_max_coalesced_frames_low || + ec->tx_coalesce_usecs_low || + ec->tx_max_coalesced_frames_low || + ec->pkt_rate_high || + ec->rx_coalesce_usecs_high || + ec->rx_max_coalesced_frames_high || + ec->tx_coalesce_usecs_high || + ec->tx_max_coalesced_frames_high || + ec->rate_sample_interval) { +return -EINVAL ; + } + +if ((ec->rx_coalesce_usecs ==0 ) && + (ec->use_adaptive_rx_coalesce == 0) && + (ec->tx_max_coalesced_frames == 0) && + (ec->rx_max_coalesced_frames == 0)) { +memset (adapter->coal_conf,0 ,sizeof (*adapter->coal_conf)); + adapter->coal_conf->coalMode =VMXNET3_COALESCE_DISABLED ; + goto done; + } + +if (ec->rx_coalesce_usecs !=0 ) { +u32 rbc_rate; + +if ((ec->use_adaptive_rx_coalesce !=0 ) || + (ec->tx_max_coalesced_frames != 0) || + (ec->rx_max_coalesced_frames != 0)) { +return -EINVAL ; + } + + rbc_rate =VMXNET3_COAL_RBC_RATE (ec->rx_coalesce_usecs); +if (rbc_rate <VMXNET3_COAL_RBC_MIN_RATE || + rbc_rate > VMXNET3_COAL_RBC_MAX_RATE) { +return -EINVAL ; + } + +memset (adapter->coal_conf,0 ,sizeof (*adapter->coal_conf)); + adapter->coal_conf->coalMode =VMXNET3_COALESCE_RBC ; + adapter->coal_conf->coalPara.coalRbc.rbc_rate = rbc_rate; + goto done; + } + +if (ec->use_adaptive_rx_coalesce !=0 ) { +if ((ec->rx_coalesce_usecs !=0 ) || + (ec->tx_max_coalesced_frames != 0) || + (ec->rx_max_coalesced_frames != 0)) { +return -EINVAL ; + } +memset (adapter->coal_conf,0 ,sizeof (*adapter->coal_conf)); + adapter->coal_conf->coalMode =VMXNET3_COALESCE_ADAPT ; + goto done; + } + +if ((ec->tx_max_coalesced_frames !=0 ) || + (ec->rx_max_coalesced_frames != 0)) { +if ((ec->rx_coalesce_usecs !=0 ) || + (ec->use_adaptive_rx_coalesce != 0)) { +return -EINVAL ; + } + +if ((ec->tx_max_coalesced_frames > + VMXNET3_COAL_STATIC_MAX_DEPTH) || + (ec->rx_max_coalesced_frames > + VMXNET3_COAL_STATIC_MAX_DEPTH)) { +return -EINVAL ; + } + +memset (adapter->coal_conf,0 ,sizeof (*adapter->coal_conf)); + adapter->coal_conf->coalMode =VMXNET3_COALESCE_STATIC ; + + adapter->coal_conf->coalPara.coalStatic.tx_comp_depth = + (ec->tx_max_coalesced_frames ? + ec->tx_max_coalesced_frames : + VMXNET3_COAL_STATIC_DEFAULT_DEPTH); + + adapter->coal_conf->coalPara.coalStatic.rx_depth = + (ec->rx_max_coalesced_frames ? + ec->rx_max_coalesced_frames : + VMXNET3_COAL_STATIC_DEFAULT_DEPTH); + + adapter->coal_conf->coalPara.coalStatic.tx_depth = + VMXNET3_COAL_STATIC_DEFAULT_DEPTH; + goto done; + } + +done: + adapter->default_coal_mode = false; +if (netif_running (netdev)) { +spin_lock_irqsave (&adapter->cmd_lock, flags); + cmdInfo->varConf.confVer =1 ; + cmdInfo->varConf.confLen = +cpu_to_le32 (sizeof (*adapter->coal_conf)); + cmdInfo->varConf.confPA = cpu_to_le64(adapter->coal_conf_pa); +VMXNET3_WRITE_BAR1_REG (adapter,VMXNET3_REG_CMD , + VMXNET3_CMD_SET_COALESCE); +spin_unlock_irqrestore (&adapter->cmd_lock, flags); + } + +return 0 ; +} +static const struct
ethtool_opsvmxnet3_ethtool_ops= { .get_settings =vmxnet3_get_settings, .get_drvinfo =vmxnet3_get_drvinfo,drivers/net/vmxnet3/vmxnet3_ethtool.c +2
-0@@ -733,6 +889,8 @@ static const struct ethtool_ops vmxnet3_ethtool_ops = { .get_wol = vmxnet3_get_wol, .set_wol = vmxnet3_set_wol, .get_link = ethtool_op_get_link, + .get_coalesce = vmxnet3_get_coalesce, + .set_coalesce = vmxnet3_set_coalesce, .get_strings = vmxnet3_get_strings, .get_sset_count = vmxnet3_get_sset_count, .get_ethtool_stats = vmxnet3_get_ethtool_stats,drivers/net/vmxnet3/vmxnet3_int.h +0
-0@@ -358,6 +358,7 @@ struct vmxnet3_adapter {int rx_buf_per_pkt; /* only apply to the 1st ring */
dma_addr_tshared_pa;
dma_addr_tqueue_desc_pa;drivers/net/vmxnet3/vmxnet3_int.h +1
-0+dma_addr_t coal_conf_pa;
/* Wake-on-LAN */
u32 wol;drivers/net/vmxnet3/vmxnet3_int.h +0
-0@@ -384,6 +385,9 @@ struct vmxnet3_adapter {
intshare_intr;drivers/net/vmxnet3/vmxnet3_int.h +3
-0+struct Vmxnet3_CoalesceScheme *coal_conf; + bool default_coal_mode; +
dma_addr_tadapter_pa;
dma_addr_tpm_conf_pa;
dma_addr_trss_conf_pa;drivers/net/vmxnet3/vmxnet3_int.h +0
-0@@ -429,6 +433,11 @@ struct vmxnet3_adapter { (rqID >= 2 * adapter->num_rx_queues && \ rqID < 3 * adapter->num_rx_queues) \drivers/net/vmxnet3/vmxnet3_int.h +5
-0+#define VMXNET3_COAL_STATIC_DEFAULT_DEPTH 64 + +#define VMXNET3_COAL_RBC_RATE (usecs) (1000000 / usecs) +#define VMXNET3_COAL_RBC_USECS (rbc_rate) (1000000 / rbc_rate) +int
vmxnet3_quiesce_dev(structvmxnet3_adapter*adapter);
Signature · 4 lines
Ben Hutchings We get into the habit of living before acquiring the habit of thinking. - Albert Camus
Quoted 6 lines · Shrikrishna Khare
This patchset upgrades vmxnet3 to version 3.
Changes in v2:
- Following patch is updated. See that patch for details:
vmxnet3: add support forget_coalesce,set_coalesceethtool
Quoted 7 lines
Changes in v3:
- fix subject line to use vmxnet3: instead of Driver:Vmxnet3
- resubmit when net-next is openChanges in v4:
- Following patch is updated. See that patch for details:
vmxnet3: add support forget_coalesce,set_coalesceethtool
You really need to improve your commit messages, because right now they are inexistent or too obvious to be of any value. A reviewer must be introduced to what code changes he/she is going to review next by looking at the diff and whether this will match or not the description that was provided in the commit message.
Signature · 1 line
Florian