]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
cxgb4: Free Virtual Interfaces in remove routine
authorHariprasad Shenai <hariprasad@chelsio.com>
Fri, 5 Jun 2015 08:54:47 +0000 (14:24 +0530)
committerDavid S. Miller <davem@davemloft.net>
Sat, 6 Jun 2015 04:25:55 +0000 (21:25 -0700)
Free VI interfaces in remove routine. If we don't do this then the
firmware will never drop the physical link to the peer.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c

index bf2b822d0e8ebb9f89a678ac8313fd210b99eedf..93e6cbc3b4a84809fba158c55731c16a342fa90d 100644 (file)
@@ -1378,6 +1378,9 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf,
 int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
                unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
                unsigned int *rss_size);
+int t4_free_vi(struct adapter *adap, unsigned int mbox,
+              unsigned int pf, unsigned int vf,
+              unsigned int viid);
 int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
                int mtu, int promisc, int all_multi, int bcast, int vlanex,
                bool sleep_ok);
index 3057154840042e391e5d9b2c1ef123e6aa353408..e6abdb7cdcaee0fbd7f4d07c502f31a98abb4ca4 100644 (file)
@@ -4538,6 +4538,11 @@ static void free_some_resources(struct adapter *adapter)
 
        for_each_port(adapter, i)
                if (adapter->port[i]) {
+                       struct port_info *pi = adap2pinfo(adapter, i);
+
+                       if (pi->viid != 0)
+                               t4_free_vi(adapter, adapter->mbox, adapter->pf,
+                                          0, pi->viid);
                        kfree(adap2pinfo(adapter, i)->rss);
                        free_netdev(adapter->port[i]);
                }
index c21ab2686a690380b34f859be35a19194a6723c1..3a56254f27a86b73f15fac9900fe7d0a06d19e3b 100644 (file)
@@ -5225,6 +5225,33 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
        return FW_VI_CMD_VIID_G(be16_to_cpu(c.type_viid));
 }
 
+/**
+ *     t4_free_vi - free a virtual interface
+ *     @adap: the adapter
+ *     @mbox: mailbox to use for the FW command
+ *     @pf: the PF owning the VI
+ *     @vf: the VF owning the VI
+ *     @viid: virtual interface identifiler
+ *
+ *     Free a previously allocated virtual interface.
+ */
+int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf,
+              unsigned int vf, unsigned int viid)
+{
+       struct fw_vi_cmd c;
+
+       memset(&c, 0, sizeof(c));
+       c.op_to_vfn = cpu_to_be32(FW_CMD_OP_V(FW_VI_CMD) |
+                                 FW_CMD_REQUEST_F |
+                                 FW_CMD_EXEC_F |
+                                 FW_VI_CMD_PFN_V(pf) |
+                                 FW_VI_CMD_VFN_V(vf));
+       c.alloc_to_len16 = cpu_to_be32(FW_VI_CMD_FREE_F | FW_LEN16(c));
+       c.type_viid = cpu_to_be16(FW_VI_CMD_VIID_V(viid));
+
+       return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
+}
+
 /**
  *     t4_set_rxmode - set Rx properties of a virtual interface
  *     @adap: the adapter