cxgb4: Free Virtual Interfaces in remove routine
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>
This commit is contained in:
committed by
David S. Miller
parent
bb62f791f9
commit
4f3a0fcfb6
@@ -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);
|
||||
|
@@ -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]);
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user