Page MenuHomeFreeBSD

tcp: don't define and use BBLog function when TCP_BLACKBOX is not defined
ClosedPublic

Authored by tuexen on Nov 2 2024, 2:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 14, 5:32 AM
Unknown Object (File)
Thu, Oct 9, 8:23 AM
Unknown Object (File)
Thu, Oct 2, 3:47 AM
Unknown Object (File)
Wed, Sep 17, 6:33 AM
Unknown Object (File)
Wed, Sep 17, 6:21 AM
Unknown Object (File)
Tue, Sep 16, 11:06 PM
Unknown Object (File)
Sep 15 2025, 11:22 AM
Unknown Object (File)
Sep 12 2025, 3:22 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tuexen requested review of this revision.Nov 2 2024, 2:03 PM

Wouldn't it be possible to #define tcp_lro_log in a #else of the first block, such that this scattering of #ifdef's throughout the file could be avoided?

#ifdef TCP_BLACKBOX
static void
tcp_lro_log(struct tcpcb *tp, const struct lro_ctrl *lc,
    const struct lro_entry *le, const struct mbuf *m,
    int frm, int32_t tcp_data_len, uint32_t th_seq,
    uint32_t th_ack, uint16_t th_win)
{
:
}
#else
#define tcp_lro_log(tp, lc, le, m, frm, tcp_data_len, th_seq, th_ack, th_win)
#endif

Wouldn't it be possible to #define tcp_lro_log in a #else of the first block, such that this scattering of #ifdef's throughout the file could be avoided?

#ifdef TCP_BLACKBOX
static void
tcp_lro_log(struct tcpcb *tp, const struct lro_ctrl *lc,
    const struct lro_entry *le, const struct mbuf *m,
    int frm, int32_t tcp_data_len, uint32_t th_seq,
    uint32_t th_ack, uint16_t th_win)
{
:
}
#else
#define tcp_lro_log(tp, lc, le, m, frm, tcp_data_len, th_seq, th_ack, th_win)
#endif

That is possible. However, I prefer to see that the code is not executed compared to look up the definition of tcp_lro_log() a couple of times. This this is a subjective preference...

This revision is now accepted and ready to land.Nov 14 2024, 5:14 PM

I agree with Michael here, macros badly hide things.. which is their intention :)