• Leo Yan's avatar
    perf arm-spe: Fix packet length handling · 0a04244c
    Leo Yan authored
    When processing address packet and counter packet, if the packet
    contains extended header, it misses to account the extra one byte for
    header length calculation, thus returns the wrong packet length.
    
    To correct the packet length calculation, one possible fixing is simply
    to plus extra 1 for extended header, but will spread some duplicate code
    in the flows for processing address packet and counter packet.
    Alternatively, we can refine the function arm_spe_get_payload() to not
    only support short header and allow it to support extended header, and
    rely on it for the packet length calculation.
    
    So this patch refactors function arm_spe_get_payload() with a new
    argument 'ext_hdr' for support extended header; the packet processing
    flows can invoke this function to unify the packet length calculation.
    Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
    Reviewed-by: default avatarAndre Przywara <andre.przywara@arm.com>
    Link: https://lore.kernel.org/r/20201111071149.815-6-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    0a04244c
arm-spe-pkt-decoder.c 11.6 KB