diff options
author | Neel Patel <neepatel@cisco.com> | 2013-08-16 18:47:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-20 16:41:01 -0400 |
commit | 0b038566c0ea9f8daceae879bb7ad748ab8c95f0 (patch) | |
tree | 6c841a5be391190b81647600269d0aece942e995 /drivers/net/ethernet/cisco | |
parent | 92e2b4696202934b4cbf1d6b8fb8729e8d7202e1 (diff) |
drivers/net: enic: Add an interface for USNIC to interact with firmware
This patch adds an interface for USNIC to proxy firmware commands
through ENIC.
Signed-off-by: Neel Patel <neepatel@cisco.com>
Signed-off-by: Nishank Trivedi <nistrive@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cisco')
-rw-r--r-- | drivers/net/ethernet/cisco/enic/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic_api.c | 48 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic_api.h | 30 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic_main.c | 3 |
5 files changed, 83 insertions, 1 deletions
diff --git a/drivers/net/ethernet/cisco/enic/Makefile b/drivers/net/ethernet/cisco/enic/Makefile index e52296d9b256..239e1e46545d 100644 --- a/drivers/net/ethernet/cisco/enic/Makefile +++ b/drivers/net/ethernet/cisco/enic/Makefile | |||
@@ -2,5 +2,5 @@ obj-$(CONFIG_ENIC) := enic.o | |||
2 | 2 | ||
3 | enic-y := enic_main.o vnic_cq.o vnic_intr.o vnic_wq.o \ | 3 | enic-y := enic_main.o vnic_cq.o vnic_intr.o vnic_wq.o \ |
4 | enic_res.o enic_dev.o enic_pp.o vnic_dev.o vnic_rq.o vnic_vic.o \ | 4 | enic_res.o enic_dev.o enic_pp.o vnic_dev.o vnic_rq.o vnic_vic.o \ |
5 | enic_ethtool.o | 5 | enic_ethtool.o enic_api.o |
6 | 6 | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h index 75e842d6cfe7..cacca29a7efc 100644 --- a/drivers/net/ethernet/cisco/enic/enic.h +++ b/drivers/net/ethernet/cisco/enic/enic.h | |||
@@ -96,6 +96,7 @@ struct enic { | |||
96 | #ifdef CONFIG_PCI_IOV | 96 | #ifdef CONFIG_PCI_IOV |
97 | u16 num_vfs; | 97 | u16 num_vfs; |
98 | #endif | 98 | #endif |
99 | spinlock_t enic_api_lock; | ||
99 | struct enic_port_profile *pp; | 100 | struct enic_port_profile *pp; |
100 | 101 | ||
101 | /* work queue cache line section */ | 102 | /* work queue cache line section */ |
diff --git a/drivers/net/ethernet/cisco/enic/enic_api.c b/drivers/net/ethernet/cisco/enic/enic_api.c new file mode 100644 index 000000000000..e13efbdaa2ed --- /dev/null +++ b/drivers/net/ethernet/cisco/enic/enic_api.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /** | ||
2 | * Copyright 2013 Cisco Systems, Inc. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you may redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; version 2 of the License. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
9 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
10 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
11 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
12 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
15 | * SOFTWARE. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #include <linux/netdevice.h> | ||
20 | #include <linux/spinlock.h> | ||
21 | |||
22 | #include "vnic_dev.h" | ||
23 | #include "vnic_devcmd.h" | ||
24 | |||
25 | #include "enic_res.h" | ||
26 | #include "enic.h" | ||
27 | #include "enic_api.h" | ||
28 | |||
29 | int enic_api_devcmd_proxy_by_index(struct net_device *netdev, int vf, | ||
30 | enum vnic_devcmd_cmd cmd, u64 *a0, u64 *a1, int wait) | ||
31 | { | ||
32 | int err; | ||
33 | struct enic *enic = netdev_priv(netdev); | ||
34 | struct vnic_dev *vdev = enic->vdev; | ||
35 | |||
36 | spin_lock(&enic->enic_api_lock); | ||
37 | spin_lock(&enic->devcmd_lock); | ||
38 | |||
39 | vnic_dev_cmd_proxy_by_index_start(vdev, vf); | ||
40 | err = vnic_dev_cmd(vdev, cmd, a0, a1, wait); | ||
41 | vnic_dev_cmd_proxy_end(vdev); | ||
42 | |||
43 | spin_unlock(&enic->devcmd_lock); | ||
44 | spin_unlock(&enic->enic_api_lock); | ||
45 | |||
46 | return err; | ||
47 | } | ||
48 | EXPORT_SYMBOL(enic_api_devcmd_proxy_by_index); | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic_api.h b/drivers/net/ethernet/cisco/enic/enic_api.h new file mode 100644 index 000000000000..6b9f9255af28 --- /dev/null +++ b/drivers/net/ethernet/cisco/enic/enic_api.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /** | ||
2 | * Copyright 2013 Cisco Systems, Inc. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you may redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; version 2 of the License. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
9 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
10 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
11 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
12 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
15 | * SOFTWARE. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef __ENIC_API_H__ | ||
20 | #define __ENIC_API_H__ | ||
21 | |||
22 | #include <linux/netdevice.h> | ||
23 | |||
24 | #include "vnic_dev.h" | ||
25 | #include "vnic_devcmd.h" | ||
26 | |||
27 | int enic_api_devcmd_proxy_by_index(struct net_device *netdev, int vf, | ||
28 | enum vnic_devcmd_cmd cmd, u64 *a0, u64 *a1, int wait); | ||
29 | |||
30 | #endif | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index b12b32bc53a6..7f8891b36bf7 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -1733,6 +1733,7 @@ static void enic_reset(struct work_struct *work) | |||
1733 | 1733 | ||
1734 | rtnl_lock(); | 1734 | rtnl_lock(); |
1735 | 1735 | ||
1736 | spin_lock(&enic->enic_api_lock); | ||
1736 | enic_dev_hang_notify(enic); | 1737 | enic_dev_hang_notify(enic); |
1737 | enic_stop(enic->netdev); | 1738 | enic_stop(enic->netdev); |
1738 | enic_dev_hang_reset(enic); | 1739 | enic_dev_hang_reset(enic); |
@@ -1741,6 +1742,7 @@ static void enic_reset(struct work_struct *work) | |||
1741 | enic_set_rss_nic_cfg(enic); | 1742 | enic_set_rss_nic_cfg(enic); |
1742 | enic_dev_set_ig_vlan_rewrite_mode(enic); | 1743 | enic_dev_set_ig_vlan_rewrite_mode(enic); |
1743 | enic_open(enic->netdev); | 1744 | enic_open(enic->netdev); |
1745 | spin_unlock(&enic->enic_api_lock); | ||
1744 | 1746 | ||
1745 | rtnl_unlock(); | 1747 | rtnl_unlock(); |
1746 | } | 1748 | } |
@@ -2153,6 +2155,7 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2153 | */ | 2155 | */ |
2154 | 2156 | ||
2155 | spin_lock_init(&enic->devcmd_lock); | 2157 | spin_lock_init(&enic->devcmd_lock); |
2158 | spin_lock_init(&enic->enic_api_lock); | ||
2156 | 2159 | ||
2157 | /* | 2160 | /* |
2158 | * Set ingress vlan rewrite mode before vnic initialization | 2161 | * Set ingress vlan rewrite mode before vnic initialization |