Print this page
13230 i40e has duplicate traffic when used with bhyve/snoop running


 206         i40e_stop(i40e);
 207 done:
 208         mutex_exit(&i40e->i40e_general_lock);
 209 }
 210 
 211 /*
 212  * Enable and disable promiscuous mode as requested. We have to toggle both
 213  * unicast and multicast. Note that multicast may already be enabled due to the
 214  * i40e_m_multicast may toggle it itself. See i40e_main.c for more information
 215  * on this.
 216  */
 217 static int
 218 i40e_m_promisc(void *arg, boolean_t on)
 219 {
 220         i40e_t *i40e = arg;
 221         struct i40e_hw *hw = &i40e->i40e_hw_space;
 222         int ret = 0, err = 0;
 223 
 224         mutex_enter(&i40e->i40e_general_lock);
 225         if (i40e->i40e_state & I40E_SUSPENDED) {
 226                 ret = ECANCELED;
 227                 goto done;
 228         }
 229 
 230 
 231         ret = i40e_aq_set_vsi_unicast_promiscuous(hw, I40E_DEF_VSI_SEID(i40e),
 232             on, NULL, B_FALSE);
 233         if (ret != I40E_SUCCESS) {
 234                 i40e_error(i40e, "failed to %s unicast promiscuity on "
 235                     "the default VSI: %d", on == B_TRUE ? "enable" : "disable",
 236                     ret);
 237                 err = EIO;
 238                 goto done;
 239         }
 240 
 241         /*
 242          * If we have a non-zero mcast_promisc_count, then it has already been
 243          * enabled or we need to leave it that way and not touch it.
 244          */
 245         if (i40e->i40e_mcast_promisc_count > 0) {
 246                 i40e->i40e_promisc_on = on;
 247                 goto done;
 248         }
 249 
 250         ret = i40e_aq_set_vsi_multicast_promiscuous(hw, I40E_DEF_VSI_SEID(i40e),
 251             on, NULL);
 252         if (ret != I40E_SUCCESS) {
 253                 i40e_error(i40e, "failed to %s multicast promiscuity on "
 254                     "the default VSI: %d", on == B_TRUE ? "enable" : "disable",
 255                     ret);
 256 
 257                 /*
 258                  * Try our best to put us back into a state that MAC expects us
 259                  * to be in.
 260                  */
 261                 ret = i40e_aq_set_vsi_unicast_promiscuous(hw,
 262                     I40E_DEF_VSI_SEID(i40e), !on, NULL, B_FALSE);
 263                 if (ret != I40E_SUCCESS) {
 264                         i40e_error(i40e, "failed to %s unicast promiscuity on "
 265                             "the default VSI after toggling multicast failed: "
 266                             "%d", on == B_TRUE ? "disable" : "enable", ret);
 267                 }
 268 
 269                 err = EIO;
 270                 goto done;
 271         } else {
 272                 i40e->i40e_promisc_on = on;
 273         }
 274 
 275 done:
 276         mutex_exit(&i40e->i40e_general_lock);
 277         return (err);
 278 }
 279 
 280 /*
 281  * See the big theory statement in i40e_main.c for multicast address management.
 282  */




 206         i40e_stop(i40e);
 207 done:
 208         mutex_exit(&i40e->i40e_general_lock);
 209 }
 210 
 211 /*
 212  * Enable and disable promiscuous mode as requested. We have to toggle both
 213  * unicast and multicast. Note that multicast may already be enabled due to the
 214  * i40e_m_multicast may toggle it itself. See i40e_main.c for more information
 215  * on this.
 216  */
 217 static int
 218 i40e_m_promisc(void *arg, boolean_t on)
 219 {
 220         i40e_t *i40e = arg;
 221         struct i40e_hw *hw = &i40e->i40e_hw_space;
 222         int ret = 0, err = 0;
 223 
 224         mutex_enter(&i40e->i40e_general_lock);
 225         if (i40e->i40e_state & I40E_SUSPENDED) {
 226                 err = ECANCELED;
 227                 goto done;
 228         }
 229 
 230 
 231         ret = i40e_aq_set_vsi_unicast_promiscuous(hw, I40E_DEF_VSI_SEID(i40e),
 232             on, NULL, B_TRUE);
 233         if (ret != I40E_SUCCESS) {
 234                 i40e_error(i40e, "failed to %s unicast promiscuity on "
 235                     "the default VSI: %d", on == B_TRUE ? "enable" : "disable",
 236                     ret);
 237                 err = EIO;
 238                 goto done;
 239         }
 240 
 241         /*
 242          * If we have a non-zero mcast_promisc_count, then it has already been
 243          * enabled or we need to leave it that way and not touch it.
 244          */
 245         if (i40e->i40e_mcast_promisc_count > 0) {
 246                 i40e->i40e_promisc_on = on;
 247                 goto done;
 248         }
 249 
 250         ret = i40e_aq_set_vsi_multicast_promiscuous(hw, I40E_DEF_VSI_SEID(i40e),
 251             on, NULL);
 252         if (ret != I40E_SUCCESS) {
 253                 i40e_error(i40e, "failed to %s multicast promiscuity on "
 254                     "the default VSI: %d", on == B_TRUE ? "enable" : "disable",
 255                     ret);
 256 
 257                 /*
 258                  * Try our best to put us back into a state that MAC expects us
 259                  * to be in.
 260                  */
 261                 ret = i40e_aq_set_vsi_unicast_promiscuous(hw,
 262                     I40E_DEF_VSI_SEID(i40e), !on, NULL, B_TRUE);
 263                 if (ret != I40E_SUCCESS) {
 264                         i40e_error(i40e, "failed to %s unicast promiscuity on "
 265                             "the default VSI after toggling multicast failed: "
 266                             "%d", on == B_TRUE ? "disable" : "enable", ret);
 267                 }
 268 
 269                 err = EIO;
 270                 goto done;
 271         } else {
 272                 i40e->i40e_promisc_on = on;
 273         }
 274 
 275 done:
 276         mutex_exit(&i40e->i40e_general_lock);
 277         return (err);
 278 }
 279 
 280 /*
 281  * See the big theory statement in i40e_main.c for multicast address management.
 282  */