[PATCH OLK-6.6 1/2] bpf: Refactor stack map trace depth calculation into helper function