V_01-00-13
1. Synchronization between ethtool vlan features "rx-vlan-offload", "rx-vlan-filter", "tx-vlan-offload" output and register settings. 2. Added ethtool support to update "rx-vlan-offload", "rx-vlan-filter", and "tx-vlan-offload". 3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG. 4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
This commit is contained in:
parent
b0b93499fb
commit
47410a0776
35
Readme.md
35
Readme.md
@ -1,7 +1,7 @@
|
||||
# Toshiba Electronic Devices & Storage Corporation TC956X PCIe Ethernet Host Driver
|
||||
Release Date: 09 Sep 2021
|
||||
Release Date: 14 Sep 2021
|
||||
|
||||
Release Version: V_01-00-12 : Limited-tested version
|
||||
Release Version: V_01-00-13 : Limited-tested version
|
||||
|
||||
TC956X PCIe EMAC driver is based on "Fedora 30, kernel-5.4.19".
|
||||
|
||||
@ -128,7 +128,29 @@ Formula:
|
||||
|
||||
XXX_L0s_ENTRY_DELAY range: 1-31
|
||||
XXX_L1_ENTRY_DELAY: 1-1023
|
||||
|
||||
|
||||
9. To check vlan feature status execute:
|
||||
ethtool -k <interface> | grep vlan
|
||||
|
||||
To enable/disable following vlan features execute:
|
||||
(a) rx-vlan-filter:
|
||||
ethtool -K <interface> rx-vlan-filter <on|off>
|
||||
(b) rx-vlan-offload:
|
||||
ethtool -K <interface> rxvlan <on|off>
|
||||
(c) tx-vlan-offload:
|
||||
ethtool -K <interface> txvlan <on|off>
|
||||
|
||||
Use following to configure VLAN:
|
||||
(a) modprobe 8021q
|
||||
(b) vconfig add <interface> <vlanid>
|
||||
(c) vconfig set_flag <interface>.<vlanid> 1 0
|
||||
(d) ifconfig <interface>.<vlanid> <ip> netmask 255.255.255.0 broadcast <ip mask> up
|
||||
|
||||
Default Configuraton:
|
||||
(a) Rx vlan filter is disabled.
|
||||
(b) Rx valn offload (vlan stripping) is disabled.
|
||||
(c) Tx vlan offload is enabled.
|
||||
|
||||
# Release Versions:
|
||||
|
||||
## TC956X_Host_Driver_20210326_V_01-00:
|
||||
@ -194,3 +216,10 @@ Formula:
|
||||
## TC956X_Host_Driver_20210909_V_01-00-12:
|
||||
|
||||
1. Reverted changes related to usage of Port-0 pci_dev for all DMA allocation/mapping for IPA path
|
||||
|
||||
## TC956X_Host_Driver_20210914_V_01-00-13:
|
||||
|
||||
1. Synchronization between ethtool vlan features "rx-vlan-offload", "rx-vlan-filter", "tx-vlan-offload" output and register settings.
|
||||
2. Added ethtool support to update "rx-vlan-offload", "rx-vlan-filter", and "tx-vlan-offload".
|
||||
3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG.
|
||||
4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
|
||||
|
29
dwxgmac2.h
29
dwxgmac2.h
@ -32,6 +32,13 @@
|
||||
* VERSION : 01-00
|
||||
* 29 Jul 2021 : 1. Add support to set MAC Address register
|
||||
* VERSION : 01-00-07
|
||||
* 14 Sep 2021 : 1. Synchronization between ethtool vlan features
|
||||
* "rx-vlan-offload", "rx-vlan-filter", "tx-vlan-offload" output and register settings.
|
||||
* 2. Added ethtool support to update "rx-vlan-offload", "rx-vlan-filter",
|
||||
* and "tx-vlan-offload".
|
||||
* 3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG.
|
||||
* 4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
|
||||
* VERSION : 01-00-13
|
||||
*/
|
||||
|
||||
|
||||
@ -113,6 +120,7 @@
|
||||
#define XGMAC_HASH_TAB_0_31 (MAC_OFFSET + 0x00000010)
|
||||
#define XGMAC_HASH_TAB_32_63 (MAC_OFFSET + 0x00000014)
|
||||
#define XGMAC_VLAN_TAG (MAC_OFFSET + 0x00000050)
|
||||
#define XGMAC_VLAN_EVLRXS BIT(24)
|
||||
#define XGMAC_VLAN_EDVLP BIT(26)
|
||||
#define XGMAC_VLAN_ETV_LPOS 16
|
||||
#define XGMAC_VLAN_EVLS GENMASK(22, 21)
|
||||
@ -122,6 +130,7 @@
|
||||
#define XGMAC_VLANTR_VTIM BIT(17)
|
||||
#define XGMAC_VLANTR_VTIM_LPOS (17)
|
||||
#define XGMAC_VLAN_DOVLTC BIT(20)
|
||||
#define XGMAC_VLAN_ERSVLM BIT(19)
|
||||
#define XGMAC_VLAN_ESVL BIT(18)
|
||||
#define XGMAC_VLAN_ETV BIT(16)
|
||||
#define XGMAC_VLAN_VID GENMASK(15, 0)
|
||||
@ -693,4 +702,24 @@
|
||||
#define XGMAC_RDES3_TSD BIT(6)
|
||||
#define XGMAC_RDES3_TSA BIT(4)
|
||||
|
||||
#ifdef TC956X
|
||||
#define XGMAC_RDES0_OVT_INDEX 0
|
||||
#define XGMAC_RDES0_OVT_WIDTH 16
|
||||
#define XGMAC_RDES2_VF_INDEX 15
|
||||
#define XGMAC_RDES2_VF_WIDTH 1
|
||||
#define XGMAC_RDES3_ES_INDEX 15
|
||||
#define XGMAC_RDES3_ES_WIDTH 1
|
||||
#define XGMAC_RDES3_ETLT_INDEX 16
|
||||
#define XGMAC_RDES3_ETLT_WIDTH 4
|
||||
#define PKT_TYPE_SINGLE_CVLAN 0x09
|
||||
|
||||
#define GET_BITS_LE(_var, _index, _width) \
|
||||
((le32_to_cpu((_var)) >> (_index)) & ((0x1 << (_width)) - 1))
|
||||
|
||||
#define XGMAC_GET_BITS_LE(_var, _prefix, _field) \
|
||||
GET_BITS_LE((_var), \
|
||||
_prefix##_##_field##_INDEX, \
|
||||
_prefix##_##_field##_WIDTH)
|
||||
#endif
|
||||
|
||||
#endif /* __TC956XMAC_DWXGMAC2_H__ */
|
||||
|
118
dwxgmac2_core.c
118
dwxgmac2_core.c
@ -38,6 +38,13 @@
|
||||
* VERSION : 01-00-02
|
||||
* 22 Jul 2021 : 1. USXGMII/XFI/SGMII/RGMII interface supported with module parameters
|
||||
* VERSION : 01-00-04
|
||||
* 14 Sep 2021 : 1. Synchronization between ethtool vlan features
|
||||
* "rx-vlan-offload", "rx-vlan-filter", "tx-vlan-offload" output and register settings.
|
||||
* 2. Added ethtool support to update "rx-vlan-offload", "rx-vlan-filter",
|
||||
* and "tx-vlan-offload".
|
||||
* 3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG.
|
||||
* 4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
|
||||
* VERSION : 01-00-13
|
||||
*/
|
||||
|
||||
#include <linux/bitrev.h>
|
||||
@ -49,7 +56,18 @@
|
||||
|
||||
static void tc956x_set_mac_addr(struct tc956xmac_priv *priv, struct mac_device_info *hw,
|
||||
const u8 *mac, int index, int vf);
|
||||
|
||||
#ifdef TC956X
|
||||
static void dwxgmac2_disable_tx_vlan(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw);
|
||||
static void dwxgmac2_enable_rx_vlan_stripping(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw);
|
||||
static void dwxgmac2_disable_rx_vlan_stripping(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw);
|
||||
static void dwxgmac2_enable_rx_vlan_filtering(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw);
|
||||
static void dwxgmac2_disable_rx_vlan_filtering(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw);
|
||||
#endif
|
||||
|
||||
static void dwxgmac2_core_init(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw, struct net_device *dev)
|
||||
@ -941,6 +959,17 @@ static void dwxgmac2_set_filter(struct tc956xmac_priv *priv, struct mac_device_i
|
||||
|
||||
__dev_mc_sync(dev, tc956x_add_mac_addr, tc956x_delete_mac_addr);
|
||||
}
|
||||
#ifdef TC956X
|
||||
if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
|
||||
dwxgmac2_enable_rx_vlan_filtering(priv, hw);
|
||||
else
|
||||
dwxgmac2_disable_rx_vlan_filtering(priv, hw);
|
||||
|
||||
if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
|
||||
dwxgmac2_enable_rx_vlan_stripping(priv, hw);
|
||||
else
|
||||
dwxgmac2_disable_rx_vlan_stripping(priv, hw);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void dwxgmac2_set_mac_loopback(struct tc956xmac_priv *priv,
|
||||
@ -2048,11 +2077,89 @@ static void dwxgmac2_enable_vlan(struct tc956xmac_priv *priv,
|
||||
|
||||
value = readl(ioaddr + XGMAC_VLAN_INCL);
|
||||
value |= XGMAC_VLAN_VLTI;
|
||||
value |= XGMAC_VLAN_CSVL; /* Only use SVLAN */
|
||||
value &= ~XGMAC_VLAN_CSVL; /* Only use CVLAN */
|
||||
if (priv->dev->features & NETIF_F_HW_VLAN_STAG_TX)
|
||||
value |= XGMAC_VLAN_CSVL; /* Only use SVLAN */
|
||||
value &= ~XGMAC_VLAN_VLC;
|
||||
value |= (type << XGMAC_VLAN_VLC_SHIFT) & XGMAC_VLAN_VLC;
|
||||
writel(value, ioaddr + XGMAC_VLAN_INCL);
|
||||
}
|
||||
#ifdef TC956X
|
||||
static void dwxgmac2_disable_tx_vlan(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw)
|
||||
{
|
||||
void __iomem *ioaddr = hw->pcsr;
|
||||
u32 value;
|
||||
|
||||
value = readl(ioaddr + XGMAC_VLAN_INCL);
|
||||
value &= ~XGMAC_VLAN_VLTI;
|
||||
value &= ~XGMAC_VLAN_VLC;
|
||||
writel(value, ioaddr + XGMAC_VLAN_INCL);
|
||||
}
|
||||
|
||||
static void dwxgmac2_enable_rx_vlan_stripping(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw)
|
||||
{
|
||||
void __iomem *ioaddr = hw->pcsr;
|
||||
u32 value;
|
||||
|
||||
value = readl(ioaddr + XGMAC_VLAN_TAG_CTRL);
|
||||
/* Put the VLAN tag in the Rx descriptor */
|
||||
value |= XGMAC_VLAN_EVLRXS;
|
||||
|
||||
/* Don't check the VLAN type */
|
||||
value |= XGMAC_VLAN_DOVLTC;
|
||||
|
||||
/* Check only C-TAG (0x8100) packets */
|
||||
value &= ~XGMAC_VLAN_ERSVLM;
|
||||
|
||||
/* Don't consider an S-TAG (0x88A8) packet as a VLAN packet */
|
||||
value &= ~XGMAC_VLAN_ESVL;
|
||||
|
||||
/* Enable VLAN tag stripping */
|
||||
value |= XGMAC_VLAN_EVLS;
|
||||
writel(value, ioaddr + XGMAC_VLAN_TAG_CTRL);
|
||||
}
|
||||
|
||||
static void dwxgmac2_disable_rx_vlan_stripping(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw)
|
||||
{
|
||||
void __iomem *ioaddr = hw->pcsr;
|
||||
u32 value;
|
||||
|
||||
value = readl(ioaddr + XGMAC_VLAN_TAG_CTRL);
|
||||
/* Disable VLAN tag stripping */
|
||||
value &= ~XGMAC_VLAN_EVLS;
|
||||
writel(value, ioaddr + XGMAC_VLAN_TAG_CTRL);
|
||||
}
|
||||
|
||||
static void dwxgmac2_enable_rx_vlan_filtering(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw)
|
||||
{
|
||||
void __iomem *ioaddr = hw->pcsr;
|
||||
u32 value;
|
||||
|
||||
value = readl(ioaddr + XGMAC_PACKET_FILTER);
|
||||
/* Enable VLAN filtering */
|
||||
value |= XGMAC_FILTER_VTFE;
|
||||
writel(value, ioaddr + XGMAC_PACKET_FILTER);
|
||||
|
||||
writel(value, ioaddr + XGMAC_VLAN_TAG_CTRL);
|
||||
}
|
||||
|
||||
static void dwxgmac2_disable_rx_vlan_filtering(struct tc956xmac_priv *priv,
|
||||
struct mac_device_info *hw)
|
||||
{
|
||||
void __iomem *ioaddr = hw->pcsr;
|
||||
u32 value;
|
||||
|
||||
value = readl(ioaddr + XGMAC_PACKET_FILTER);
|
||||
/* Enable VLAN filtering */
|
||||
value &= ~XGMAC_FILTER_VTFE;
|
||||
writel(value, ioaddr + XGMAC_PACKET_FILTER);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TC956X_UNSUPPORTED_UNTESTED_FEATURE
|
||||
static int dwxgmac2_filter_wait(struct tc956xmac_priv *priv, struct mac_device_info *hw)
|
||||
{
|
||||
@ -2639,6 +2746,13 @@ const struct tc956xmac_ops dwxgmac210_ops = {
|
||||
.sarc_configure = dwxgmac2_sarc_configure,
|
||||
#endif /* TC956X_UNSUPPORTED_UNTESTED_FEATURE */
|
||||
.enable_vlan = dwxgmac2_enable_vlan,
|
||||
#ifdef TC956X
|
||||
.disable_tx_vlan = dwxgmac2_disable_tx_vlan,
|
||||
.enable_rx_vlan_stripping = dwxgmac2_enable_rx_vlan_stripping,
|
||||
.disable_rx_vlan_stripping = dwxgmac2_disable_rx_vlan_stripping,
|
||||
.enable_rx_vlan_filtering = dwxgmac2_enable_rx_vlan_filtering,
|
||||
.disable_rx_vlan_filtering = dwxgmac2_disable_rx_vlan_filtering,
|
||||
#endif
|
||||
#ifdef TC956X_UNSUPPORTED_UNTESTED_FEATURE
|
||||
.config_l3_filter = dwxgmac2_config_l3_filter,
|
||||
.config_l4_filter = dwxgmac2_config_l4_filter,
|
||||
|
26
hwif.h
26
hwif.h
@ -30,6 +30,13 @@
|
||||
*
|
||||
* 15 Mar 2021 : Base lined
|
||||
* VERSION : 01-00
|
||||
* 14 Sep 2021 : 1. Synchronization between ethtool vlan features
|
||||
* "rx-vlan-offload", "rx-vlan-filter", "tx-vlan-offload" output and register settings.
|
||||
* 2. Added ethtool support to update "rx-vlan-offload", "rx-vlan-filter",
|
||||
* and "tx-vlan-offload".
|
||||
* 3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG.
|
||||
* 4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
|
||||
* VERSION : 01-00-13
|
||||
*/
|
||||
|
||||
#ifndef __TC956XMAC_HWIF_H__
|
||||
@ -420,6 +427,13 @@ struct tc956xmac_ops {
|
||||
void (*delete_vlan)(struct tc956xmac_priv *priv, struct net_device *dev, u16 vid,
|
||||
u16 vf);
|
||||
void (*enable_vlan)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 type);
|
||||
#ifdef TC956X
|
||||
void (*disable_tx_vlan)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
|
||||
void (*enable_rx_vlan_stripping)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
|
||||
void (*disable_rx_vlan_stripping)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
|
||||
void (*enable_rx_vlan_filtering)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
|
||||
void (*disable_rx_vlan_filtering)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
|
||||
#endif
|
||||
/* TX Timestamp */
|
||||
int (*get_mac_tx_timestamp)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u64 *ts);
|
||||
/* Source Address Insertion / Replacement */
|
||||
@ -524,6 +538,18 @@ struct tc956xmac_ops {
|
||||
tc956xmac_do_void_callback(__priv, mac, delete_vlan, __args)
|
||||
#define tc956xmac_enable_vlan(__priv, __args...) \
|
||||
tc956xmac_do_void_callback(__priv, mac, enable_vlan, __args)
|
||||
#ifdef TC956X
|
||||
#define tc956xmac_disable_tx_vlan(__priv, __args...) \
|
||||
tc956xmac_do_void_callback(__priv, mac, disable_tx_vlan, __args)
|
||||
#define tc956xmac_enable_rx_vlan_stripping(__priv, __args...) \
|
||||
tc956xmac_do_void_callback(__priv, mac, enable_rx_vlan_stripping, __args)
|
||||
#define tc956xmac_disable_rx_vlan_stripping(__priv, __args...) \
|
||||
tc956xmac_do_void_callback(__priv, mac, disable_rx_vlan_stripping, __args)
|
||||
#define tc956xmac_enable_rx_vlan_filtering(__priv, __args...) \
|
||||
tc956xmac_do_void_callback(__priv, mac, enable_rx_vlan_filtering, __args)
|
||||
#define tc956xmac_disable_rx_vlan_filtering(__priv, __args...) \
|
||||
tc956xmac_do_void_callback(__priv, mac, disable_rx_vlan_filtering, __args)
|
||||
#endif
|
||||
#define tc956xmac_get_mac_tx_timestamp(__priv, __args...) \
|
||||
tc956xmac_do_callback(__priv, mac, get_mac_tx_timestamp, __args)
|
||||
#define tc956xmac_sarc_configure(__priv, __args...) \
|
||||
|
@ -58,6 +58,8 @@
|
||||
* VERSION : 01-00-11
|
||||
* 09 Sep 2021 : Reverted changes related to usage of Port-0 pci_dev for all DMA allocation/mapping for IPA path
|
||||
* VERSION : 01-00-12
|
||||
* 14 Sep 2021 : 1. Version update
|
||||
* VERSION : 01-00-13
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
@ -87,7 +89,7 @@ static unsigned int tc956x_speed = 3;
|
||||
static unsigned int tc956x_port0_interface = ENABLE_XFI_INTERFACE;
|
||||
static unsigned int tc956x_port1_interface = ENABLE_SGMII_INTERFACE;
|
||||
|
||||
static const struct tc956x_version tc956x_drv_version = {0, 1, 0, 0, 1, 2};
|
||||
static const struct tc956x_version tc956x_drv_version = {0, 1, 0, 0, 1, 3};
|
||||
|
||||
/*
|
||||
* This struct is used to associate PCI Function of MAC controller on a board,
|
||||
|
@ -60,6 +60,8 @@
|
||||
* VERSION : 01-00-11
|
||||
* 09 Sep 2021 : Reverted changes related to usage of Port-0 pci_dev for all DMA allocation/mapping for IPA path
|
||||
* VERSION : 01-00-12
|
||||
* 14 Sep 2021 : 1. Version update
|
||||
* VERSION : 01-00-13
|
||||
*/
|
||||
|
||||
#ifndef __TC956XMAC_H__
|
||||
@ -108,7 +110,7 @@
|
||||
#ifdef TC956X
|
||||
|
||||
#define TC956X_RESOURCE_NAME "tc956x_pci-eth"
|
||||
#define DRV_MODULE_VERSION "V_01-00-12"
|
||||
#define DRV_MODULE_VERSION "V_01-00-13"
|
||||
#define TC956X_FW_MAX_SIZE (64*1024)
|
||||
|
||||
#define ATR_AXI4_SLV_BASE 0x0800
|
||||
|
@ -30,6 +30,13 @@
|
||||
*
|
||||
* 15 Mar 2021 : Base lined
|
||||
* VERSION : 01-00
|
||||
* 14 Sep 2021 : 1. Synchronization between ethtool vlan features
|
||||
* "rx-vlan-offload", "rx-vlan-filter", "tx-vlan-offload" output and register settings.
|
||||
* 2. Added ethtool support to update "rx-vlan-offload", "rx-vlan-filter",
|
||||
* and "tx-vlan-offload".
|
||||
* 3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG.
|
||||
* 4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
|
||||
* VERSION : 01-00-13
|
||||
*/
|
||||
|
||||
#ifndef _IOCTL_H__
|
||||
@ -75,7 +82,9 @@ enum ioctl_commands {
|
||||
TC956X_PCIE_GET_LOGSTAT_CONF = 0x1e, /* LOGSTAT : Read, Print and return LTSSM and AER Configuration */
|
||||
TC956X_PCIE_GET_LTSSM_LOG = 0x1f, /* LOGSTAT : Read, Print and return LTSSM Looging Data */
|
||||
#endif /* #ifdef TC956X_PCIE_LOGSTAT */
|
||||
#ifndef TC956X
|
||||
TC956XMAC_VLAN_STRIP_CONFIG = 0x22,
|
||||
#endif
|
||||
TC956XMAC_PCIE_LANE_CHANGE = 0x23,
|
||||
TC956XMAC_PCIE_SET_TX_MARGIN = 0x24,
|
||||
TC956XMAC_PCIE_SET_TX_DEEMPHASIS = 0x25, /*Enable or disable Tx de-emphasis*/
|
||||
@ -152,6 +161,7 @@ struct tc956xmac_ioctl_l2_da_filter {
|
||||
struct tc956xmac_ioctl_vlan_filter {
|
||||
__u32 cmd;
|
||||
/* 0 - disable and 1 - enable */
|
||||
/* Please note 0 - disable is not supported */
|
||||
int filter_enb_dis;
|
||||
/* 0 - perfect and 1 - hash filtering */
|
||||
int perfect_hash;
|
||||
@ -299,11 +309,12 @@ struct tc956x_ioctl_fwstatus {
|
||||
__u32 fw_status;
|
||||
};
|
||||
|
||||
#ifndef TC956X
|
||||
struct tc956xmac_ioctl_vlan_strip_cfg {
|
||||
__u32 cmd;
|
||||
__u32 enabled; /* 1 to enable stripping, 0 to disable stripping */
|
||||
};
|
||||
|
||||
#endif
|
||||
enum lane_width {
|
||||
LANE_1 = 1,
|
||||
LANE_2 = 2,
|
||||
|
120
tc956xmac_main.c
120
tc956xmac_main.c
@ -49,6 +49,13 @@
|
||||
* VERSION : 01-00-09
|
||||
* 24 Aug 2021 : 1. Platform API supported
|
||||
* VERSION : 01-00-10
|
||||
* 14 Sep 2021 : 1. Synchronization between ethtool vlan features
|
||||
* "rx-vlan-offload", "rx-vlan-filter", "tx-vlan-offload" output and register settings.
|
||||
* 2. Added ethtool support to update "rx-vlan-offload", "rx-vlan-filter",
|
||||
* and "tx-vlan-offload".
|
||||
* 3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG.
|
||||
* 4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
|
||||
* VERSION : 01-00-13
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
@ -3725,7 +3732,11 @@ static int tc956xmac_hw_setup(struct net_device *dev, bool init_ptp)
|
||||
}
|
||||
|
||||
/* VLAN Tag Insertion */
|
||||
#ifndef TC956X
|
||||
if (priv->dma_cap.vlins)
|
||||
#else
|
||||
if ((priv->dma_cap.vlins) && (dev->features & NETIF_F_HW_VLAN_CTAG_TX))
|
||||
#endif
|
||||
tc956xmac_enable_vlan(priv, priv->hw, TC956XMAC_VLAN_INSERT);
|
||||
|
||||
/* TBS */
|
||||
@ -4777,6 +4788,14 @@ static netdev_tx_t tc956xmac_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
#ifndef TC956X
|
||||
/**
|
||||
* tc956xmac_rx_vlan - Rx VLAN Stripping Function
|
||||
* @dev : device pointer
|
||||
* @skb : the socket buffer
|
||||
* Description : this function strips vlan id from the skb
|
||||
* before forwarding to application.
|
||||
*/
|
||||
static void tc956xmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
|
||||
{
|
||||
struct vlan_ethhdr *veth;
|
||||
@ -4797,6 +4816,41 @@ static void tc956xmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
|
||||
__vlan_hwaccel_put_tag(skb, vlan_proto, vlanid);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* tc956xmac_rx_vlan - Rx VLAN Stripping Function
|
||||
* @dev : device pointer
|
||||
* @rdesc : rx descriptor
|
||||
* @skb : the socket buffer
|
||||
* Description : this function extracts vlan id from the descriptor
|
||||
* stripped by MAC VLAN filter.
|
||||
*/
|
||||
static void tc956xmac_rx_vlan(struct net_device *dev,
|
||||
struct dma_desc *rdesc,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
u16 vlanid;
|
||||
u32 err, etlt;
|
||||
|
||||
/* Check for error in descriptor */
|
||||
err = XGMAC_GET_BITS_LE(rdesc->des3, XGMAC_RDES3, ES);
|
||||
/* Check for L2 Packet Type Encoding */
|
||||
etlt = XGMAC_GET_BITS_LE(rdesc->des3, XGMAC_RDES3, ETLT);
|
||||
if (!err) {
|
||||
/* No error if err is 0 or etlt is 0 */
|
||||
/* Check packet type is Single CVLAN tag and
|
||||
netdev supports VLAN CTAG*/
|
||||
if ((etlt == PKT_TYPE_SINGLE_CVLAN) &&
|
||||
(dev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
|
||||
vlanid = XGMAC_GET_BITS_LE(rdesc->des0,
|
||||
XGMAC_RDES0,
|
||||
OVT);
|
||||
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
|
||||
vlanid);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TC956X_UNSUPPORTED_UNTESTED_FEATURE
|
||||
static inline int tc956xmac_rx_threshold_count(struct tc956xmac_rx_queue *rx_q)
|
||||
@ -5092,7 +5146,11 @@ static int tc956xmac_rx(struct tc956xmac_priv *priv, int limit, u32 queue)
|
||||
/* Got entire packet into SKB. Finish it. */
|
||||
|
||||
tc956xmac_get_rx_hwtstamp(priv, p, np, skb);
|
||||
#ifndef TC956X
|
||||
tc956xmac_rx_vlan(priv->dev, skb);
|
||||
#else
|
||||
tc956xmac_rx_vlan(priv->dev, p, skb);
|
||||
#endif
|
||||
skb->protocol = eth_type_trans(skb, priv->dev);
|
||||
|
||||
if (unlikely(!coe))
|
||||
@ -5292,7 +5350,13 @@ static int tc956xmac_set_features(struct net_device *netdev,
|
||||
struct tc956xmac_priv *priv = netdev_priv(netdev);
|
||||
bool sph_en;
|
||||
u32 chan;
|
||||
#ifdef TC956X
|
||||
netdev_features_t txvlan, rxvlan, rxvlan_filter;
|
||||
|
||||
rxvlan = (netdev->features & NETIF_F_HW_VLAN_CTAG_RX);
|
||||
txvlan = (netdev->features & NETIF_F_HW_VLAN_CTAG_TX);
|
||||
rxvlan_filter = (netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER);
|
||||
#endif
|
||||
/* Keep the COE Type in case of csum is supporting */
|
||||
if (features & NETIF_F_RXCSUM)
|
||||
priv->hw->rx_csum = priv->plat->rx_coe;
|
||||
@ -5326,6 +5390,22 @@ static int tc956xmac_set_features(struct net_device *netdev,
|
||||
for (chan = 0; chan < priv->plat->rx_queues_to_use; chan++)
|
||||
tc956xmac_enable_sph(priv, priv->ioaddr, sph_en, chan);
|
||||
|
||||
#ifdef TC956X
|
||||
if ((features & NETIF_F_HW_VLAN_CTAG_RX) && !rxvlan)
|
||||
tc956xmac_enable_rx_vlan_stripping(priv, priv->hw);
|
||||
else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) && rxvlan)
|
||||
tc956xmac_disable_rx_vlan_stripping(priv, priv->hw);
|
||||
|
||||
if ((features & NETIF_F_HW_VLAN_CTAG_TX) && !txvlan)
|
||||
tc956xmac_enable_vlan(priv, priv->hw, TC956XMAC_VLAN_INSERT);
|
||||
else if (!(features & NETIF_F_HW_VLAN_CTAG_TX) && txvlan)
|
||||
tc956xmac_disable_tx_vlan(priv, priv->hw);
|
||||
|
||||
if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) && !rxvlan_filter)
|
||||
tc956xmac_enable_rx_vlan_filtering(priv, priv->hw);
|
||||
else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) && rxvlan_filter)
|
||||
tc956xmac_disable_rx_vlan_filtering(priv, priv->hw);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -6160,14 +6240,22 @@ static int tc956xmac_config_vlan_filter(struct tc956xmac_priv *priv, void __user
|
||||
struct tc956xmac_ioctl_vlan_filter ioctl_data;
|
||||
u32 reg_val;
|
||||
|
||||
if (!(priv->dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
|
||||
return -EPERM;
|
||||
|
||||
if (copy_from_user(&ioctl_data, data, sizeof(ioctl_data)))
|
||||
return -EFAULT;
|
||||
|
||||
/* Disabling VLAN is not supported */
|
||||
if (ioctl_data.filter_enb_dis == 0)
|
||||
return -EINVAL;
|
||||
|
||||
#ifndef TC956X
|
||||
/* configure the vlan filter */
|
||||
reg_val = readl(priv->ioaddr + XGMAC_PACKET_FILTER);
|
||||
reg_val = (ioctl_data.filter_enb_dis << XGMAC_VLAN_VLC_SHIFT);
|
||||
writel(reg_val, priv->ioaddr + XGMAC_PACKET_FILTER);
|
||||
|
||||
#endif
|
||||
reg_val = readl(priv->ioaddr + XGMAC_VLAN_TAG);
|
||||
reg_val = (reg_val & (~XGMAC_VLANTR_VTIM)) |
|
||||
(ioctl_data.perfect_inverse_match << XGMAC_VLANTR_VTIM_LPOS);
|
||||
@ -6870,6 +6958,15 @@ static int tc956xmac_pcie_config_reg_wr(struct tc956xmac_priv *priv, void __user
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef TC956X
|
||||
/*!
|
||||
* \brief IOCTL to enable/disable VLAN Rx Stripping
|
||||
* \param[in] priv driver private structure
|
||||
* \param[in] data user data
|
||||
* \return -EFAULT in case of error, otherwise 0
|
||||
* \description enable/disable stripping.
|
||||
* Enable this function only if NETIF_F_HW_VLAN_CTAG_RX is user-configureable.
|
||||
*/
|
||||
static int tc956xmac_vlan_strip_config(struct tc956xmac_priv *priv, void __user *data)
|
||||
{
|
||||
struct tc956xmac_ioctl_vlan_strip_cfg ioctl_data;
|
||||
@ -6899,6 +6996,7 @@ static int tc956xmac_vlan_strip_config(struct tc956xmac_priv *priv, void __user
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TC956X
|
||||
#ifdef TC956X_UNSUPPORTED_UNTESTED_FEATURE
|
||||
@ -8759,8 +8857,10 @@ static int tc956xmac_extension_ioctl(struct tc956xmac_priv *priv,
|
||||
case TC956X_PCIE_GET_LTSSM_LOG:
|
||||
return tc956x_pcie_ioctl_GetLTSSMLogD(priv, data);
|
||||
#endif /* #ifdef TC956X_PCIE_LOGSTAT */
|
||||
#ifndef TC956X
|
||||
case TC956XMAC_VLAN_STRIP_CONFIG:
|
||||
return tc956xmac_vlan_strip_config(priv, data);
|
||||
#endif
|
||||
#ifdef TC956X
|
||||
case TC956XMAC_PCIE_LANE_CHANGE:
|
||||
return tc956xmac_pcie_lane_change(priv, data);
|
||||
@ -9931,15 +10031,27 @@ int tc956xmac_dvr_probe(struct device *device,
|
||||
ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
|
||||
#ifdef TC956XMAC_VLAN_TAG_USED
|
||||
/* Both mac100 and gmac support receive VLAN tag detection */
|
||||
ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX;
|
||||
/* Driver only supports CTAG */
|
||||
ndev->features &= ~NETIF_F_HW_VLAN_CTAG_RX; /* Disable rx-vlan-filter by default */
|
||||
ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; /* Support as User-changeable features */
|
||||
#ifndef TC956X
|
||||
ndev->features |= NETIF_F_HW_VLAN_STAG_RX;
|
||||
#endif
|
||||
if (priv->dma_cap.vlhash) {
|
||||
ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||
/* Driver only supports CTAG */
|
||||
ndev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; /* Disable rx-vlan-offload by default */
|
||||
ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; /* Support as User-changeable features */
|
||||
#ifndef TC956X
|
||||
ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER;
|
||||
#endif
|
||||
}
|
||||
if (priv->dma_cap.vlins) {
|
||||
ndev->features |= NETIF_F_HW_VLAN_CTAG_TX;
|
||||
ndev->features |= NETIF_F_HW_VLAN_CTAG_TX; /* Enable tx-vlan-offload by default */
|
||||
ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX; /* Support as User-changeable features */
|
||||
#ifndef TC956X
|
||||
if (priv->dma_cap.dvlan)
|
||||
ndev->features |= NETIF_F_HW_VLAN_STAG_TX;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
priv->mac_table =
|
||||
|
Loading…
Reference in New Issue
Block a user