We know a good deal about how the individual cells work at the molecular / electrophysiological level, and how simple circuits function; and we also have a fair understanding of the gross structural organisation of the brain.
It's the middle layer that's the big unknown: how simple circuits link up to form complex behaviours, but it's not an impossible problem. I suspect looking at the smaller nervous systems of invertebrates will give us the conceptual understanding of these interactions, which we can then scale to understand mammals. We're largely waiting on the technology to map these circuits, and the computational tools to simulate and analyse them.