vmxnet3: add command to allow disabling of offloads
This patch adds a new command to disable certain offloads. This allows user to specify, using VM configuration, if certain offloads need to be disabled. Signed-off-by: Ronak Doshi <ronak.doshi@broadcom.com> Acked-by: Guolin Yang <guolin.yang@broadcom.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/20240531193050.4132-4-ronak.doshi@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
4c22fad702
commit
2e5010fd0c
@ -126,6 +126,7 @@ enum {
|
||||
VMXNET3_CMD_GET_MAX_CAPABILITIES,
|
||||
VMXNET3_CMD_GET_DCR0_REG,
|
||||
VMXNET3_CMD_GET_TSRING_DESC_SIZE,
|
||||
VMXNET3_CMD_GET_DISABLED_OFFLOADS,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -912,4 +913,7 @@ struct Vmxnet3_DriverShared {
|
||||
/* when new capability is introduced, update VMXNET3_CAP_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_ */
|
||||
|
@ -3645,6 +3645,15 @@ static void
|
||||
vmxnet3_declare_features(struct vmxnet3_adapter *adapter)
|
||||
{
|
||||
struct net_device *netdev = adapter->netdev;
|
||||
unsigned long flags;
|
||||
|
||||
if (VMXNET3_VERSION_GE_9(adapter)) {
|
||||
spin_lock_irqsave(&adapter->cmd_lock, flags);
|
||||
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
|
||||
VMXNET3_CMD_GET_DISABLED_OFFLOADS);
|
||||
adapter->disabledOffloads = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
|
||||
spin_unlock_irqrestore(&adapter->cmd_lock, flags);
|
||||
}
|
||||
|
||||
netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
|
||||
NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
|
||||
@ -3662,6 +3671,16 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter)
|
||||
NETIF_F_GSO_UDP_TUNNEL_CSUM;
|
||||
}
|
||||
|
||||
if (adapter->disabledOffloads & VMXNET3_OFFLOAD_TSO) {
|
||||
netdev->hw_features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
|
||||
netdev->hw_enc_features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
|
||||
}
|
||||
|
||||
if (adapter->disabledOffloads & VMXNET3_OFFLOAD_LRO) {
|
||||
netdev->hw_features &= ~(NETIF_F_LRO);
|
||||
netdev->hw_enc_features &= ~(NETIF_F_LRO);
|
||||
}
|
||||
|
||||
if (VMXNET3_VERSION_GE_7(adapter)) {
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -454,6 +454,7 @@ struct vmxnet3_adapter {
|
||||
/* 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) \
|
||||
|
Loading…
Reference in New Issue
Block a user