Skip to content

Commit 359e41f

Browse files
Mengyuan Loukuba-moo
authored andcommitted
net: libwx: Add msg task func
Implement wx_msg_task which is used to process mailbox messages sent by vf. Signed-off-by: Mengyuan Lou <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c52d4b8 commit 359e41f

File tree

6 files changed

+703
-4
lines changed

6 files changed

+703
-4
lines changed

drivers/net/ethernet/wangxun/libwx/wx_hw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ void wx_flush_sw_mac_table(struct wx *wx)
10111011
}
10121012
EXPORT_SYMBOL(wx_flush_sw_mac_table);
10131013

1014-
static int wx_add_mac_filter(struct wx *wx, u8 *addr, u16 pool)
1014+
int wx_add_mac_filter(struct wx *wx, u8 *addr, u16 pool)
10151015
{
10161016
u32 i;
10171017

@@ -1042,7 +1042,7 @@ static int wx_add_mac_filter(struct wx *wx, u8 *addr, u16 pool)
10421042
return -ENOMEM;
10431043
}
10441044

1045-
static int wx_del_mac_filter(struct wx *wx, u8 *addr, u16 pool)
1045+
int wx_del_mac_filter(struct wx *wx, u8 *addr, u16 pool)
10461046
{
10471047
u32 i;
10481048

@@ -1469,7 +1469,7 @@ static void wx_set_ethertype_anti_spoofing(struct wx *wx, bool enable, int vf)
14691469
wr32(wx, WX_TDM_ETYPE_AS(reg_offset), pfvfspoof);
14701470
}
14711471

1472-
static int wx_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)
1472+
int wx_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)
14731473
{
14741474
u32 index = WX_VF_REG_OFFSET(vf), vf_bit = WX_VF_IND_SHIFT(vf);
14751475
struct wx *wx = netdev_priv(netdev);
@@ -2530,7 +2530,7 @@ static int wx_set_vlvf(struct wx *wx, u32 vlan, u32 vind, bool vlan_on,
25302530
*
25312531
* Turn on/off specified VLAN in the VLAN filter table.
25322532
**/
2533-
static int wx_set_vfta(struct wx *wx, u32 vlan, u32 vind, bool vlan_on)
2533+
int wx_set_vfta(struct wx *wx, u32 vlan, u32 vind, bool vlan_on)
25342534
{
25352535
u32 bitindex, vfta, targetbit;
25362536
bool vfta_changed = false;

drivers/net/ethernet/wangxun/libwx/wx_hw.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ void wx_init_eeprom_params(struct wx *wx);
2626
void wx_get_mac_addr(struct wx *wx, u8 *mac_addr);
2727
void wx_init_rx_addrs(struct wx *wx);
2828
void wx_mac_set_default_filter(struct wx *wx, u8 *addr);
29+
int wx_add_mac_filter(struct wx *wx, u8 *addr, u16 pool);
30+
int wx_del_mac_filter(struct wx *wx, u8 *addr, u16 pool);
2931
void wx_flush_sw_mac_table(struct wx *wx);
3032
int wx_set_mac(struct net_device *netdev, void *p);
3133
void wx_disable_rx(struct wx *wx);
34+
int wx_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
3235
int wx_disable_sec_rx_path(struct wx *wx);
3336
void wx_enable_sec_rx_path(struct wx *wx);
3437
void wx_set_rx_mode(struct net_device *netdev);
@@ -42,6 +45,7 @@ int wx_stop_adapter(struct wx *wx);
4245
void wx_reset_misc(struct wx *wx);
4346
int wx_get_pcie_msix_counts(struct wx *wx, u16 *msix_count, u16 max_msix_count);
4447
int wx_sw_init(struct wx *wx);
48+
int wx_set_vfta(struct wx *wx, u32 vlan, u32 vind, bool vlan_on);
4549
int wx_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid);
4650
int wx_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid);
4751
int wx_fc_enable(struct wx *wx, bool tx_pause, bool rx_pause);

drivers/net/ethernet/wangxun/libwx/wx_mbx.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,51 @@
2121
#define WX_MBVFICR_VFREQ_MASK GENMASK(15, 0)
2222
#define WX_MBVFICR_VFACK_MASK GENMASK(31, 16)
2323

24+
#define WX_VT_MSGTYPE_ACK BIT(31)
25+
#define WX_VT_MSGTYPE_NACK BIT(30)
26+
#define WX_VT_MSGTYPE_CTS BIT(29)
27+
#define WX_VT_MSGINFO_SHIFT 16
2428
#define WX_VT_MSGINFO_MASK GENMASK(23, 16)
2529

30+
enum wx_pfvf_api_rev {
31+
wx_mbox_api_null,
32+
wx_mbox_api_13 = 4, /* API version 1.3 */
33+
wx_mbox_api_unknown, /* indicates that API version is not known */
34+
};
35+
36+
/* mailbox API */
37+
#define WX_VF_RESET 0x01 /* VF requests reset */
38+
#define WX_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
39+
#define WX_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */
40+
#define WX_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */
41+
#define WX_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */
42+
#define WX_VF_SET_MACVLAN 0x06 /* VF requests PF unicast filter */
43+
#define WX_VF_API_NEGOTIATE 0x08 /* negotiate API version */
44+
#define WX_VF_GET_QUEUES 0x09 /* get queue configuration */
45+
#define WX_VF_GET_RETA 0x0a /* VF request for RETA */
46+
#define WX_VF_GET_RSS_KEY 0x0b /* get RSS key */
47+
#define WX_VF_UPDATE_XCAST_MODE 0x0c
48+
#define WX_VF_GET_LINK_STATE 0x10 /* get vf link state */
49+
#define WX_VF_GET_FW_VERSION 0x11 /* get fw version */
50+
51+
#define WX_VF_BACKUP 0x8001 /* VF requests backup */
52+
53+
#define WX_PF_CONTROL_MSG BIT(8) /* PF control message */
54+
#define WX_PF_NOFITY_VF_LINK_STATUS 0x1
55+
#define WX_PF_NOFITY_VF_NET_NOT_RUNNING BIT(31)
56+
57+
#define WX_VF_TX_QUEUES 1 /* number of Tx queues supported */
58+
#define WX_VF_RX_QUEUES 2 /* number of Rx queues supported */
59+
#define WX_VF_TRANS_VLAN 3 /* Indication of port vlan */
60+
#define WX_VF_DEF_QUEUE 4 /* Default queue offset */
61+
62+
#define WX_VF_PERMADDR_MSG_LEN 4
63+
2664
enum wxvf_xcast_modes {
2765
WXVF_XCAST_MODE_NONE = 0,
66+
WXVF_XCAST_MODE_MULTI,
67+
WXVF_XCAST_MODE_ALLMULTI,
68+
WXVF_XCAST_MODE_PROMISC,
2869
};
2970

3071
int wx_write_mbx_pf(struct wx *wx, u32 *msg, u16 size, u16 vf);

0 commit comments

Comments
 (0)