1a6a5580cSJeff Kirsher /*
2a6a5580cSJeff Kirsher  * Copyright 2011 Cisco Systems, Inc.  All rights reserved.
3a6a5580cSJeff Kirsher  *
4a6a5580cSJeff Kirsher  * This program is free software; you may redistribute it and/or modify
5a6a5580cSJeff Kirsher  * it under the terms of the GNU General Public License as published by
6a6a5580cSJeff Kirsher  * the Free Software Foundation; version 2 of the License.
7a6a5580cSJeff Kirsher  *
8a6a5580cSJeff Kirsher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9a6a5580cSJeff Kirsher  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10a6a5580cSJeff Kirsher  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11a6a5580cSJeff Kirsher  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12a6a5580cSJeff Kirsher  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13a6a5580cSJeff Kirsher  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14a6a5580cSJeff Kirsher  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15a6a5580cSJeff Kirsher  * SOFTWARE.
16a6a5580cSJeff Kirsher  *
17a6a5580cSJeff Kirsher  */
18a6a5580cSJeff Kirsher 
19a6a5580cSJeff Kirsher #ifndef _ENIC_DEV_H_
20a6a5580cSJeff Kirsher #define _ENIC_DEV_H_
21a6a5580cSJeff Kirsher 
22889d13f5SRoopa Prabhu #include "vnic_dev.h"
23889d13f5SRoopa Prabhu 
24889d13f5SRoopa Prabhu /*
25889d13f5SRoopa Prabhu  * Calls the devcmd function given by argument vnicdevcmdfn.
26889d13f5SRoopa Prabhu  * If vf argument is valid, it proxies the devcmd
27889d13f5SRoopa Prabhu  */
28889d13f5SRoopa Prabhu #define ENIC_DEVCMD_PROXY_BY_INDEX(vf, err, enic, vnicdevcmdfn, ...) \
29889d13f5SRoopa Prabhu 	do { \
30889d13f5SRoopa Prabhu 		spin_lock(&enic->devcmd_lock); \
31889d13f5SRoopa Prabhu 		if (enic_is_valid_vf(enic, vf)) { \
32889d13f5SRoopa Prabhu 			vnic_dev_cmd_proxy_by_index_start(enic->vdev, vf); \
33889d13f5SRoopa Prabhu 			err = vnicdevcmdfn(enic->vdev, ##__VA_ARGS__); \
34889d13f5SRoopa Prabhu 			vnic_dev_cmd_proxy_end(enic->vdev); \
35889d13f5SRoopa Prabhu 		} else { \
36889d13f5SRoopa Prabhu 			err = vnicdevcmdfn(enic->vdev, ##__VA_ARGS__); \
37889d13f5SRoopa Prabhu 		} \
38889d13f5SRoopa Prabhu 		spin_unlock(&enic->devcmd_lock); \
39889d13f5SRoopa Prabhu 	} while (0)
40889d13f5SRoopa Prabhu 
41a6a5580cSJeff Kirsher int enic_dev_fw_info(struct enic *enic, struct vnic_devcmd_fw_info **fw_info);
42a6a5580cSJeff Kirsher int enic_dev_stats_dump(struct enic *enic, struct vnic_stats **vstats);
43a6a5580cSJeff Kirsher int enic_dev_add_station_addr(struct enic *enic);
44a6a5580cSJeff Kirsher int enic_dev_del_station_addr(struct enic *enic);
45a6a5580cSJeff Kirsher int enic_dev_packet_filter(struct enic *enic, int directed, int multicast,
46a6a5580cSJeff Kirsher 	int broadcast, int promisc, int allmulti);
47a6a5580cSJeff Kirsher int enic_dev_add_addr(struct enic *enic, u8 *addr);
48a6a5580cSJeff Kirsher int enic_dev_del_addr(struct enic *enic, u8 *addr);
49a6a5580cSJeff Kirsher void enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
50a6a5580cSJeff Kirsher void enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
51a6a5580cSJeff Kirsher int enic_dev_notify_unset(struct enic *enic);
52a6a5580cSJeff Kirsher int enic_dev_hang_notify(struct enic *enic);
53a6a5580cSJeff Kirsher int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);
54a6a5580cSJeff Kirsher int enic_dev_enable(struct enic *enic);
55a6a5580cSJeff Kirsher int enic_dev_disable(struct enic *enic);
56a6a5580cSJeff Kirsher int enic_dev_intr_coal_timer_info(struct enic *enic);
57a6a5580cSJeff Kirsher int enic_vnic_dev_deinit(struct enic *enic);
58a6a5580cSJeff Kirsher int enic_dev_init_prov2(struct enic *enic, struct vic_provinfo *vp);
59a6a5580cSJeff Kirsher int enic_dev_deinit_done(struct enic *enic, int *status);
60a6a5580cSJeff Kirsher int enic_dev_enable2(struct enic *enic, int arg);
61a6a5580cSJeff Kirsher int enic_dev_enable2_done(struct enic *enic, int *status);
62a6a5580cSJeff Kirsher int enic_dev_status_to_errno(int devcmd_status);
63a6a5580cSJeff Kirsher 
64a6a5580cSJeff Kirsher #endif /* _ENIC_DEV_H_ */
65