mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 21:11:47 +07:00
net: hns3: Add ethtool interface for vlan filter
This patch adds vlan filter enable switch to support ethtool -K ethX rx-vlan-filter on/off. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b60f699ee8
commit
391b5e9356
@ -274,6 +274,8 @@ struct hnae3_ae_dev {
|
|||||||
* Get firmware version
|
* Get firmware version
|
||||||
* get_mdix_mode()
|
* get_mdix_mode()
|
||||||
* Get media typr of phy
|
* Get media typr of phy
|
||||||
|
* enable_vlan_filter()
|
||||||
|
* Enable vlan filter
|
||||||
* set_vlan_filter()
|
* set_vlan_filter()
|
||||||
* Set vlan filter config of Ports
|
* Set vlan filter config of Ports
|
||||||
* set_vf_vlan_filter()
|
* set_vf_vlan_filter()
|
||||||
@ -382,6 +384,7 @@ struct hnae3_ae_ops {
|
|||||||
void (*get_mdix_mode)(struct hnae3_handle *handle,
|
void (*get_mdix_mode)(struct hnae3_handle *handle,
|
||||||
u8 *tp_mdix_ctrl, u8 *tp_mdix);
|
u8 *tp_mdix_ctrl, u8 *tp_mdix);
|
||||||
|
|
||||||
|
void (*enable_vlan_filter)(struct hnae3_handle *handle, bool enable);
|
||||||
int (*set_vlan_filter)(struct hnae3_handle *handle, __be16 proto,
|
int (*set_vlan_filter)(struct hnae3_handle *handle, __be16 proto,
|
||||||
u16 vlan_id, bool is_kill);
|
u16 vlan_id, bool is_kill);
|
||||||
int (*set_vf_vlan_filter)(struct hnae3_handle *handle, int vfid,
|
int (*set_vf_vlan_filter)(struct hnae3_handle *handle, int vfid,
|
||||||
|
@ -1101,6 +1101,11 @@ static int hns3_nic_set_features(struct net_device *netdev,
|
|||||||
priv->ops.maybe_stop_tx = hns3_nic_maybe_stop_tx;
|
priv->ops.maybe_stop_tx = hns3_nic_maybe_stop_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (features & NETIF_F_HW_VLAN_CTAG_FILTER)
|
||||||
|
h->ae_algo->ops->enable_vlan_filter(h, true);
|
||||||
|
else
|
||||||
|
h->ae_algo->ops->enable_vlan_filter(h, false);
|
||||||
|
|
||||||
changed = netdev->features ^ features;
|
changed = netdev->features ^ features;
|
||||||
if (changed & NETIF_F_HW_VLAN_CTAG_RX) {
|
if (changed & NETIF_F_HW_VLAN_CTAG_RX) {
|
||||||
if (features & NETIF_F_HW_VLAN_CTAG_RX)
|
if (features & NETIF_F_HW_VLAN_CTAG_RX)
|
||||||
@ -1549,6 +1554,8 @@ static struct pci_driver hns3_driver = {
|
|||||||
/* set default feature to hns3 */
|
/* set default feature to hns3 */
|
||||||
static void hns3_set_default_feature(struct net_device *netdev)
|
static void hns3_set_default_feature(struct net_device *netdev)
|
||||||
{
|
{
|
||||||
|
struct hnae3_handle *h = hns3_get_handle(netdev);
|
||||||
|
|
||||||
netdev->priv_flags |= IFF_UNICAST_FLT;
|
netdev->priv_flags |= IFF_UNICAST_FLT;
|
||||||
|
|
||||||
netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
|
netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
|
||||||
@ -1577,12 +1584,14 @@ static void hns3_set_default_feature(struct net_device *netdev)
|
|||||||
NETIF_F_GSO_UDP_TUNNEL_CSUM;
|
NETIF_F_GSO_UDP_TUNNEL_CSUM;
|
||||||
|
|
||||||
netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
|
netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
|
||||||
NETIF_F_HW_VLAN_CTAG_FILTER |
|
|
||||||
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
|
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
|
||||||
NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO |
|
NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO |
|
||||||
NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE |
|
NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE |
|
||||||
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL |
|
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL |
|
||||||
NETIF_F_GSO_UDP_TUNNEL_CSUM;
|
NETIF_F_GSO_UDP_TUNNEL_CSUM;
|
||||||
|
|
||||||
|
if (!(h->flags & HNAE3_SUPPORT_VF))
|
||||||
|
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
|
static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
|
||||||
|
@ -4241,6 +4241,17 @@ static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define HCLGE_FILTER_TYPE_VF 0
|
||||||
|
#define HCLGE_FILTER_TYPE_PORT 1
|
||||||
|
|
||||||
|
static void hclge_enable_vlan_filter(struct hnae3_handle *handle, bool enable)
|
||||||
|
{
|
||||||
|
struct hclge_vport *vport = hclge_get_vport(handle);
|
||||||
|
struct hclge_dev *hdev = vport->back;
|
||||||
|
|
||||||
|
hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, enable);
|
||||||
|
}
|
||||||
|
|
||||||
int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid,
|
int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid,
|
||||||
bool is_kill, u16 vlan, u8 qos, __be16 proto)
|
bool is_kill, u16 vlan, u8 qos, __be16 proto)
|
||||||
{
|
{
|
||||||
@ -4469,8 +4480,6 @@ static int hclge_set_vlan_protocol_type(struct hclge_dev *hdev)
|
|||||||
|
|
||||||
static int hclge_init_vlan_config(struct hclge_dev *hdev)
|
static int hclge_init_vlan_config(struct hclge_dev *hdev)
|
||||||
{
|
{
|
||||||
#define HCLGE_FILTER_TYPE_VF 0
|
|
||||||
#define HCLGE_FILTER_TYPE_PORT 1
|
|
||||||
#define HCLGE_DEF_VLAN_TYPE 0x8100
|
#define HCLGE_DEF_VLAN_TYPE 0x8100
|
||||||
|
|
||||||
struct hnae3_handle *handle;
|
struct hnae3_handle *handle;
|
||||||
@ -5482,6 +5491,7 @@ static const struct hnae3_ae_ops hclge_ops = {
|
|||||||
.get_sset_count = hclge_get_sset_count,
|
.get_sset_count = hclge_get_sset_count,
|
||||||
.get_fw_version = hclge_get_fw_version,
|
.get_fw_version = hclge_get_fw_version,
|
||||||
.get_mdix_mode = hclge_get_mdix_mode,
|
.get_mdix_mode = hclge_get_mdix_mode,
|
||||||
|
.enable_vlan_filter = hclge_enable_vlan_filter,
|
||||||
.set_vlan_filter = hclge_set_port_vlan_filter,
|
.set_vlan_filter = hclge_set_port_vlan_filter,
|
||||||
.set_vf_vlan_filter = hclge_set_vf_vlan_filter,
|
.set_vf_vlan_filter = hclge_set_vf_vlan_filter,
|
||||||
.enable_hw_strip_rxvtag = hclge_en_hw_strip_rxvtag,
|
.enable_hw_strip_rxvtag = hclge_en_hw_strip_rxvtag,
|
||||||
|
Loading…
Reference in New Issue
Block a user