The ports of latest network switches have a feature called Auto-MDIX.
Before reading further, I strongly recommend you to read following lessons thoroughly and understand the concepts about copper twisted pair cables, straight-through and cross-over types of twisted pair cables from below links.
To understand what is Auto-MDI/MDIX, first we need to know what are MDI/MDIX ports.
The port on a workstation computer (or laptop) is called as MDI (Media Dependent Interface). The ports on network switches are called as MDIX (Media Dependent Interface with Crossover).
RJ45 jacks are attached (crimped) to copper twisted pair cables in such a way that the transmit pair pins on one end of the twisted pair cable is connected to the receive pair pins on the other end and vice versa.
If by mistake, the transmit pins on one side is connected to transmit on the other side, communication will fail. Traditionally, there are two types of twisted pair cable crimping. One is called straight through and the other is called as cross over. As discussed in previous lesson (Straight-Through and Cross-Over cables), the transmission pins on a network switch is opposite to that of a workstation computer (or laptop). To connect a workstation computer to a network switch, we need a straight through crimped twisted pair cable. When two workstation computers or switches are connected back-to-back, we need a crossover crimped twisted pair cable to make transmission pins one side match with the receiving pins on other side.
Auto-MDI/MDIX feature allows a switch port to automatically detect what type of port is connected on other end (MDI port or MDIX port) and swap the transmission and receive pins. Thus, the transmission pins on one side may connect with the receive pins on other side.