1*e6550b3eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2*e6550b3eSThomas Gleixner /* Copyright 2011 Cisco Systems, Inc.  All rights reserved. */
3a6a5580cSJeff Kirsher 
4a6a5580cSJeff Kirsher #ifndef _ENIC_DEV_H_
5a6a5580cSJeff Kirsher #define _ENIC_DEV_H_
6a6a5580cSJeff Kirsher 
7889d13f5SRoopa Prabhu #include "vnic_dev.h"
8f13bbc2fSNeel Patel #include "vnic_vic.h"
9889d13f5SRoopa Prabhu 
10889d13f5SRoopa Prabhu /*
11889d13f5SRoopa Prabhu  * Calls the devcmd function given by argument vnicdevcmdfn.
12889d13f5SRoopa Prabhu  * If vf argument is valid, it proxies the devcmd
13889d13f5SRoopa Prabhu  */
14889d13f5SRoopa Prabhu #define ENIC_DEVCMD_PROXY_BY_INDEX(vf, err, enic, vnicdevcmdfn, ...) \
15889d13f5SRoopa Prabhu 	do { \
168e091340STony Camuso 		spin_lock_bh(&enic->devcmd_lock); \
17889d13f5SRoopa Prabhu 		if (enic_is_valid_vf(enic, vf)) { \
18889d13f5SRoopa Prabhu 			vnic_dev_cmd_proxy_by_index_start(enic->vdev, vf); \
19889d13f5SRoopa Prabhu 			err = vnicdevcmdfn(enic->vdev, ##__VA_ARGS__); \
20889d13f5SRoopa Prabhu 			vnic_dev_cmd_proxy_end(enic->vdev); \
21889d13f5SRoopa Prabhu 		} else { \
22889d13f5SRoopa Prabhu 			err = vnicdevcmdfn(enic->vdev, ##__VA_ARGS__); \
23889d13f5SRoopa Prabhu 		} \
248e091340STony Camuso 		spin_unlock_bh(&enic->devcmd_lock); \
25889d13f5SRoopa Prabhu 	} while (0)
26889d13f5SRoopa Prabhu 
27a6a5580cSJeff Kirsher int enic_dev_fw_info(struct enic *enic, struct vnic_devcmd_fw_info **fw_info);
28a6a5580cSJeff Kirsher int enic_dev_stats_dump(struct enic *enic, struct vnic_stats **vstats);
29a6a5580cSJeff Kirsher int enic_dev_add_station_addr(struct enic *enic);
30a6a5580cSJeff Kirsher int enic_dev_del_station_addr(struct enic *enic);
31a6a5580cSJeff Kirsher int enic_dev_packet_filter(struct enic *enic, int directed, int multicast,
32a6a5580cSJeff Kirsher 	int broadcast, int promisc, int allmulti);
33f009618aSAlexander Duyck int enic_dev_add_addr(struct enic *enic, const u8 *addr);
34f009618aSAlexander Duyck int enic_dev_del_addr(struct enic *enic, const u8 *addr);
3580d5c368SPatrick McHardy int enic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid);
3680d5c368SPatrick McHardy int enic_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid);
37a6a5580cSJeff Kirsher int enic_dev_notify_unset(struct enic *enic);
38a6a5580cSJeff Kirsher int enic_dev_hang_notify(struct enic *enic);
39a6a5580cSJeff Kirsher int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);
40a6a5580cSJeff Kirsher int enic_dev_enable(struct enic *enic);
41a6a5580cSJeff Kirsher int enic_dev_disable(struct enic *enic);
42a6a5580cSJeff Kirsher int enic_dev_intr_coal_timer_info(struct enic *enic);
43a6a5580cSJeff Kirsher int enic_dev_status_to_errno(int devcmd_status);
44a6a5580cSJeff Kirsher 
45a6a5580cSJeff Kirsher #endif /* _ENIC_DEV_H_ */
46