service: don't walk out of bounds when checking services
[dpdk.git] / drivers / net / ixgbe / ixgbe_pf.c
index a2ae703..d0d85e1 100644 (file)
@@ -40,7 +40,7 @@ dev_num_vf(struct rte_eth_dev *eth_dev)
 static inline
 int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num)
 {
-       unsigned char vf_mac_addr[ETHER_ADDR_LEN];
+       unsigned char vf_mac_addr[RTE_ETHER_ADDR_LEN];
        struct ixgbe_vf_info *vfinfo =
                *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
        uint16_t vfn;
@@ -49,7 +49,7 @@ int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num)
                rte_eth_random_addr(vf_mac_addr);
                /* keep the random address as default */
                memcpy(vfinfo[vfn].vf_mac_addresses, vf_mac_addr,
-                          ETHER_ADDR_LEN);
+                          RTE_ETHER_ADDR_LEN);
        }
 
        return 0;
@@ -161,16 +161,14 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev)
        struct ixgbe_ethertype_filter ethertype_filter;
 
        if (!hw->mac.ops.set_ethertype_anti_spoofing) {
-               RTE_LOG(INFO, PMD, "ether type anti-spoofing is not"
-                       " supported.\n");
+               PMD_DRV_LOG(INFO, "ether type anti-spoofing is not supported.\n");
                return;
        }
 
        i = ixgbe_ethertype_filter_lookup(filter_info,
                                          IXGBE_ETHERTYPE_FLOW_CTRL);
        if (i >= 0) {
-               RTE_LOG(ERR, PMD, "A ether type filter"
-                       " entity for flow control already exists!\n");
+               PMD_DRV_LOG(ERR, "A ether type filter entity for flow control already exists!\n");
                return;
        }
 
@@ -183,8 +181,7 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev)
        i = ixgbe_ethertype_filter_insert(filter_info,
                                          &ethertype_filter);
        if (i < 0) {
-               RTE_LOG(ERR, PMD, "Cannot find an unused ether type filter"
-                       " entity for flow control.\n");
+               PMD_DRV_LOG(ERR, "Cannot find an unused ether type filter entity for flow control.\n");
                return;
        }
 
@@ -415,7 +412,7 @@ ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf)
 
        vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
 
-       RTE_LOG(INFO, PMD, "VF %u: disabling multicast promiscuous\n", vf);
+       PMD_DRV_LOG(INFO, "VF %u: disabling multicast promiscuous\n", vf);
 
        vmolr &= ~IXGBE_VMOLR_MPE;
 
@@ -443,7 +440,7 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf)
 
        /* reply to reset with ack and vf mac address */
        msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK;
-       rte_memcpy(new_mac, vf_mac, ETHER_ADDR_LEN);
+       rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN);
        /*
         * Piggyback the multicast filter type so VF can compute the
         * correct vectors
@@ -547,7 +544,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        uint32_t new_mtu = msgbuf[1];
        uint32_t max_frs;
-       int max_frame = new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+       int max_frame = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
 
        /* X540 and X550 support jumbo frames in IOV mode */
        if (hw->mac.type != ixgbe_mac_X540 &&
@@ -556,7 +553,8 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
                hw->mac.type != ixgbe_mac_X550EM_a)
                return -1;
 
-       if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN))
+       if (max_frame < RTE_ETHER_MIN_LEN ||
+                       max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)
                return -1;
 
        max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) &
@@ -587,7 +585,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
                break;
        }
 
-       RTE_LOG(ERR, PMD, "Negotiate invalid api version %u from VF %d\n",
+       PMD_DRV_LOG(ERR, "Negotiate invalid api version %u from VF %d\n",
                api_version, vf);
 
        return -1;
@@ -617,6 +615,7 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
        case ixgbe_mbox_api_20:
        case ixgbe_mbox_api_11:
        case ixgbe_mbox_api_12:
+       case ixgbe_mbox_api_13:
                break;
        default:
                return -1;
@@ -634,7 +633,7 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
        switch (eth_conf->txmode.mq_mode) {
        case ETH_MQ_TX_NONE:
        case ETH_MQ_TX_DCB:
-               RTE_LOG(ERR, PMD, "PF must work with virtualization for VF %u"
+               PMD_DRV_LOG(ERR, "PF must work with virtualization for VF %u"
                        ", but its tx mode = %d\n", vf,
                        eth_conf->txmode.mq_mode);
                return -1;
@@ -669,7 +668,7 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
                break;
 
        default:
-               RTE_LOG(ERR, PMD, "PF work with invalid mode = %d\n",
+               PMD_DRV_LOG(ERR, "PF work with invalid mode = %d\n",
                        eth_conf->txmode.mq_mode);
                return -1;
        }
@@ -724,7 +723,7 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
                fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
                if (!(fctrl & IXGBE_FCTRL_UPE)) {
                        /* VF promisc requires PF in promisc */
-                       RTE_LOG(ERR, PMD,
+                       PMD_DRV_LOG(ERR,
                               "Enabling VF promisc requires PF in promisc\n");
                        return -1;
                }