You need to understand the concept of layers.
An application will send data to the Transport Layer. The Transport Layer protocol will encapsulate the data inside headers for the Transport Layer protocol, and pass those to the Network Layer.
The Network Layer will encapsulate the datagrams it receives inside Network Layer headers, and those are called packets. The packets will be passed to the Data-Link Layer.
The Data-Link Layer will encapsulate the packets inside Data-Link Layer headers, and those are called frames.
Switches only look at the frames, and not at the packets. Routers strip off and discard the frame headers, and they only look at the packets.
For example:
An application on Host A sends data to an application on Host B, via TCP. The application on Host A will send the data to TCP, and TCP segments the data into TCP segments, each of which have a TCP header that includes the source and destination TCP addresses (ports).
TCP passes the segments to IP. IP will add the IP headers, creating IP packets, each of which contain the source and destination IP addresses.
IP passes the packets to ethernet. Ethernet will add the ethernet headers, creating ethernet frames, each of which will have the source and destination ethernet addresses (MAC addresses).
Ethernet will send the frames on the wire to an ethernet switch. The switch will inspect the frame headers, and it will switch the frames to the interface where it last saw the destination MAC address. If it doesn't have a destination interface, it will flood the frames to all interfaces except the one where it received the frame.
The switch doesn't know or care what Network Layer protocol is used because it knows nothing about Network Layer protocols.
When the destination host receives the frame, it reverses the process used to encapsulate the data, and the data end up in the destination application.