static bool ines_match()

in ptp_ines.c [431:473]


static bool ines_match(struct sk_buff *skb, unsigned int ptp_class,
		       struct ines_timestamp *ts, struct device *dev)
{
	struct ptp_header *hdr;
	u16 portn, seqid;
	u8 msgtype;
	u64 clkid;

	if (unlikely(ptp_class & PTP_CLASS_V1))
		return false;

	hdr = ptp_parse_header(skb, ptp_class);
	if (!hdr)
		return false;

	msgtype = ptp_get_msgtype(hdr, ptp_class);
	clkid = be64_to_cpup((__be64 *)&hdr->source_port_identity.clock_identity.id[0]);
	portn = be16_to_cpu(hdr->source_port_identity.port_number);
	seqid = be16_to_cpu(hdr->sequence_id);

	if (tag_to_msgtype(ts->tag & 0x7) != msgtype) {
		dev_dbg(dev, "msgtype mismatch ts %hhu != skb %hhu\n",
			tag_to_msgtype(ts->tag & 0x7), msgtype);
		return false;
	}
	if (ts->clkid != clkid) {
		dev_dbg(dev, "clkid mismatch ts %llx != skb %llx\n",
			ts->clkid, clkid);
		return false;
	}
	if (ts->portnum != portn) {
		dev_dbg(dev, "portn mismatch ts %hu != skb %hu\n",
			ts->portnum, portn);
		return false;
	}
	if (ts->seqid != seqid) {
		dev_dbg(dev, "seqid mismatch ts %hu != skb %hu\n",
			ts->seqid, seqid);
		return false;
	}

	return true;
}