aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cxgbe/common/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/cxgbe/common/common.h')
-rw-r--r--sys/dev/cxgbe/common/common.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h
index 894e0444b710..6e80ce40648b 100644
--- a/sys/dev/cxgbe/common/common.h
+++ b/sys/dev/cxgbe/common/common.h
@@ -948,6 +948,7 @@ int t4vf_get_vfres(struct adapter *adapter);
int t4vf_prep_adapter(struct adapter *adapter);
int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port,
unsigned int *naddr, u8 *addr);
+int t4vf_get_vf_vlan(struct adapter *adapter);
int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
enum t4_bar2_qtype qtype, int user, u64 *pbar2_qoffset,
unsigned int *pbar2_qid);
@@ -963,4 +964,46 @@ port_top_speed(const struct port_info *pi)
return (fwcap_to_speed(pi->link_cfg.pcaps) / 1000);
}
+/* SET_TCB_FIELD sent as a ULP command looks like this */
+#define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \
+ sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core))
+
+static inline void *
+mk_set_tcb_field_ulp(struct adapter *sc, void *cur, int tid, uint16_t word,
+ uint64_t mask, uint64_t val)
+{
+ struct ulp_txpkt *ulpmc;
+ struct ulptx_idata *ulpsc;
+ struct cpl_set_tcb_field_core *req;
+
+ MPASS(((uintptr_t)cur & 7) == 0);
+
+ ulpmc = cur;
+ ulpmc->cmd_dest = htobe32(V_ULPTX_CMD(ULP_TX_PKT) |
+ V_ULP_TXPKT_DEST(ULP_TXPKT_DEST_TP));
+ ulpmc->len = htobe32(howmany(LEN__SET_TCB_FIELD_ULP, 16));
+
+ ulpsc = (struct ulptx_idata *)(ulpmc + 1);
+ ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM));
+ ulpsc->len = htobe32(sizeof(*req));
+
+ req = (struct cpl_set_tcb_field_core *)(ulpsc + 1);
+ OPCODE_TID(req) = htobe32(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid));
+ req->reply_ctrl = htobe16(F_NO_REPLY);
+ req->word_cookie = htobe16(V_WORD(word) | V_COOKIE(0));
+ req->mask = htobe64(mask);
+ req->val = htobe64(val);
+
+ /*
+ * ULP_TX is an 8B processor but the firmware transfers WRs in 16B
+ * chunks. The master command for set_tcb_field does not end at a 16B
+ * boundary so it needs to be padded with a no-op.
+ */
+ MPASS((LEN__SET_TCB_FIELD_ULP & 0xf) != 0);
+ ulpsc = (struct ulptx_idata *)(req + 1);
+ ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_NOOP));
+ ulpsc->len = htobe32(0);
+
+ return (ulpsc + 1);
+}
#endif /* __CHELSIO_COMMON_H */