Re: [PATCH bpf-next v11 12/12] selftests/bpf: add simple bpf tests in the tx path for timestamping feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 15, 2025 at 4:40 AM Martin KaFai Lau <martin.lau@xxxxxxxxx> wrote:
>
> On 2/13/25 5:00 PM, Jason Xing wrote:
> > +static void test_recv_errmsg_cmsg(struct msghdr *msg)
> > +{
> > +     struct sock_extended_err *serr = NULL;
> > +     struct scm_timestamping *tss = NULL;
> > +     struct cmsghdr *cm;
> > +
> > +     for (cm = CMSG_FIRSTHDR(msg);
> > +          cm && cm->cmsg_len;
> > +          cm = CMSG_NXTHDR(msg, cm)) {
> > +             if (cm->cmsg_level == SOL_SOCKET &&
> > +                 cm->cmsg_type == SCM_TIMESTAMPING) {
> > +                     tss = (void *)CMSG_DATA(cm);
> > +             } else if ((cm->cmsg_level == SOL_IP &&
> > +                         cm->cmsg_type == IP_RECVERR) ||
> > +                        (cm->cmsg_level == SOL_IPV6 &&
> > +                         cm->cmsg_type == IPV6_RECVERR) ||
> > +                        (cm->cmsg_level == SOL_PACKET &&
> > +                         cm->cmsg_type == PACKET_TX_TIMESTAMP)) {
> > +                     serr = (void *)CMSG_DATA(cm);
> > +                     ASSERT_EQ(serr->ee_origin, SO_EE_ORIGIN_TIMESTAMPING,
> > +                               "cmsg type");
> > +             }
> > +
> > +             if (serr && tss)
>
> Regarding this check, does it need to reset both serr and tss to NULL before the
> next iteration? e.g. It can get >1 timestamps in one recvmsg(MSG_ERRQUEUE) ?

If more than one skb carrying timestamping is received in one recvmsg
from the error queue in this case, it means something goes wrong. So
we don't expect that to happen.

Thanks,
Jason

>
> > +                     test_socket_timestamp(tss, serr->ee_info,
> > +                                           serr->ee_data);
> > +     }
> > +}
> > +
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux