datapath: Refactor get_dp() function into multiple access APIs.