MCPcopy Create free account
hub / github.com/F-Stack/f-stack / write_l2e

Function write_l2e

dpdk/drivers/net/cxgbe/l2t.c:53–96  ·  view source on GitHub ↗

* Write an L2T entry. Must be called with the entry locked. * The write may be synchronous or asynchronous. */

Source from the content-addressed store, hash-verified

51 * The write may be synchronous or asynchronous.
52 */
53static int write_l2e(struct rte_eth_dev *dev, struct l2t_entry *e, int sync,
54 bool loopback, bool arpmiss)
55{
56 struct adapter *adap = ethdev2adap(dev);
57 struct l2t_data *d = adap->l2t;
58 struct rte_mbuf *mbuf;
59 struct cpl_l2t_write_req *req;
60 struct sge_ctrl_txq *ctrlq;
61 unsigned int l2t_idx = e->idx + d->l2t_start;
62 unsigned int port_id = ethdev2pinfo(dev)->port_id;
63
64 ctrlq = &adap->sge.ctrlq[port_id];
65 mbuf = rte_pktmbuf_alloc(ctrlq->mb_pool);
66 if (!mbuf)
67 return -ENOMEM;
68
69 mbuf->data_len = sizeof(*req);
70 mbuf->pkt_len = mbuf->data_len;
71
72 req = rte_pktmbuf_mtod(mbuf, struct cpl_l2t_write_req *);
73 INIT_TP_WR(req, 0);
74
75 OPCODE_TID(req) =
76 cpu_to_be32(MK_OPCODE_TID(CPL_L2T_WRITE_REQ,
77 l2t_idx | V_SYNC_WR(sync) |
78 V_TID_QID(adap->sge.fw_evtq.abs_id)));
79 req->params = cpu_to_be16(V_L2T_W_PORT(e->lport) |
80 V_L2T_W_LPBK(loopback) |
81 V_L2T_W_ARPMISS(arpmiss) |
82 V_L2T_W_NOREPLY(!sync));
83 req->l2t_idx = cpu_to_be16(l2t_idx);
84 req->vlan = cpu_to_be16(e->vlan);
85 rte_memcpy(req->dst_mac, e->dmac, RTE_ETHER_ADDR_LEN);
86
87 if (loopback)
88 memset(req->dst_mac, 0, RTE_ETHER_ADDR_LEN);
89
90 t4_mgmt_tx(ctrlq, mbuf);
91
92 if (sync && e->state != L2T_STATE_SWITCHING)
93 e->state = L2T_STATE_SYNC_WRITE;
94
95 return 0;
96}
97
98/**
99 * find_or_alloc_l2e - Find/Allocate a free L2T entry

Callers 1

t4_l2t_alloc_switchingFunction · 0.85

Calls 6

ethdev2adapFunction · 0.85
ethdev2pinfoFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
memsetFunction · 0.85
t4_mgmt_txFunction · 0.85
rte_memcpyFunction · 0.50

Tested by

no test coverage detected