Skip to content

Commit b2641e2

Browse files
Yunsheng Lindavem330
authored andcommitted
net: hns3: Add support of hardware rx-vlan-offload to HNS3 VF driver
This patch adds support of hardware rx-vlan-offload to VF driver. VF uses mailbox to convey PF to configure the hardware. Signed-off-by: Yunsheng Lin <[email protected]> Signed-off-by: Peng Li <[email protected]> Signed-off-by: Salil Mehta <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3e50d2d commit b2641e2

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,8 +1626,6 @@ static struct pci_driver hns3_driver = {
16261626
/* set default feature to hns3 */
16271627
static void hns3_set_default_feature(struct net_device *netdev)
16281628
{
1629-
struct hnae3_handle *h = hns3_get_handle(netdev);
1630-
16311629
netdev->priv_flags |= IFF_UNICAST_FLT;
16321630

16331631
netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
@@ -1656,15 +1654,11 @@ static void hns3_set_default_feature(struct net_device *netdev)
16561654
NETIF_F_GSO_UDP_TUNNEL_CSUM;
16571655

16581656
netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1659-
NETIF_F_HW_VLAN_CTAG_TX |
1657+
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
16601658
NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO |
16611659
NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE |
16621660
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL |
16631661
NETIF_F_GSO_UDP_TUNNEL_CSUM;
1664-
1665-
if (!(h->flags & HNAE3_SUPPORT_VF))
1666-
netdev->hw_features |=
1667-
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_RX;
16681662
}
16691663

16701664
static int hns3_alloc_buffer(struct hns3_enet_ring *ring,

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4862,7 +4862,7 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev)
48624862
return hclge_set_vlan_filter(handle, htons(ETH_P_8021Q), 0, false);
48634863
}
48644864

4865-
static int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
4865+
int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
48664866
{
48674867
struct hclge_vport *vport = hclge_get_vport(handle);
48684868

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ static inline int hclge_get_queue_id(struct hnae3_queue *queue)
652652
int hclge_cfg_mac_speed_dup(struct hclge_dev *hdev, int speed, u8 duplex);
653653
int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
654654
u16 vlan_id, bool is_kill);
655+
int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable);
655656

656657
int hclge_buffer_alloc(struct hclge_dev *hdev);
657658
int hclge_rss_init_hw(struct hclge_dev *hdev);

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ static int hclge_set_vf_vlan_cfg(struct hclge_vport *vport,
276276
memcpy(&proto, &mbx_req->msg[5], sizeof(proto));
277277
status = hclge_set_vlan_filter(handle, cpu_to_be16(proto),
278278
vlan, is_kill);
279+
} else if (mbx_req->msg[1] == HCLGE_MBX_VLAN_RX_OFF_CFG) {
280+
struct hnae3_handle *handle = &vport->nic;
281+
bool en = mbx_req->msg[2] ? true : false;
282+
283+
status = hclge_en_hw_strip_rxvtag(handle, en);
279284
}
280285

281286
if (gen_resp)

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,17 @@ static int hclgevf_set_vlan_filter(struct hnae3_handle *handle,
830830
HCLGEVF_VLAN_MBX_MSG_LEN, false, NULL, 0);
831831
}
832832

833+
static int hclgevf_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
834+
{
835+
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
836+
u8 msg_data;
837+
838+
msg_data = enable ? 1 : 0;
839+
return hclgevf_send_mbx_msg(hdev, HCLGE_MBX_SET_VLAN,
840+
HCLGE_MBX_VLAN_RX_OFF_CFG, &msg_data,
841+
1, false, NULL, 0);
842+
}
843+
833844
static void hclgevf_reset_tqp(struct hnae3_handle *handle, u16 queue_id)
834845
{
835846
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
@@ -1825,6 +1836,7 @@ static const struct hnae3_ae_ops hclgevf_ops = {
18251836
.get_tc_size = hclgevf_get_tc_size,
18261837
.get_fw_version = hclgevf_get_fw_version,
18271838
.set_vlan_filter = hclgevf_set_vlan_filter,
1839+
.enable_hw_strip_rxvtag = hclgevf_en_hw_strip_rxvtag,
18281840
.reset_event = hclgevf_reset_event,
18291841
.get_channels = hclgevf_get_channels,
18301842
.get_tqps_and_rss_info = hclgevf_get_tqps_and_rss_info,

0 commit comments

Comments
 (0)