]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cxgb4: Add sge ec context flush service
authorHariprasad Shenai <hariprasad@chelsio.com>
Fri, 5 Jun 2015 08:54:48 +0000 (14:24 +0530)
committerDavid S. Miller <davem@davemloft.net>
Sat, 6 Jun 2015 04:25:56 +0000 (21:25 -0700)
Add function to flush the sge ec context cache, and utilize
this new function in the driver

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
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h

index 93e6cbc3b4a84809fba158c55731c16a342fa90d..1043d7ae31e1c102e370290ac90a3c91185adddc 100644 (file)
@@ -1410,6 +1410,7 @@ int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
                    unsigned int vf, unsigned int eqid);
 int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
                    unsigned int vf, unsigned int eqid);
+int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox);
 int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
 void t4_db_full(struct adapter *adapter);
 void t4_db_dropped(struct adapter *adapter);
index e6abdb7cdcaee0fbd7f4d07c502f31a98abb4ca4..3ca7e247414f9b84297a16d56995dc4ddc89869a 100644 (file)
@@ -2007,11 +2007,8 @@ EXPORT_SYMBOL(cxgb4_iscsi_init);
 int cxgb4_flush_eq_cache(struct net_device *dev)
 {
        struct adapter *adap = netdev2adap(dev);
-       int ret;
 
-       ret = t4_fwaddrspace_write(adap, adap->mbox,
-                                  0xe1000000 + SGE_CTXT_CMD_A, 0x20000000);
-       return ret;
+       return t4_sge_ctxt_flush(adap, adap->mbox);
 }
 EXPORT_SYMBOL(cxgb4_flush_eq_cache);
 
index 3a56254f27a86b73f15fac9900fe7d0a06d19e3b..e24f650d719a4c40b6204a2b275687bd7e45a1b3 100644 (file)
@@ -4529,6 +4529,32 @@ void t4_sge_decode_idma_state(struct adapter *adapter, int state)
                        sge_regs[i], t4_read_reg(adapter, sge_regs[i]));
 }
 
+/**
+ *      t4_sge_ctxt_flush - flush the SGE context cache
+ *      @adap: the adapter
+ *      @mbox: mailbox to use for the FW command
+ *
+ *      Issues a FW command through the given mailbox to flush the
+ *      SGE context cache.
+ */
+int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox)
+{
+       int ret;
+       u32 ldst_addrspace;
+       struct fw_ldst_cmd c;
+
+       memset(&c, 0, sizeof(c));
+       ldst_addrspace = FW_LDST_CMD_ADDRSPACE_V(FW_LDST_ADDRSPC_SGE_EGRC);
+       c.op_to_addrspace = cpu_to_be32(FW_CMD_OP_V(FW_LDST_CMD) |
+                                       FW_CMD_REQUEST_F | FW_CMD_READ_F |
+                                       ldst_addrspace);
+       c.cycles_to_len16 = cpu_to_be32(FW_LEN16(c));
+       c.u.idctxt.msg_ctxtflush = cpu_to_be32(FW_LDST_CMD_CTXTFLUSH_F);
+
+       ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
+       return ret;
+}
+
 /**
  *      t4_fw_hello - establish communication with FW
  *      @adap: the adapter
index aceb1e8cacc894475ed8ff6cbeb8a9783c3f4f3c..ab4674684acc27fb18f7c9b6fb114eb9dfa2b0d0 100644 (file)
@@ -772,7 +772,7 @@ struct fw_ldst_cmd {
                } addrval;
                struct fw_ldst_idctxt {
                        __be32 physid;
-                       __be32 msg_pkd;
+                       __be32 msg_ctxtflush;
                        __be32 ctxt_data7;
                        __be32 ctxt_data6;
                        __be32 ctxt_data5;
@@ -834,6 +834,10 @@ struct fw_ldst_cmd {
 #define FW_LDST_CMD_MSG_S       31
 #define FW_LDST_CMD_MSG_V(x)   ((x) << FW_LDST_CMD_MSG_S)
 
+#define FW_LDST_CMD_CTXTFLUSH_S                30
+#define FW_LDST_CMD_CTXTFLUSH_V(x)     ((x) << FW_LDST_CMD_CTXTFLUSH_S)
+#define FW_LDST_CMD_CTXTFLUSH_F                FW_LDST_CMD_CTXTFLUSH_V(1U)
+
 #define FW_LDST_CMD_PADDR_S     8
 #define FW_LDST_CMD_PADDR_V(x) ((x) << FW_LDST_CMD_PADDR_S)