Fungi or Invertebrate Nest?

Fungi or Invertebrate Nest?

Observation - Fungi or Invertebrate Nest? - UK and Ireland. Description: Found on the trunk of a standing, live, tree in mixed woodland at the point where the trunk bent at an odd angle. Could not determine whether that bend was due to some historical damage or pruning. Some of the cell-like structures on the surface contain

Found on the trunk of a standing, live, tree in mixed woodland at the point where the trunk bent at an odd angle. Could not determine whether that bend was due to some historical damage or pruning.
Some of the cell-like structures on the surface contained small black & grey grubs. Not sure if the grubs were feeding on the softer parts of a fungi leaving behind the cell-like structures. Or, that the structure had been built by the invertebrates whose larvae those grubs were