/** * Send CPL_SET_TCB_FIELD message */ static void set_tcb_field(struct adapter *adapter, unsigned int ftid, u16 word, u64 mask, u64 val, int no_reply) { struct rte_mbuf *mbuf; struct cpl_set_tcb_field *req; struct sge_ctrl_txq *ctrlq; ctrlq = &adapter->sge.ctrlq[0]; mbuf = rte_pktmbuf_alloc(ctrlq->mb_pool); WARN_ON(!mbuf); mbuf->data_len = sizeof(*req); mbuf->pkt_len = mbuf->data_len; req = rte_pktmbuf_mtod(mbuf, struct cpl_set_tcb_field *); memset(req, 0, sizeof(*req)); INIT_TP_WR_MIT_CPL(req, CPL_SET_TCB_FIELD, ftid); req->reply_ctrl = cpu_to_be16(V_REPLY_CHAN(0) | V_QUEUENO(adapter->sge.fw_evtq.abs_id) | V_NO_REPLY(no_reply)); req->word_cookie = cpu_to_be16(V_WORD(word) | V_COOKIE(ftid)); req->mask = cpu_to_be64(mask); req->val = cpu_to_be64(val); t4_mgmt_tx(ctrlq, mbuf); }
/* cxgb4_get_srq_entry: read the SRQ table entry * @dev: Pointer to the net_device * @idx: Index to the srq * @entryp: pointer to the srq entry * * Sends CPL_SRQ_TABLE_REQ message for the given index. * Contents will be returned in CPL_SRQ_TABLE_RPL message. * * Returns zero if the read is successful, else a error * number will be returned. Caller should not use the srq * entry if the return value is non-zero. * * */ int cxgb4_get_srq_entry(struct net_device *dev, int srq_idx, struct srq_entry *entryp) { struct cpl_srq_table_req *req; struct adapter *adap; struct sk_buff *skb; struct srq_data *s; int rc = -ENODEV; adap = netdev2adap(dev); s = adap->srq; if (!(adap->flags & FULL_INIT_DONE) || !s) goto out; skb = alloc_skb(sizeof(*req), GFP_KERNEL); if (!skb) return -ENOMEM; req = (struct cpl_srq_table_req *) __skb_put_zero(skb, sizeof(*req)); INIT_TP_WR(req, 0); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SRQ_TABLE_REQ, TID_TID_V(srq_idx) | TID_QID_V(adap->sge.fw_evtq.abs_id))); req->idx = srq_idx; mutex_lock(&s->lock); s->entryp = entryp; t4_mgmt_tx(adap, skb); rc = wait_for_completion_timeout(&s->comp, SRQ_WAIT_TO); if (rc) rc = 0; else /* !rc means we timed out */ rc = -ETIMEDOUT; WARN_ON_ONCE(entryp->idx != srq_idx); mutex_unlock(&s->lock); out: return rc; }
/* Delete the filter at a specified index. */ static int del_filter_wr(struct adapter *adapter, int fidx) { struct filter_entry *f = &adapter->tids.ftid_tab[fidx]; struct fw_filter_wr *fwr; struct sk_buff *skb; unsigned int len; len = sizeof(*fwr); skb = alloc_skb(len, GFP_KERNEL); if (!skb) return -ENOMEM; fwr = __skb_put(skb, len); t4_mk_filtdelwr(f->tid, fwr, (adapter->flags & SHUTTING_DOWN) ? -1 : adapter->sge.fw_evtq.abs_id); /* Mark the filter as "pending" and ship off the Filter Work Request. * When we get the Work Request Reply we'll clear the pending status. */ f->pending = 1; t4_mgmt_tx(adapter, skb); return 0; }
/** * Delete the specified hash filter. */ static int cxgbe_del_hash_filter(struct rte_eth_dev *dev, unsigned int filter_id, struct filter_ctx *ctx) { struct adapter *adapter = ethdev2adap(dev); struct tid_info *t = &adapter->tids; struct filter_entry *f; struct sge_ctrl_txq *ctrlq; unsigned int port_id = ethdev2pinfo(dev)->port_id; int ret; if (filter_id > adapter->tids.ntids) return -E2BIG; f = lookup_tid(t, filter_id); if (!f) { dev_err(adapter, "%s: no filter entry for filter_id = %d\n", __func__, filter_id); return -EINVAL; } ret = writable_filter(f); if (ret) return ret; if (f->valid) { unsigned int wrlen; struct rte_mbuf *mbuf; struct work_request_hdr *wr; struct ulptx_idata *aligner; struct cpl_set_tcb_field *req; struct cpl_abort_req *abort_req; struct cpl_abort_rpl *abort_rpl; f->ctx = ctx; f->pending = 1; wrlen = cxgbe_roundup(sizeof(*wr) + (sizeof(*req) + sizeof(*aligner)) + sizeof(*abort_req) + sizeof(*abort_rpl), 16); ctrlq = &adapter->sge.ctrlq[port_id]; mbuf = rte_pktmbuf_alloc(ctrlq->mb_pool); if (!mbuf) { dev_err(adapter, "%s: could not allocate skb ..\n", __func__); goto out_err; } mbuf->data_len = wrlen; mbuf->pkt_len = mbuf->data_len; req = rte_pktmbuf_mtod(mbuf, struct cpl_set_tcb_field *); INIT_ULPTX_WR(req, wrlen, 0, 0); wr = (struct work_request_hdr *)req; wr++; req = (struct cpl_set_tcb_field *)wr; mk_set_tcb_field_ulp(f, req, W_TCB_RSS_INFO, V_TCB_RSS_INFO(M_TCB_RSS_INFO), V_TCB_RSS_INFO(adapter->sge.fw_evtq.abs_id), 0, 1); aligner = (struct ulptx_idata *)(req + 1); abort_req = (struct cpl_abort_req *)(aligner + 1); mk_abort_req_ulp(abort_req, f->tid); abort_rpl = (struct cpl_abort_rpl *)(abort_req + 1); mk_abort_rpl_ulp(abort_rpl, f->tid); t4_mgmt_tx(ctrlq, mbuf); }