// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
*/
#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 * failures to deliver a multicast packet to a * single QP happen and just move on and try * the rest of them on the list
*/
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 * skb and pass to the QP. Pass the original skb to * the last QP in the list.
*/ 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;
}
/** * rxe_chk_dgid - validate destination IP address * @rxe: rxe device that received packet * @skb: the received packet buffer * * Accept any loopback packets * Extract IP address from packet and * Accept if multicast packet * Accept if matches an SGID table entry
*/ staticint rxe_chk_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
{ struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); conststruct ib_gid_attr *gid_attr; union ib_gid dgid; union ib_gid *pdgid;
if (unlikely(skb->len < header_size(pkt))) goto drop;
err = hdr_check(pkt); if (unlikely(err)) goto drop;
err = rxe_icrc_check(skb, pkt); if (unlikely(err)) goto drop;
rxe_counter_inc(rxe, RXE_CNT_RCVD_PKTS);
if (unlikely(bth_qpn(pkt) == IB_MULTICAST_QPN))
rxe_rcv_mcast_pkt(rxe, skb); else
rxe_rcv_pkt(pkt, skb);
return;
drop: if (pkt->qp)
rxe_put(pkt->qp);
kfree_skb(skb);
ib_device_put(&rxe->ib_dev);
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.13Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-07)
¤
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.