Which component (the traffic processor, the CPU or some other component) of a switch/router is responsible for packet classification/DPI?
Mostly, that would be done by a dedicated appliance, such as a next-generation firewall. Some vendors implement this as an optional service in software on routers, e.g. Cisco's NBAR2, performed using the router's CPU. The service is very CPU intensive, and the performance/throughput of a router running something like this is severely impacted, which is why you normally do this on a dedicated appliance.