// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* *Copyright(c)2016MellanoxTechnologiesLtd.Allrightsreserved. *Copyright(c)2015SystemFabricWorks,Inc.Allrightsreserved.
*/
#include <linux/skbuff.h>
#include"rxe.h" #include"rxe_loc.h"
/* check that QP matches packet opcode type and is in a valid state */ staticint check_type_state(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, struct rxe_qp *qp)
{ unsignedint pkt_type; unsignedlong flags;
if (unlikely(!qp->valid)) return -EINVAL;
pkt_type = pkt->opcode & 0xe0;
switch (qp_type(qp)) { case IB_QPT_RC: if (unlikely(pkt_type != IB_OPCODE_RC)) return -EINVAL; break; case IB_QPT_UC: if (unlikely(pkt_type != IB_OPCODE_UC)) return -EINVAL; break; case IB_QPT_UD: case IB_QPT_GSI: if (unlikely(pkt_type != IB_OPCODE_UD)) return -EINVAL; break; default: return -EINVAL;
}
/* lookup mcast group corresponding to mgid, takes a ref */
mcg = rxe_lookup_mcg(rxe, &dgid); if (!mcg) goto drop; /* mcast group not registered */
spin_lock_bh(&rxe->mcg_lock);
/* this is unreliable datagram service so we let *failurestodeliveramulticastpackettoa *singleQPhappenandjustmoveonandtry *therestofthemonthelist
*/
list_for_each_entry(mca, &mcg->qp_list, qp_list) {
qp = mca->qp;
/* validate qp for incoming packet */
err = check_type_state(rxe, pkt, qp); if (err) continue;
err = check_keys(rxe, pkt, bth_qpn(pkt), qp); if (err) continue;
/* for all but the last QP create a new clone of the *skbandpasstotheQP.Passtheoriginalskbto *thelastQPinthelist.
*/ if (mca->qp_list.next != &mcg->qp_list) { struct sk_buff *cskb; struct rxe_pkt_info *cpkt;
cskb = skb_clone(skb, GFP_ATOMIC); if (unlikely(!cskb)) continue;
if (WARN_ON(!ib_device_try_get(&rxe->ib_dev))) {
kfree_skb(cskb); break;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.