Print this page
Support route deletion entries in SVP_R_LOG_ACK.

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/varpd/svp/common/libvarpd_svp_remote.c
          +++ new/usr/src/lib/varpd/svp/common/libvarpd_svp_remote.c
↓ open down ↓ 292 lines elided ↑ open up ↑
 293  293   */
 294  294  static boolean_t
 295  295  svp_outbound_version_check(int version, svp_query_t *sqp)
 296  296  {
 297  297          uint16_t op = htons(sqp->sq_header.svp_op);
 298  298  
 299  299          /*
 300  300           * As of v1 -> v2, we really only need to restrict SVP_R_ROUTE_REQ
 301  301           * as v2-only.  Reflect that here.
 302  302           *
 303      -         * NOTE that if any message semantics change between future versions,
      303 +         * NOTE that if any message semantics change between versions,
 304  304           * (e.g. "in v3 SVP_R_VL2_REQ takes on additional work"), we'll
 305  305           * need to more-deeply inspect the query.  It's possible that the
 306  306           * svp_op space is big enough to just continue op-only inspections.
 307  307           */
 308  308  
 309  309          assert(version > 0 && version <= SVP_CURRENT_VERSION);
 310  310  
 311  311          if (op != SVP_R_ROUTE_REQ || version >= SVP_VERSION_TWO) {
 312  312                  sqp->sq_header.svp_ver = htons(version);
 313  313                  return (B_TRUE);
 314  314          }
      315 +
 315  316          return (B_FALSE);
 316  317  }
 317  318  
 318  319  /*
 319  320   * Walk the list of connections and find the first one that's available AND
 320  321   * version-appropriate for the message, then move the matched connection to
 321  322   * the back of the list so it's less likely to be used again.
 322  323   */
 323  324  static boolean_t
 324  325  svp_remote_conn_queue(svp_remote_t *srp, svp_query_t *sqp)
↓ open down ↓ 209 lines elided ↑ open up ↑
 534  535  
 535  536          sqp->sq_svp = svp;
 536  537          svp_remote_vl3_common(srp, sqp, addr, svp_remote_vl3_lookup_cb,
 537  538              arg, svp->svp_vid);
 538  539  }
 539  540  
 540  541  static void
 541  542  svp_remote_log_request_cb(svp_query_t *sqp, void *arg)
 542  543  {
 543  544          svp_remote_t *srp = sqp->sq_arg;
      545 +        uint16_t version;
 544  546  
      547 +        /*
      548 +         * Version in request is set in this sqp's read-data/sq_header by
      549 +         * now.
      550 +         */
      551 +        assert(sqp->sq_header.svp_op == htons(SVP_R_LOG_REQ));
      552 +        assert(sqp->sq_header.svp_ver != 0);
      553 +        version = htons(sqp->sq_header.svp_ver);
      554 +
 545  555          assert(sqp->sq_wdata != NULL);
 546  556          if (sqp->sq_status == SVP_S_OK)
 547  557                  svp_shootdown_logr_cb(srp, sqp->sq_status, sqp->sq_wdata,
 548      -                    sqp->sq_size);
      558 +                    sqp->sq_size, version);
 549  559          else
 550      -                svp_shootdown_logr_cb(srp, sqp->sq_status, NULL, 0);
      560 +                svp_shootdown_logr_cb(srp, sqp->sq_status, NULL, 0, 0);
 551  561  }
 552  562  
 553  563  void
 554  564  svp_remote_log_request(svp_remote_t *srp, svp_query_t *sqp, void *buf,
 555  565      size_t buflen)
 556  566  {
 557  567          svp_log_req_t *logr = &sqp->sq_rdun.sdq_logr;
 558  568          boolean_t queued;
 559  569  
 560  570          sqp->sq_func = svp_remote_log_request_cb;
↓ open down ↓ 16 lines elided ↑ open up ↑
 577  587  
 578  588          /*
 579  589           * If this fails, there isn't much that we can't do. Give the callback
 580  590           * with a fatal status.
 581  591           */
 582  592          mutex_enter(&srp->sr_lock);
 583  593          queued = svp_remote_conn_queue(srp, sqp);
 584  594          mutex_exit(&srp->sr_lock);
 585  595  
 586  596          if (queued == B_FALSE)
 587      -                svp_shootdown_logr_cb(srp, SVP_S_FATAL, NULL, 0);
      597 +                svp_shootdown_logr_cb(srp, SVP_S_FATAL, NULL, 0, 0);
 588  598  }
 589  599  
 590  600  static void
 591  601  svp_remote_lrm_request_cb(svp_query_t *sqp, void *arg)
 592  602  {
 593  603          svp_remote_t *srp = arg;
 594  604  
 595  605          svp_shootdown_lrm_cb(srp, sqp->sq_status);
 596  606  }
 597  607  
↓ open down ↓ 26 lines elided ↑ open up ↑
 624  634  
 625  635          /*
 626  636           * If this fails, there isn't much that we can't do. Give the callback
 627  637           * with a fatal status.
 628  638           */
 629  639          mutex_enter(&srp->sr_lock);
 630  640          queued = svp_remote_conn_queue(srp, sqp);
 631  641          mutex_exit(&srp->sr_lock);
 632  642  
 633  643          if (queued == B_FALSE)
 634      -                svp_shootdown_logr_cb(srp, SVP_S_FATAL, NULL, 0);
      644 +                svp_shootdown_logr_cb(srp, SVP_S_FATAL, NULL, 0, 0);
 635  645  }
 636  646  
 637  647  /* ARGSUSED */
 638  648  void
 639  649  svp_remote_dns_timer(void *unused)
 640  650  {
 641  651          svp_remote_t *s;
 642  652          mutex_enter(&svp_remote_lock);
 643  653          for (s = avl_first(&svp_remote_tree); s != NULL;
 644  654              s = AVL_NEXT(&svp_remote_tree, s)) {
↓ open down ↓ 239 lines elided ↑ open up ↑
 884  894  svp_remote_shootdown_vl2(svp_remote_t *srp, svp_log_vl2_t *svl2)
 885  895  {
 886  896          svp_t *svp, lookup;
 887  897  
 888  898          lookup.svp_vid = ntohl(svl2->svl2_vnetid);
 889  899          mutex_enter(&srp->sr_lock);
 890  900          if ((svp = avl_find(&srp->sr_tree, &lookup, NULL)) != NULL) {
 891  901                  svp->svp_cb.scb_vl2_invalidate(svp, svl2->svl2_mac);
 892  902          }
 893  903          mutex_exit(&srp->sr_lock);
      904 +}
      905 +
      906 +void
      907 +svp_remote_shootdown_route(svp_remote_t *srp, svp_log_route_t *svlr)
      908 +{
      909 +        svp_t *svp, lookup;
      910 +
      911 +        lookup.svp_vid = ntohl(svlr->svlr_src_vnetid);
      912 +        mutex_enter(&srp->sr_lock);
      913 +        if ((svp = avl_find(&srp->sr_tree, &lookup, NULL)) != NULL) {
      914 +                svp->svp_cb.scb_route_shootdown(svp, svlr->svlr_srcip,
      915 +                    svlr->svlr_dstip, svlr->svlr_src_prefixlen,
      916 +                    svlr->svlr_dst_prefixlen, htons(svlr->svlr_src_vlan));
      917 +        }
      918 +        mutex_exit(&srp->sr_lock);
 894  919  }
 895  920  
 896  921  int
 897  922  svp_remote_init(void)
 898  923  {
 899  924          svp_idspace = id_space_create("svp_req_ids", 1, INT32_MAX);
 900  925          if (svp_idspace == NULL)
 901  926                  return (errno);
 902  927          avl_create(&svp_remote_tree, svp_remote_comparator,
 903  928              sizeof (svp_remote_t), offsetof(svp_remote_t, sr_gnode));
↓ open down ↓ 16 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX